Forums

mips estimation on pc

Started by rich_158 June 18, 2008
hi

i would like to qualify the speed of an algorithm on a desktop PC.  I know
that a mips calculation is not really accurate but i just require something
that will give a basic indication of speed so i can estimate and work on
reducing the algorithm complexity in quite a formal.

thanks
On Jun 18, 12:16 pm, "rich_158" <eecod...@hotmail.com> wrote:
> hi > > i would like to qualify the speed of an algorithm on a desktop PC. I know > that a mips calculation is not really accurate but i just require something > that will give a basic indication of speed so i can estimate and work on > reducing the algorithm complexity in quite a formal. > > thanks
the following code can be used to calculate cycles and time #include <time.h> main() { clock_t s_time, e_time; double t_time; s_time=clock(); Function(); e_time=clock(); size = t_time=(e_time-s_time)/(double)(CLOCKS_PER_SEC); printf("Time taken by Function ---> %4.5f seconds\n", t_time); }
"rich_158" <eecoding@hotmail.com> wrote in message 
news:JZGdnQQfNLOgK8XVnZ2dnUVZ_t_inZ2d@giganews.com...
> hi > > i would like to qualify the speed of an algorithm on a desktop PC. I know > that a mips calculation is not really accurate but i just require > something > that will give a basic indication of speed so i can estimate and work on > reducing the algorithm complexity in quite a formal. > > thanks
Windows has a high speed counter, here's the msdn reference: http://msdn.microsoft.com/en-us/library/ms644904(VS.85).aspx I beleive your supposed to get the Hz of your hardware with QueryPerformanceFrequency, then use QueryPerformanceCounter to grab the counter value. Seomthing like:- Done once: QueryPerformanceFrequency((LARGE_INTEGER*)&freq64); freq = 1000.0f / (double)freq64; Counter:
Sorry, I pressed a short-cut key and it sent accidentally, finished 
example:-

>> i would like to qualify the speed of an algorithm on a desktop PC. I >> know >> that a mips calculation is not really accurate but i just require >> something >> that will give a basic indication of speed so i can estimate and work on >> reducing the algorithm complexity in quite a formal. >> >> thanks
Windows has a high speed counter, here's the msdn reference: http://msdn.microsoft.com/en-us/library/ms644904(VS.85).aspx I beleive your supposed to get the Hz of your hardware once with QueryPerformanceFrequency, then use QueryPerformanceCounter to grab the counter value. Something like:- Done once: __int64 freq64; QueryPerformanceFrequency((LARGE_INTEGER*)&freq64); freq = 1000.0f / (double)freq64; Get time: QueryPerformanceCounter((LARGE_INTEGER*)&time64; return (time64*freq); // In milliseconds.