Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

instrumentation.c File Reference


Detailed Description

Implementation of the functions in instrumentation.h.

Definition in file instrumentation.c.

Include dependency graph for instrumentation.c:

Include dependency graph

Go to the source code of this file.

Defines

#define IP_HISTORY_START_ADD(ip, amount)   ((ip)->ip_History.start + (amount)) % (ip)->ip_History.length
 Add an amount to an existing index into the ip_History.data array of the iPoint structure.

Functions

void iInitPoint (struct iPoint *ip)
 Initialize an instrumentation point and add it to the list of active points.
void iPostFloatData (struct iPoint *ip, double value)
 Post a floating point data value to an instrumentation point.
void iPrintPoint (FILE *file, struct iPoint *ip)
 Print the collected values for an instrumentation point.
void iPrintPoints (FILE *file)
 Print all of the instrumentation points that have had data posted to them using iPrintPoint.
void iPrintPointsAtExit (void)
 An atexit(3) function that calls iPrintPoints with a file from one of the following sources (listed in order of precedence):.

Variables

const char * DEFAULT_INSTRUMENTATION_FILE_NAME
 The default file name format for the instrumentation file.
iInstrumentationData instrumentation_data
 The global data needed by the instrumentation infrastructure.


Define Documentation

#define IP_HISTORY_START_ADD ip,
amount   )     ((ip)->ip_History.start + (amount)) % (ip)->ip_History.length
 

Add an amount to an existing index into the ip_History.data array of the iPoint structure.

In case the addition causes the index to extend beyond the bounds of the array, the result will be wrapped around to the beginning.

Parameters:
ip A pointer to a valid iPoint.
amount The amount to add to the ip_History.start value.
Returns:
The new index.

Definition at line 40 of file instrumentation.c.

Referenced by iPostFloatData(), and iPrintPoint().


Function Documentation

void iInitPoint struct iPoint *  ip  )  [static]
 

Initialize an instrumentation point and add it to the list of active points.

Normally, a point starts out with all fields initialized to zero, unless a history array is provided. We must then perform some additional setup by assigning default values to some fields.

Parameters:
ip The point to initialize.

Todo:
Make thread safe.

Definition at line 61 of file instrumentation.c.

References instrumentation_data, and require.

Referenced by iPostFloatData().

void iPostFloatData struct iPoint *  ip,
double  value
 

Post a floating point data value to an instrumentation point.

Parameters:
ip The instrumentation point to add the given value to.
value The value to add.

Definition at line 86 of file instrumentation.c.

References iInitPoint(), IP_HISTORY_START_ADD, and require.

Here is the call graph for this function:

void iPrintPoint FILE *  file,
struct iPoint *  ip
 

Print the collected values for an instrumentation point.

The summary data printed depends on whether or not a history array has been provided: no history means the summary covers all of the posted data; otherwise the summary covers only the data held in the history.

Parameters:
file The file to print the data to.
ip The instrumentation point to print out.

Definition at line 126 of file instrumentation.c.

References IP_HISTORY_START_ADD, IPF_MASK, and require.

Referenced by iPrintPoints().

void iPrintPoints FILE *  file  ) 
 

Print all of the instrumentation points that have had data posted to them using iPrintPoint.

Parameters:
file The file to print the data to.

Definition at line 231 of file instrumentation.c.

References instrumentation_data, iPrintPoint(), and require.

Referenced by iPrintPointsAtExit().

Here is the call graph for this function:

void iPrintPointsAtExit void   ) 
 

An atexit(3) function that calls iPrintPoints with a file from one of the following sources (listed in order of precedence):.

  • The value of the CB_INSTR_FILE_NAME environment variable, if it is defined. Note: A value of "-" represents stdout.
  • The instrumentation_data.iid_OutputFileName variable, if it is non-NULL. Note: A value of "-" represents stdout.
  • A formatted file name derived from PACKAGE and the current process ID.
All of the files are opened in append mode and the current time is printed out before calling iPrintPoints. When the function finishes it will clear instrumentation_data.iid_FirstPoint so that any future calls to this function will not result in data being printed more than once.

Definition at line 246 of file instrumentation.c.

References DEFAULT_INSTRUMENTATION_FILE_NAME, INSTR_FILE_NAME_ENV, instrumentation_data, and iPrintPoints().

Referenced by main(), and ManagerImpl::ManagerImpl().

Here is the call graph for this function:


Variable Documentation

const char* DEFAULT_INSTRUMENTATION_FILE_NAME [static]
 

Initial value:

    PACKAGE "-instrumentation-%d.txt"
The default file name format for the instrumentation file.

Definition at line 46 of file instrumentation.c.

Referenced by iPrintPointsAtExit().


Generated on Fri Oct 22 07:50:34 2004 for CPU Broker by  doxygen 1.3.9.1