Search

link to homepage

Institute for Advanced Simulation (IAS)

Navigation and service


How to do time measurements in Fortran and C ?

Time measurement in Fortran:

For timing measurements on JUGENE Fortran users should use either the Fortran90 intrinsic system_clock or MPI_WTIME.


Time measurement in C:

#include < common/bgp_personality.h>
#include < common/bgp_personality_inlines.h>
#include < spi/kernel_interface.h>
static _BGP_Personality_t mybgp;
static double clockspeed=0.0;

/* initialize the clockspeed scaling factor */
unsigned bg_wtime_init() {
unsigned clockMHz;
Kernel_GetPersonality(&mybgp, sizeof(_BGP_Personality_t));
clockMHz = BGP_Personality_clockMHz(&mybgp);
clockspeed = 1.0e-6/(double)clockMHz;
return clockMHz;
}

/* return time in seconds */
double bg_wtime() {
return ( _bgp_GetTimeBase() * clockspeed );
}


Servicemeu

Homepage