The MASM Forum Archive 2004 to 2012

General Forums => The Workshop => Topic started by: ToutEnMasm on October 26, 2010, 07:53:53 AM

Title: QueryPerformanceCounter function
Post by: ToutEnMasm on October 26, 2010, 07:53:53 AM
I have searched a more usable way for this function than the macro of masm32.The timer_begin macro give only a result in milli seconds and couldn't be use anywhere.
Here is the result.(corrected missing proc)
Quote
Only eax and the flags are changed by the functions
no use of the fpu or sse intructions are made

Starting the timer:
invoke StartTimer,Number_of_loop,unit,priority
   *Number_of_loop can be 1 to x(dword)
   *unit can be one of the constants defined below
   *priority can be null or one of the values defined for SetPriorityClass
EndTimer:
no parameter,return a pointer on TIMER_RESULT struct
The structure give a result in periods or in seconds/unit
frequency = Number of periods per second



unite_seconde   equ 1      ;fseconde is in second
unite_milliseconde equ 1000     ;fseconde is in second/1000
unite_microseconde equ 1000000  ;fseconde is in second/1000000
StartTimer PROTO  :DWORD,  :DWORD,  :DWORD
EndTimer PROTO
TIMER_RESULT STRUCT
   periode  dq ?      ;1/f
   fseconde dq ?
TIMER_RESULT ENDS