The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: pro3carp3 on March 03, 2005, 10:15:33 PM

Title: Optimization Testing
Post by: pro3carp3 on March 03, 2005, 10:15:33 PM
As a beginner in assembly, I'm not familiar with how to ascertain the timings or clock cycles.  I was hoping I could obtain a template which would allow me to insert my code, or insert the template code before & after the section to be tested.

Any suggestions?

Thanks.
Title: Re: Optimization Testing
Post by: OceanJeff32 on March 04, 2005, 02:30:54 AM
I just found a great timing function you have to use Windows API:

GetTickCount()

You could call GetTickCount(), then run your code that you want to time, then call GetTickCount() and see how many ticks passed.

Hope that helps.

Jeff C
:U

P.S. I got the idea from Optimizing Visual C++ with Assembly Code (forgot the author's name at the moment).
Title: Re: Optimization Testing
Post by: AeroASM on March 04, 2005, 07:35:15 AM
Go to the laboratory and find MichaelW's code timing macros.
Title: Re: Optimization Testing
Post by: Petroizki on March 04, 2005, 08:03:45 AM
OceanJeff32,

GetTickCount is bad for timing, it is not high interval timer, and depending on OS, it is usually updated like every 10ms..
On C++ code you should use something like QueryPerformanceCounter to get more accurare results.