GLAST/LAT > DAQ and FSW > FSW > Doxygen Index > PBS / V2-10-5

Constituent: pbs     Tag: rad750


Interface   Data Structures   File List   Data Fields   Globals  

PTS.h.xx-ppc-gcc File Reference

PPC Implementation of the TMR facility. More...

#include "PBS/PTS.h"

Include dependency graph for PTS.h.xx-ppc-gcc:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Defines

#define PTS_GETS()
 Macro to get the short range of the processor time.

#define PTS_GETX()
 Macro to get the full extended range of the processor time.

#define PTS_PTUS_TO_NSECS(_ptus)   PTS_ptus_to_nsecs (_ptus)
 Converts a short range processor time to nanoseconds.

#define PTS_NSECS_TO_PTUS(_nsecs)   PTS_nsecs_to_ptus (_nsecs)
 Converts a short range nanoseconds to a processor time.

#define PTS_PTUX_TO_NSECX(_ptux)   PTS_ptux_to_nsecx (_ptux)
 Converts a extended range processor time to nanocseconds.

#define PTS_NSECX_TO_PTUX(_nsecx)   PTS_nsecx_to_ptux (_nsecx)
 Converts an extended range nanoseconds to a processor time.

#define PTS_DELTAS(_beg, _end)   ((_end) - (_beg))
 Subtracts two short range processor times.

#define PTS_DELTAS_IN_NSECS(_beg, _end)
 Subtracts two short range processor times and converts the difference to nanoseconds.

#define PTS_DELTAX(_beg, _end)   ((_end) - (_beg))
 Subtracts two extended range processor times.

#define PTS_DELTAX_IN_NSECX(_beg, _end)
 Subtracts two extended range processor times and converts the difference to nanoseconds (64 bit result).


Typedefs

typedef unsigned long long PTS_timex
 The typedef for declaring extended range processor time variables.

typedef unsigned int PTS_times
 The typedef for declaring short range processor time variables.


Detailed Description

PPC Implementation of the TMR facility.

Author:
JJRussell - russell@slac.stanford.edu

   CVS $Id: PTS.h.xx-ppc-gcc,v 1.5 2004/12/07 16:13:07 russell Exp $

This is PPC implementation of the PTS facility. The implementation is based on PPC time register. The implementation also depends on the GCC compiler, since it uses the GCC asm facility to access this register. Because this routine tries to accurately time very short events (>.5usecs) it must be implemented with very low overhead, Therefore, the implementatin is fairly simple minded resulting in a limitation of this not being able to time long events. The definition of long is ~ 2**32*60nsecs = ~257 secs. If you are timing things that long, the normal system clock may be a better choice.


Define Documentation

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

Subtracts two short range processor times.

Parameters:
_beg The beginning time
_end The ending time
Returns:
The difference in processor time units

#define PTS_DELTAS_IN_NSECS _beg,
_end   ) 
 

Value:

Subtracts two short range processor times and converts the difference to nanoseconds.

Parameters:
_beg The beginning time
_end The ending time
Returns:
The difference in nanoseconds (32-bit result)

#define PTS_DELTAX _beg,
_end   )     ((_end) - (_beg))
 

Subtracts two extended range processor times.

Parameters:
_beg The beginning time
_end The ending time
Returns:
The difference in processor time units

#define PTS_DELTAX_IN_NSECX _beg,
_end   ) 
 

Value:

Subtracts two extended range processor times and converts the difference to nanoseconds (64 bit result).

Parameters:
_beg The beginning time
_end The ending time
Returns:
The difference in nanoseconds

 
#define PTS_GETS  ) 
 

Value:

({                                        \
           unsigned int tbl;                      \
           asm volatile ("mftb %0": "=r"(tbl));   \
           tbl;                                   \
        })
Macro to get the short range of the processor time.

PTS_GETS() gets the short range of the processor time. This is is generally a 32-bit value, however, the exact representation is platform dependent. The user should use the typedef PTS_times to declare an short range processor time variable.

This is implemented as a macro because its only value is to act as a low overhead method of timing short duration fragments of code. If one is timing long durations (where long is a platform dependent definition, but generally means greater than one second) PTS_GETX() is more appropriate.

 
#define PTS_GETX  ) 
 

Value:

({                                                          \
           union                                                   \
           {                                                       \
                 struct { unsigned int hi; unsigned int lo; } ui;  \
                 unsigned long long                          ull;  \
           } ll;                                                   \
           unsigned int tbl, tbh, tbh_i;                           \
           asm volatile ("mftbu %0": "=r"(tbh_i));                 \
           while (1)                                               \
           {                                                       \
               asm volatile ("mftb  %0    \n"                      \
                             "mftbu %1    \n"                      \
                             : "=r"(tbl), "=r"(tbh));              \
               if (tbh == tbh_i) break;                            \
               tbh_i = tbh;                                        \
           }                                                       \
           ll.ui.hi = tbh;                                         \
           ll.ui.lo = tbl;                                         \
           ll.ull;} )                                              \
Macro to get the full extended range of the processor time.

PTS_GETX() gets the full extended range of the processor time. This is is generally a 64-bit value, however, the exact representation is platform dependent. The user should use the typedef PTS_timex to declare an extended range processor time variable.

This is implemented as a macro because its only value is to act as a low overhead method of timing short duration fragments of code. See PTS_GETS() for the short version of getting the processor time. If one is timing short code segments (where short is a platform dependent definition, but generally means subsecond), PTS_GETS() is lower overhead. Be aware that PTS_GETX() is just an elapsed timer, so the timing long segments of code also includes any time that may elapse due to interrupt or task switching.

#define PTS_NSECS_TO_PTUS _nsecs   )     PTS_nsecs_to_ptus (_nsecs)
 

Converts a short range nanoseconds to a processor time.

Parameters:
_nsecs The short range time, in nanoseconds, to convert to a processor time.
Returns:
The processor time in ticks (32-bit result)

#define PTS_NSECX_TO_PTUX _nsecx   )     PTS_nsecx_to_ptux (_nsecx)
 

Converts an extended range nanoseconds to a processor time.

Parameters:
_nsecx The extended range time, in nanoseconds, to convert to a processor time
Returns:
The processor time in ticks (64-bit result)

#define PTS_PTUS_TO_NSECS _ptus   )     PTS_ptus_to_nsecs (_ptus)
 

Converts a short range processor time to nanoseconds.

Parameters:
_ptus The short range processor time to convert. This value is generally the result of a call to PTS_GETS().
Returns:
The processor time in nanoseconds (32-bit result)

#define PTS_PTUX_TO_NSECX _ptux   )     PTS_ptux_to_nsecx (_ptux)
 

Converts a extended range processor time to nanocseconds.

Parameters:
_ptux The extended range processor time to convert. This value is generally the result of a call to PTS_GETX().
Returns:
The processor time in nanoseconds (64-bit result).


Generated on Tue Sep 13 21:40:35 2005 by doxygen 1.3.3