program timingdemo use timing implicit none real :: x = 0.1 integer :: j, k ! make max1 bigger if your computer is fast; increase until the whole ! program exectution takes about 20 seconds integer, parameter :: max1 = 10000000, max2 = 100 integer, parameter :: checkpoint_interval = 5 ! in seconds call initialize_timer() call initialize_checkpoint_timer() do k = 1, max2 do j = 1, max1 x = x*x - x end do if ( should_checkpoint(checkpoint_interval) ) then write(0,*) 'TIME TO CHECKPOINT!' write(0,*) call initialize_checkpoint_timer() end if call print_time('s') end do end program timingdemo