next up previous
Next: Profilers Up: TIMERS AND PROFILERS Previous: The Unix Time Command

Timers

In order to isolate and time different parts of the code, you can use the SYSTEM_CLOCK subroutine. This helps you to identify where your program takes the most amount of time.


USAGE:
 	CALL SYSTEM_CLOCK(count_rate=cr)
	CALL SYSTEM_CLOCK(count_max=cm)
	CALL SYSTEM_CLOCK(count = t1)
 	*code you want to time*
 	CALL SYSTEM_CLOCK(count = t2)
 	r1 = real(modulo(t2-t1,cm))/real(cr) 
	WRITE(6,*) r1
Example: If the processor clock is a 24-hour clock registring time in 1-second interval, at 10:30 AM , the reference


CALL SYSTEM_CLOCK(count_rate = cr, count_max = cm, count = t1)
sets


cr $= 1$, cm $= 24\times3600–1 = 86399$, t1 $= 10\times3600+30\times60 = 37800$



bill atkinson 2008-07-18