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

# mips estimation on pc

Started by ●June 18, 2008

Reply by ●June 18, 20082008-06-18

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. > > thanksthe 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); }

Reply by ●June 20, 20082008-06-20

"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. > > thanksWindows 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:

Reply by ●June 20, 20082008-06-20

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. >> >> thanksWindows 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.