Timers on TFLOP, ASCI-RED


There are several routines available to get cpu time, system time, clock ticks, etc.

Elapsed wall clock time: dclock

f77:

        real*8 dclock,time0,time1

        time0 = dclock()
        call mysubroutine('do something')
        time1 = dclock()
        print *,'elapsed time in seconds=',time1-time0
        call exit


Acknowledgement and Disclaimer
In c:
        double dclock,time0,time1

        time0 = dclock();
        mysubroutine("do something");
        time1 = dclock();
        printf("elapsed time in seconds=%f\n",time1-time0);
There is also a MPI_Wtime.

System clock (in clock ticks): gettsc

This routine will access the system time stamp counter. You can use the 'rdtsc' assembler instruction to do the same thing.

 
#include 
      long long cntr1;
      gettsc(&cntr1); 
      /*now convert clock ticks to seconds */
      printf("system time is %f (secs)\n",(double)(cntr1)/333.0e6);
      /* this will be seconds since reboot */

For f77:

      include 'fperfmon.h'
      integer*8 cntr1
   
      iresult = gettsc(cntr1)
      print *,'seconds since boot=',cntr1/333.0d6