Next: Profilers
Up: TIMERS AND PROFILERS
Previous: The Unix Time Command
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
, cm
, t1
bill atkinson
2008-07-18