The following is the procedure to enable FORTRAN:
The RDTSC assembler instruction returns a 64-bit integer, which is the number of CPU clocks counted from the moment of the year. If your FORTRAN has 64-bit integers, the KOUNT argument is declared as INTEGER * 8. Else declares that it is an array of two 32-bit INTEGER * 4
So in your FORTRAN program you write
CALL TIMERR(KOUNT)
at the beginning, save the KOUNT value, then repeat at the end. Then subtract two 64-bit values ββto determine elapsed time. Usually I just want to subtract the bottom two words, like the fact that I time is usually less than 2 ^ 32 system hours
It can also be called from C, but I do not say C.
; C This assembler routine looks to FORTRAN like this: ; SUBROUTINE TIMERR(KOUNT) ; INTEGER*4 KOUNT(2); or INTEGER*8 KOUNT ; ...get a 64-but system time value into KOUNT...... ; RETURN ; END ; .Code _TIMERR@4 : RDTSC Push Eax Push Ecx Push Edx Mov Ecx, [Esp + 16] Mov [Ecx], Eax Mov [Ecx + 4], Edx Pop Edx Pop Ecx Pop Eax Ret 4
source share