Fortran Wiki
system_clock

Description

system_clock lets you measure durations of time with the precision of the smallest time increment generally available on a system by returning processor-dependent values based on the current value of the processor clock. The clock value is incremented by one for each clock count until the value count_max is reached and is then reset to zero at the next count. clock therefore is a modulo value that lies in the range 0 to count_max. count_rate and count_max are assumed constant (even though CPU rates can vary on a single platform).

count_rate is system dependent and can vary depending on the kind of the arguments.

If there is no clock, or querying the clock fails, count is set to -huge(count), and count_rate and count_max are set to zero.

system_clock is typically used to measure short time intervals (system clocks may be 24-hour clocks or measure processor clock ticks since boot, for example). It is most often used for measuring or tracking the time spent in code blocks in lieu of using profiling tools.