GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> EDS / V2-11-5 > edspbs / rhel6-32


Interface   Data Structures   File List   Data Fields   Globals  

TMR.h File Reference

Provides a set of timing macros. More...

#include <impl/TMR.xx-xxx-xxx.h>

Classes

struct  _TMR_usecs_nsecs
 Structure to hold the time in terms of two integers, one giving the number of micro-seconds, the other the number of milliseconds. More...

Typedefs

typedef struct _TMR_usecs_nsecs TMR_usecs_nsecs
 Typedef for struct _TMR_usecs_nsecs.

Functions

int TMR_initialize (void)
 Initializes the TMR facility.
TMR_tick TMR_nsecs_to_ticks (int nanoseconds)
 Convert a number of nanoseconds to PTUs.
unsigned int TMR_ticks_to_nsecs (TMR_tick ticks)
 Convert a number of ticks to nanoseconds.
TMR_usecs_nsecs TMR_ticks_to_usecs_nsecs (TMR_tick ticks)
 Convert a number of ticks useconds.nanoseconds.
unsigned int TMR_frequency (void)
 Get the frequency of the processor timer.


Detailed Description

Provides a set of timing macros.

Author:
JJRussell - russell@slac.stanford.edu
    CVS $Id: TMR.h,v 1.4 2011/03/25 22:16:55 russell Exp $

ABSTRACT
This implements a facility to time accurately short duration events. The implementation is platform dependent, seeking to use the highest resolution clock that is available. The facility provides a uniform and consistent compile time interface. Note that this is not the same as a uniform and consistent run time interface. In particular the timer units may vary platform to platform. This difference is taken out by a typedef of the TMR units (TMR_ticks). The resolution is also platform dependent, so a function to convert process timer units to NSECS is provided.
Finally, to keep the overhead low, consistent with timing short duration events, certain compromises where made. In general, do not use this facility to time events > 200 secs. The normal system clocks should be used instead.
EXAMPLE
    TMR_tick     beg;
    TMR_tick     end;
    TMR_tick elapsed;

    beg     = TMR_GET();
    .
    eventToTime ();
    .
    end     = TMR_GET();
    elapsed = end - beg;

    printf ("Begin   Time: " TMR_FORMAT "tickss\n", beg);
    printf ("End     Time: " TMR_FORMAT "ticks\n", end);
    printf ("Elasped Time: " TMR_FORMAT "tickss\n", elapsed);
    printf ("Elasped Time: " TMR_FORMAT "ticks\n",
                             TMR_TO_NSECS (elapsed);

Function Documentation

unsigned int TMR_frequency ( void   ) 

Get the frequency of the processor timer.

Returns:
The frequency, in Hertz, to the processor timer

References _TMR_parameters::frequency.

int TMR_initialize ( void   ) 

Initializes the TMR facility.

This is a one time only call to initialize internal data structures. This routine should be called as part of the library initialization sequence.

References _TMR_parameters::frequency, and _TMR_parameters::nsecs_per_tick.

TMR_tick TMR_nsecs_to_ticks ( int  nanoseconds  ) 

Convert a number of nanoseconds to PTUs.

Parameters:
nanoseconds The number of nanoseconds to convert to PTUs
Returns:
The number of equivalent PTUs

References _TMR_parameters::frequency.

unsigned int TMR_ticks_to_nsecs ( TMR_tick  ticks  ) 

Convert a number of ticks to nanoseconds.

Parameters:
ticks The number of ticks to convert to nanoseconds
Returns:
The number of equivalent nanoseconds

References _TMR_parameters::nsecs_per_tick.

TMR_usecs_nsecs TMR_ticks_to_usecs_nsecs ( TMR_tick  ticks  ) 

Convert a number of ticks useconds.nanoseconds.

Parameters:
ticks The number of ticks to convert
Returns:
The number of equivalent useconds, nanoseconds

References _TMR_usecs_nsecs::nsecs, _TMR_parameters::nsecs_per_tick, and _TMR_usecs_nsecs::usecs.


Generated on Tue Nov 29 16:59:02 2011 by  doxygen 1.5.8