GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> IPBS / V0-0-2 > pbs / i845e


Interface   Data Structures   File List   Data Fields   Globals  

TMR.h File Reference

Provides a set of timing macros. More...

#include <IPBS/PTS.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...

Defines

#define TMR_GET()   PTS_GETS()
 Macro to get the processor time.
#define TMR_TO_NSECS(_ticks)   PTS_PTUS_TO_NSECS(_ticks)
 Convert a time processor time ticks to nanoseconds.
#define TMR_DELTA(_beg, _end)   PTS_DELTAS(_beg, _end)
 Subtracts two times in ticks, returning the result in ticks.
#define TMR_DELTA_IN_NSECS(_beg, _end)   PTS_DELTAS_IN_NSECS(_beg, _end)
 Subtracts two times in tickss, returning the result in nanoseconds.

Typedefs

typedef unsigned int TMR_tick
 The type of an elapsed unit of time.
typedef struct _TMR_usecs_nsecs TMR_usecs_nsecs
 Typedef for struct _TMR_usecs_nsecs.

Functions

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.


Detailed Description

Provides a set of timing macros.

Author:
JJRussell - russell@slac.stanford.edu
   CVS $Id: TMR.h,v 1.2 2011/03/25 21:15:03 saxton Exp $

SYNPOSIS
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. However, TMR_get always returns an unsigned int, independent of the actual resolution.
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 > 4 secs. The normal system clocks should be used instead.

USAGE
    TMR_tick     beg;
    TMR_tick     end;
    TMR_tick elapsed;
  
    beg     = TMR_GET();
    .
    eventToTime ();
    .
    end     = TMR_GET();
    elapsed = end - beg;
  
    printf ("Begin   Time: %8d ticks\n", beg);
    printf ("End     Time: %8d ticks\n", end);
    printf ("Elasped Time: %8d ticks\n", elapsed);
    printf ("Elasped Time: %8d"ticks\n", TMR_TO_NSECS (elapsed);

Define Documentation

#define TMR_DELTA ( _beg,
_end   )     PTS_DELTAS(_beg, _end)

Subtracts two times in ticks, returning the result in ticks.

Parameters:
_beg The beginning time in processor timer ticks
_end The ending time in processor timer ticks
Returns:
The difference is processor timer ticks
For many processor's, this is just a subtraction.two 32 or 64 bit integer. However, on some platforms, the time is returned in a structure and the subtraction is not quite as trivial. If this were C++, one would have overloaded the '-' operator,

#define TMR_DELTA_IN_NSECS ( _beg,
_end   )     PTS_DELTAS_IN_NSECS(_beg, _end)

Subtracts two times in tickss, returning the result in nanoseconds.

Parameters:
_beg The beginning time in processor timer ticks
_end The ending time in processor timer ticks
Returns:
The difference is nanoseconds

#define TMR_TO_NSECS ( _ticks   )     PTS_PTUS_TO_NSECS(_ticks)

Convert a time processor time ticks to nanoseconds.

Parameters:
_ticks The value to convert
Returns:
The converted value

Referenced by TMR_ticks_to_nsecs(), and TMR_ticks_to_usecs_nsecs().


Typedef Documentation

Typedef for struct _TMR_usecs_nsecs.

Usage
This should be used for display purposes only.


Function Documentation

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_TO_NSECS.

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_TO_NSECS, and _TMR_usecs_nsecs::usecs.


Generated on Wed Nov 21 21:23:57 2012 by  doxygen 1.5.8