GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> EFC / V4-5-0 > ggfc / rhel6-64


Interface   Data Structures   File List   Data Fields   Globals  

EDM.h File Reference

Event Diagnostic Message services, interface + macros. More...


Defines

#define EDM_PRINTF(_args)
 Macro to call EDM_printf.
#define EDM_XPRINTF(_stuff)
 Macro to call EDM_xprintf.
#define EDM_DEBUGPRINTF(_stuff)
 Macro to call EDM_debugPrintf ().
#define EDM_INFOPRINTF(_stuff)
 Macro to call EDM_infoPrintf ().
#define EDM_WARNINGPRINTF(_stuff)
 Macro to call EDM_warningPrintf ().
#define EDM_ERRORPRINTF(_stuff)
 Macro to call EDM_errorPrintf ().
#define EDM_FATALPRINTF(_stuff)
 Macro to call EDM_FatalPrintf ().
#define EDM_CODE(_code)
 Macro to drop C statements that are only used if and only if the Event Diagnostic Message (EDM) facility is active.

Typedefs

typedef enum _EDM_level EDM_level
 Typedef for enum _EDM_level.

Enumerations

enum  _EDM_level {
  EDM_K_DEBUG = 2,
  EDM_K_INFO = 3,
  EDM_K_WARNING = 4,
  EDM_K_ERROR = 5,
  EDM_K_FATAL = 6
}
 This sets the verbosity level. More...


Detailed Description

Event Diagnostic Message services, interface + macros.

Author:
JJRussell - russell@slac.stanford.edu

    CVS $Id: EDM.h,v 1.2 2005/11/22 02:32:06 russell Exp $

The facility allows one to embed code into a source program that will be used if and only if the Event Diagnostic Message services are active. Mainly this is used to drop printf style statements in the program.
There are two levels of control.
  1. Is this facility used at all
  2. The level of verbosity.

The preprocessor symbol EDM_USE controls whether this service is used at all. Typically in production code it would not be used.
If this facility is used, the enumeration EDM_level controls the level of verbosity. While there is little outward difference (what the user sees when he runs the program) between setting the EDM_level very high and not using this facility at all, from a code generation point of view there is an enormous difference. When this facility is active, a lot of extra code supporting this facility is compiled into the code. Not only is there the overhead of checking the message level, just the fact that the code for this facility is there will greatly compromise the compiler's optimization. For example, many leaf routines (routines that do not call another function) will be transformed into non-leaf routines. Typically non-leaf routines must incur a much large preamble and postamble overhead to save more registers.

Define Documentation

#define EDM_CODE ( _code   ) 

Macro to drop C statements that are only used if and only if the Event Diagnostic Message (EDM) facility is active.

Parameters:
_code The contents of this argument are just dropped if the Event Diagnostic Message (EDM) facility is active.
This macro just drops _statements as is into the source code if and only if the EDM facility is active. If the EDM facility is inactive, this statement is a NOP.
Example
Here is an exmple of it usage
      EDM_CODE (int error_cnt = 0);
      .
      .
      ntracks = ntracks + 1;
      EDM_CODE((if (ntracks > MAX_TRACKS)
                {
                      error_cnt++;
                }
               ))

Note that jacketing parenthesis are a good idea, again to fool the preprocessor into thinking there is only 1 argument.

Referenced by prjAcd_Top(), prjAcd_XM(), prjAcd_XMS(), prjAcd_XP(), prjAcd_XPS(), prjAcd_YM(), prjAcd_YMS(), prjAcd_YP(), prjAcd_YPS(), and TFC_skirtProject().

#define EDM_DEBUGPRINTF ( _stuff   ) 

Macro to call EDM_debugPrintf ().

Returns:
The value of the resulting printf. If the result is 0, except in very pathology situations, it means the routine was not called because the print level was above EDM_K_DEBUG.
Parameters:
_stuff The print level followed by the printf arguments. Note that all these arguments must must be jacketed in surrounding parenthesis so that the collection of of arguments appears as one argument to the preprocessor.
This is a variation of the EDM_xprintf with the print level set to EDM_K_DEBUG.

      EDM_DEBUGPRINTF ((GblMsgLevel,
                       "Starting track finding for event #: %8x\n", enum));

If EDM_USE is not defined, this macro is a NOP.

Referenced by evaluateTkr(), evaluateZbottom(), nominateTowers(), prjAcd_XMS(), prjAcd_XPS(), prjAcd_YMS(), prjAcd_YPS(), projectXYMtoAcd(), projectXYPtoAcd(), projectXYStoAcd(), projectXYtoAcdTop(), and TFC_skirtProject().

#define EDM_ERRORPRINTF ( _stuff   ) 

Macro to call EDM_errorPrintf ().

