[Developers] Proposed Cactus Timer API Completion

Gabrielle Allen gallen at cct.lsu.edu
Tue Aug 3 08:28:57 CDT 2004


Note that "clocks" are not just measuring in seconds, but need to  
report on all kinds of hardware and other timers: MFlops, Flops, cache  
misses, ...

On Aug 3, 2004, at 7:54 AM, Steve White wrote:

> The existing API for Cactus Timers provides accessors for Timers, but
> peters out when it comes to getting information for a particular clock
> within a timer value.  The interface consists of a structure definition
> (see Chapter B10.1 of the Users' Guide).
>
> There is something a bit wrong-headed about the existing clock  
> structure.
> It records information as a type that is convenient for the low-level
> timer (as an int, long, or double), although the user invariably wants  
> the
> time period in seconds.  There are outstanding bug reports to this  
> effect.
>
> Accordingly, I propose to add the following functions to the Timer API:
>
> ====================================================================
> unsigned int
> CCTK_NumTimerClocks( const cTimerData *info )
> 	// Gets the number of clocks recorded in a timer measurement
>
> const cTimerVal *
> CCTK_GetClockValNumber( int clockno, const cTimerData *info );
> 	// Gets the clock value with the given number from the
> 	// timer measurement
>
> const cTimerVal *
> CCTK_GetClockValNamed( const char * name, const cTimerData *info );
> 	// Gets the clock value for the clock with the given name
> 	// from the timer measurement
>
> const char *
> CCTK_TimerClockName( const cTimerVal *clockVal );
>         // Gets the name of the clock corresponding to the clock value
>
> double
> CCTK_TimerClockSeconds( const cTimerVal *clockVal );
> 	// Gets the value of the measurement in seconds from the clock
> 	// value
> ====================================================================
> The intent is to protect the user entirely from the internals of the
> cTimerVal and cTimerData structures.
>
> The code snippet in B10.1.4 "Accessing the timer results" becomes
>
>    cTimerData *info = CCTK_TimerCreateData();
>    int nclocks = CCTK_NumTimerClocks( info );
>
>    for (i = 0; i < numclocks; i++)
>    {
>      const cTimerVal   *clock = CCTK_GetClockValNumber( i, info );
>      printf ("\t%s: %.3f %s\n", CCTK_TimerClockName( clock ),
>                                 CCTK_TimerClockSeconds( clock ),  
> "secs" );
>    }
>    CCTK_TimerDestroyData (info);
>
> ----------------------------------------------------------------------- 
> -
> Steve White : Programmer
> Max-Planck-Institut für Gravitationsphysik       
> Albert-Einstein-Institut
> Am Mühlenberg 1, D-14476 Golm, Germany                   
> +49-331-567-7329
>
>
> _______________________________________________
> Developers mailing list
> Developers at cactuscode.org
> http://www.cactuscode.org/mailman/listinfo/developers
>
>
Gabrielle Allen
Assistant Director for Computing Applications
Center for Computation and Technology
gallen at cct.lsu.edu
+1 225 284 6605





More information about the Developers mailing list