home *** CD-ROM | disk | FTP | other *** search
- program time
-
- real tstart, tstop
- integer i
- logical wait
- integer calls
-
- call walltime (tstart)
- call cm_timer_clear (0)
- call cm_timer_clear (1)
- call cm_timer_clear (2)
-
- do i = 1, 120
- c wait for next second
- wait = .true.
- calls = 0
- do while (wait)
- calls = calls + 1
- call walltime (tstop)
- wait = (tstop .lt. tstart + i)
- end do
- print *, i, ' seconds (needed ', calls, ' calls)'
- if (i .eq. 10) then
- print *, 'Starting Timer 0'
- call cm_timer_start (0)
- end if
- if (i .eq. 20) then
- print *, 'Starting Timer 1 and 2, stop Timer 0'
- call cm_timer_stop (0)
- call cm_timer_start (1)
- call cm_timer_start (2)
- end if
- if (i .eq. 35) then
- print *, 'stop Timer 1'
- print *, 'start Timer 0'
- call cm_timer_stop (1)
- call cm_timer_start (0)
- end if
- if (i .eq. 45) then
- print *, 'stop Timer 2'
- print *, 'stop Timer 0'
- call cm_timer_stop (2)
- call cm_timer_stop (0)
- end if
- if (mod (I,2) .eq. 1) then
- call cm_timer_start (3)
- else
- call cm_timer_stop (3)
- end if
- end do
-
- print *, 'Timer 0 should have 20 seconds'
- call cm_timer_print (0)
- print *, 'Timer 1 should have 15 seconds'
- call cm_timer_print (1)
- print *, 'Timer 2 should have 25 seconds'
- call cm_timer_print (2)
- print *, 'Timer 3 should have 60 seconds'
- call cm_timer_print (3)
- end
-