Returns:
The value of the resulting printf. If the result is 0, except in very pathology situations, it means the routine was not called because the print level was above EDM_K_ERROR.
Parameters:
_stuff The print level followed by the printf arguments. Note that all these arguments must must be jacketed in surrounding parenthesis so that the collection of of arguments appears as one argument to the preprocessor.
This is a variation of the EDM_xprintf with the print level set to EDM_K_ERROR.

      EDM_ERRORPRINTF ((GblMsgLevel,
                       "Starting track finding for event #: %8x\n", enum));

If EDM_USE is not defined, this macro is a NOP.

#define EDM_FATALPRINTF ( _stuff   ) 

Macro to call EDM_FatalPrintf ().

Returns:
The value of the resulting printf. If the result is 0, except in very pathology situations, it means the routine was not called because the print level was above EDM_K_FATAL.
Parameters:
_stuff The print level followed by the printf arguments. Note that all these arguments must must be jacketed in surrounding parenthesis so that the collection of of arguments appears as one argument to the preprocessor.
This is a variation of the EDM_xprintf with the print level set to EDM_K_FATAL.

      EDM_FATALPRINTF ((GblMsgLevel,
                       "Starting track finding for event #: %8x\n", enum));

If EDM_USE is not defined, this macro is a NOP.

#define EDM_INFOPRINTF ( _stuff   ) 

Macro to call EDM_infoPrintf ().

Returns:
The value of the resulting printf. If the result is 0, except in very pathology situations, it means the routine was not called because the print level was above EDM_K_INFO.
Parameters:
_stuff The print level followed by the printf arguments. Note that all these arguments must must be jacketed in surrounding parenthesis so that the collection of of arguments appears as one argument to the preprocessor.
This is a variation of the EDM_xprintf with the print level set to EDM_K_INFO.

      EDM_INFOPRINTF ((GblMsgLevel,
                      "Starting track finding for event #: %8x\n", enum));

If EDM_USE is not defined, this macro is a NOP.

Referenced by evaluateAcd(), tkrComplete(), and tkrFilter().

#define EDM_PRINTF ( _args   ) 

Macro to call EDM_printf.

Returns:
The value of the resulting printf. If the result is 0, except in very pathology situations, it means the routine was not called because the message _level inhibited the printing.
Parameters:
_args The printf arguments. Note that if there is more than one argument, they must must be jacketed in surrounding parenthesis so that the collection of arguments appears as one argument to the preprocessor.

#define EDM_WARNINGPRINTF ( _stuff   ) 

Macro to call EDM_warningPrintf ().

Returns:
The value of the resulting printf. If the result is 0, except in very pathology situations, it means the routine was not called because the print level was above EDM_K_WARNING.
Parameters:
_stuff The print level followed by the printf arguments. Note that all these arguments must must be jacketed in surrounding parenthesis so that the collection of of arguments appears as one argument to the preprocessor.
This is a variation of the EDM_xprintf with the print level set to EDM_K_WARNING.

      EDM_WARNINGPRINTF ((GblMsgLevel,
                         "Starting track finding for event #: %8x\n", enum));

If EDM_USE is not defined, this macro is a NOP.

#define EDM_XPRINTF ( _stuff   ) 

Macro to call EDM_xprintf.

Returns:
The value of the resulting printf. If the result is 0, except in very pathology situations, it means the routine was not called because the message level is below the print level
Parameters:
_stuff The message level and the print level followed by the printf arguments. Note that all these arguments must must be jacketed in surrounding parenthesis so that the collection of arguments appears as one argument to the preprocessor.
This is the workhorse macro. A typical example is

      EDM_XPRINTF ((EDM_K_INFO, GblMsgLevel,
                    "Starting track finding for event #: %8x\n", enum));

The first 2 arguments, EDM_K_INFO and GblMsgLevel represent

  1. message_level The message level to print
  2. print_level The threshold for this message. Only if message_level is greater than or equal to this value will the message be printed.

The remaining two arguments represent the printf format statement and its arguments.

If EDM_USE is not defined, this macro is a NOP.


Typedef Documentation

Typedef for enum _EDM_level.

The verbosity level is pattern after the offline definitions. It uses a descending scale (seems backwards to me, the least output I would have defined as 0, with increasing verbosity at higher numbers, oh well, there must have been a good reason.


Enumeration Type Documentation

enum _EDM_level

This sets the verbosity level.

Enumerator:
EDM_K_DEBUG  Debug, lots of output
EDM_K_INFO  Information, one time setup information
EDM_K_WARNING  Warning, weird but not totally unexpected
EDM_K_ERROR  Error, internal inconsistency
EDM_K_FATAL  Fatal, bad, bad things have happened


Generated on Wed Jan 4 14:16:39 2012 by  doxygen 1.5.8