Metrics_Cache.h

Go to the documentation of this file.
00001 /* -*- C++ -*- */
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    Metrics_Cache.h
00006  *
00007  *  Metrics_Cache.h,v 4.5 2004/06/14 13:58:41 jwillemsen Exp
00008  *
00009  *  @author Chris Gill
00010  */
00011 //=============================================================================
00012 
00013 
00014 #ifndef ACE_METRICS_CACHE_H
00015 #define ACE_METRICS_CACHE_H
00016 
00017 #include "ace/Timeprobe.h"
00018 
00019 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00020 # pragma once
00021 #endif /* ACE_LACKS_PRAGMA_ONCE */
00022 
00023 #if defined (ACE_METRICS_COLLECTION)
00024 
00025 #if defined (ACE_ENABLE_TIMEPROBES) && defined (ACE_COMPILE_TIMEPROBES)
00026 
00027 /**
00028  * Call the appropriate 'report_ + NAME + _start' function. The start function makes a time probe measurement.
00029  *
00030  * ACE: The cache is a double-sided space of ACE_Timeprobe objects. For example if there is 10 probes there
00031  * will be a two lists of 10 probes all initialized. When a record is made, the appropriate probe is found,
00032  * add the measurement is made.
00033  *
00034  * TAO: The cache is still double sided but this time the X argument is a handle_t. The appropriate monitor
00035  *      map is located in the Metrics_Cache, find the data, and if there is nothing wrong with the data
00036  *      make a time measurement. The data is actually a ACE_Metrics_Timeprobe (Why not TAO_Metrics_Timeprobe?)
00037  *
00038  * USAGE_LEVEL: ACE+TAO
00039  *
00040  * @param METRICS_PTR - Pointer to a initialized metrics cache
00041  * @param NAME - Name of defining function (e.g. ACE: enqueue/dequeue)
00042  * @param X - Argument (ACE: u_int, TAO: RtecScheduler::handle_t)
00043  */
00044 #  define START_DISPATCH_METRIC(METRICS_PTR,NAME,X) \
00045 do { if((METRICS_PTR->metrics_enabled())) { \
00046 METRICS_PTR->report_##NAME##_start(X); \
00047 } } while (0)
00048 
00049 /**
00050  * Call the appropriate 'report_ + NAME + _stop' function. The stop function makes a time probe measurement.
00051  *
00052  * ACE & TAO: Same as START_DISPATCH_METRIC
00053  *
00054  * USAGE_LEVEL: ACE+TAO
00055  *
00056  * @param METRICS_PTR - Pointer to a initialized metrics cache
00057  * @param NAME - Name of defining function (e.g. ACE: enqueue/dequeue)
00058  * @param X - Argument (ACE: u_int, TAO: RtecScheduler::handle_t)
00059  */
00060 #  define STOP_DISPATCH_METRIC(METRICS_PTR,NAME,X) \
00061 do { if((METRICS_PTR->metrics_enabled())) { \
00062 METRICS_PTR->report_##NAME##_stop(X); \
00063 } } while (0)
00064 
00065 /**
00066  * Call the appropriate 'report_ + NAME + _suspend' function. The suspend function makes a time probe measurement.
00067  * This marks when the object under observation has been suspended.
00068  *
00069  * USAGE_LEVEL: ACE+TAO
00070  *
00071  * @param METRICS_PTR - Pointer to a initialized metrics cache
00072  * @param NAME - Name of defining function (e.g. ACE: enqueue/dequeue)
00073  * @param X - Argument (ACE: u_int, TAO: RtecScheduler::handle_t)
00074  */
00075 #  define PAUSE_DISPATCH_METRIC(METRICS_PTR,NAME,X) \
00076 do { if((METRICS_PTR->metrics_enabled())) { \
00077 METRICS_PTR->report_##NAME##_suspend(X); \
00078 } } while (0)
00079 
00080 /**
00081  * Call the appropriate 'report_ + NAME + _resume' function. The suspend function makes a time probe measurement.
00082  * This marks when the object under observation that was suspended is not resuming normal execution.
00083  *
00084  * USAGE_LEVEL: ACE+TAO
00085  *
00086  * @param METRICS_PTR - Pointer to a initialized metrics cache
00087  * @param NAME - Name of defining function (e.g. ACE: enqueue/dequeue)
00088  * @param X - Argument (ACE: u_int, TAO: RtecScheduler::handle_t)
00089  */
00090 #  define RESUME_DISPATCH_METRIC(METRICS_PTR,NAME,X) \
00091 do { if((METRICS_PTR->metrics_enabled())) { \
00092 METRICS_PTR->report_##NAME##_resume(X); \
00093 } } while (0)
00094 
00095 
00096 /**
00097  * Mystery macros. I could not find where there were functions like 'report_base_metrics_start ()'. All the
00098  * start and stop functions had an argument to find the probe in the cache
00099  */
00100 #  define START_METRIC(METRICS_PTR,NAME) \
00101 do { if((METRICS_PTR->metrics_enabled())) { \
00102 METRICS_PTR->report_##NAME##_start(); \
00103 } } while (0)
00104 
00105 #  define STOP_METRIC(METRICS_PTR,NAME) \
00106 do { if((METRICS_PTR->metrics_enabled())) { \
00107 METRICS_PTR->report_##NAME##_stop(); \
00108 } } while (0)
00109 
00110 #include "ace/Metrics_Cache_T.h"
00111 #include "ace/Singleton.h"
00112 
00113 #if defined (_MSC_VER)
00114 // Disable warning of using Microsoft Extension.
00115 #pragma warning(disable:4231)
00116 #endif /* _MSC_VER */
00117 
00118 #if defined (_MSC_VER)
00119 // Default back the warning of using Microsoft Extension.
00120 #pragma warning(default:4231)
00121 #endif /* _MSC_VER */
00122 
00123 #else
00124 #error ACE_Compile_Timeprobes must be defined in order to collect metrics
00125 #endif /* ACE_ENABLE_TIMEPROBES & ACE_COMPILE_TIMEPROBES */
00126 
00127 #else
00128 
00129 #  define REGISTER_METRICS_PROBE_RETURN(METRICS_PTR,METRICS_REGION,PROBE_NAME,PROBE_TYPE,METRICS_HANDLE)
00130 #  define REGISTER_METRICS_REPORTING_PROBE_RETURN(METRICS_PTR,METRICS_REGION,PROBE_NAME,PROBE_TYPE,METRICS_LOGGER_REF,METRICS_HANDLE)
00131 #  define START_DISPATCH_METRIC(METRICS_PTR,NAME,X)
00132 #  define STOP_DISPATCH_METRIC(METRICS_PTR,NAME,X)
00133 #  define PAUSE_DISPATCH_METRIC(METRICS_PTR,NAME,X)
00134 #  define RESUME_DISPATCH_METRIC(METRICS_PTR,NAME,X)
00135 #  define START_METRIC(METRICS_PTR,NAME)
00136 #  define STOP_METRIC(METRICS_PTR,NAME)
00137 
00138 #endif /* ACE_ENABLE_TIMEPROBES && ACE_COMPILE_TIMEPROBES */
00139 
00140 #endif /* ACE_METRICS_CACHE_H */

Generated on Thu Nov 9 09:41:56 2006 for ACE by doxygen 1.3.6