3 //=============================================================================
5 * @file Metrics_Cache.h
9 //=============================================================================
12 #ifndef ACE_METRICS_CACHE_H
13 #define ACE_METRICS_CACHE_H
15 #include "ace/Timeprobe.h"
17 #if !defined (ACE_LACKS_PRAGMA_ONCE)
19 #endif /* ACE_LACKS_PRAGMA_ONCE */
21 #if defined (ACE_METRICS_COLLECTION)
23 #if defined (ACE_ENABLE_TIMEPROBES) && defined (ACE_COMPILE_TIMEPROBES)
26 * Call the appropriate 'report_ + NAME + _start' function. The start function makes a time probe measurement.
28 * ACE: The cache is a double-sided space of ACE_Timeprobe objects. For example if there is 10 probes there
29 * will be a two lists of 10 probes all initialized. When a record is made, the appropriate probe is found,
30 * add the measurement is made.
32 * TAO: The cache is still double sided but this time the X argument is a handle_t. The appropriate monitor
33 * map is located in the Metrics_Cache, find the data, and if there is nothing wrong with the data
34 * make a time measurement. The data is actually a ACE_Metrics_Timeprobe (Why not TAO_Metrics_Timeprobe?)
36 * USAGE_LEVEL: ACE+TAO
38 * @param METRICS_PTR - Pointer to a initialized metrics cache
39 * @param NAME - Name of defining function (e.g. ACE: enqueue/dequeue)
40 * @param X - Argument (ACE: u_int, TAO: RtecScheduler::handle_t)
42 # define START_DISPATCH_METRIC(METRICS_PTR,NAME,X) \
43 do { if((METRICS_PTR->metrics_enabled())) { \
44 METRICS_PTR->report_##NAME##_start(X); \
48 * Call the appropriate 'report_ + NAME + _stop' function. The stop function makes a time probe measurement.
50 * ACE & TAO: Same as START_DISPATCH_METRIC
52 * USAGE_LEVEL: ACE+TAO
54 * @param METRICS_PTR - Pointer to a initialized metrics cache
55 * @param NAME - Name of defining function (e.g. ACE: enqueue/dequeue)
56 * @param X - Argument (ACE: u_int, TAO: RtecScheduler::handle_t)
58 # define STOP_DISPATCH_METRIC(METRICS_PTR,NAME,X) \
59 do { if((METRICS_PTR->metrics_enabled())) { \
60 METRICS_PTR->report_##NAME##_stop(X); \
64 * Call the appropriate 'report_ + NAME + _suspend' function. The suspend function makes a time probe measurement.
65 * This marks when the object under observation has been suspended.
67 * USAGE_LEVEL: ACE+TAO
69 * @param METRICS_PTR - Pointer to a initialized metrics cache
70 * @param NAME - Name of defining function (e.g. ACE: enqueue/dequeue)
71 * @param X - Argument (ACE: u_int, TAO: RtecScheduler::handle_t)
73 # define PAUSE_DISPATCH_METRIC(METRICS_PTR,NAME,X) \
74 do { if((METRICS_PTR->metrics_enabled())) { \
75 METRICS_PTR->report_##NAME##_suspend(X); \
79 * Call the appropriate 'report_ + NAME + _resume' function. The suspend function makes a time probe measurement.
80 * This marks when the object under observation that was suspended is not resuming normal execution.
82 * USAGE_LEVEL: ACE+TAO
84 * @param METRICS_PTR - Pointer to a initialized metrics cache
85 * @param NAME - Name of defining function (e.g. ACE: enqueue/dequeue)
86 * @param X - Argument (ACE: u_int, TAO: RtecScheduler::handle_t)
88 # define RESUME_DISPATCH_METRIC(METRICS_PTR,NAME,X) \
89 do { if((METRICS_PTR->metrics_enabled())) { \
90 METRICS_PTR->report_##NAME##_resume(X); \
95 * Mystery macros. I could not find where there were functions like 'report_base_metrics_start ()'. All the
96 * start and stop functions had an argument to find the probe in the cache
98 # define START_METRIC(METRICS_PTR,NAME) \
99 do { if((METRICS_PTR->metrics_enabled())) { \
100 METRICS_PTR->report_##NAME##_start(); \
103 # define STOP_METRIC(METRICS_PTR,NAME) \
104 do { if((METRICS_PTR->metrics_enabled())) { \
105 METRICS_PTR->report_##NAME##_stop(); \
108 #include "ace/Metrics_Cache_T.h"
109 #include "ace/Singleton.h"
111 #if defined (_MSC_VER)
112 // Disable warning of using Microsoft Extension.
113 #pragma warning(disable:4231)
114 #endif /* _MSC_VER */
116 #if defined (_MSC_VER)
117 // Default back the warning of using Microsoft Extension.
118 #pragma warning(default:4231)
119 #endif /* _MSC_VER */
122 #error ACE_Compile_Timeprobes must be defined in order to collect metrics
123 #endif /* ACE_ENABLE_TIMEPROBES & ACE_COMPILE_TIMEPROBES */
127 # define REGISTER_METRICS_PROBE_RETURN(METRICS_PTR,METRICS_REGION,PROBE_NAME,PROBE_TYPE,METRICS_HANDLE)
128 # define REGISTER_METRICS_REPORTING_PROBE_RETURN(METRICS_PTR,METRICS_REGION,PROBE_NAME,PROBE_TYPE,METRICS_LOGGER_REF,METRICS_HANDLE)
129 # define START_DISPATCH_METRIC(METRICS_PTR,NAME,X)
130 # define STOP_DISPATCH_METRIC(METRICS_PTR,NAME,X)
131 # define PAUSE_DISPATCH_METRIC(METRICS_PTR,NAME,X)
132 # define RESUME_DISPATCH_METRIC(METRICS_PTR,NAME,X)
133 # define START_METRIC(METRICS_PTR,NAME)
134 # define STOP_METRIC(METRICS_PTR,NAME)
136 #endif /* ACE_ENABLE_TIMEPROBES && ACE_COMPILE_TIMEPROBES */
138 #endif /* ACE_METRICS_CACHE_H */