/usr/include/opencascade/OSD_PerfMeter.h is in libopencascade-foundation-dev 6.5.0.dfsg-2build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | #ifndef _OSD_PERFMETER_H
#define _OSD_PERFMETER_H
/*
Macros for convenient and fast usage of meters.
Define PERF_ENABLE_METERS to make them available.
*/
#ifdef PERF_ENABLE_METERS
/* PERF_START_METER
Forces meter MeterName to begin to count by remembering
the current data of timer.
Creates new meter if there is no such meter
*/
#define PERF_START_METER(_m_name) { \
static int __iMeter = -1; \
if (__iMeter >= 0) perf_start_imeter (__iMeter); \
else __iMeter = perf_start_meter (_m_name); \
}
/* PERF_STOP_METER
Forces meter MeterName to stop and cumulate the time elapsed
since the start
*/
#define PERF_STOP_METER(_m_name) { \
static int __iMeter = -1; \
if (__iMeter >= 0) perf_stop_imeter (__iMeter); \
else __iMeter = perf_stop_meter (_m_name); \
}
/* PERF_TICK_METER
Increments the counter of meter MeterName without changing
its state with respect to measurement of time.
Creates new meter if there is no such meter.
It is useful to count the number of enters to a part of code
without wasting a time to measure CPU time.
*/
#define PERF_TICK_METER(_m_name) { \
static int __iMeter = -1; \
if (__iMeter >= 0) perf_tick_imeter (__iMeter); \
else __iMeter = perf_tick_meter (_m_name); \
}
/* PERF_CLOSE_METER
Prints out and resets the given meter
*/
#define PERF_CLOSE_METER(_m_name) perf_close_meter (_m_name);
/* PERF_PRINT_ALL
Prints all existing meters which have been entered at least once
and resets them
*/
#define PERF_PRINT_ALL { \
perf_print_all_meters(); \
}
#else
#define PERF_TICK_METER(_m_name)
#define PERF_START_METER(_m_name)
#define PERF_STOP_METER(_m_name)
#define PERF_CLOSE_METER(_m_name)
#define PERF_PRINT_ALL
#endif
#ifndef Standard_EXPORT
#ifdef WNT
#define Standard_EXPORT __declspec( dllexport )
#else
#define Standard_EXPORT extern
#endif
#endif
#ifdef __cplusplus
extern "C" {
#endif
Standard_EXPORT int perf_init_meter (const char * const MeterName);
/* Creates new counter (if it is absent) identified by
MeterName and resets its cumulative value
Returns : iMeter if OK, -1 if alloc problem
*/
Standard_EXPORT int perf_start_meter (const char * const MeterName);
/* Forces meter MeterName to begin to count by remembering
the current data of timer.
Creates new meter if there is no such meter
Returns : iMeter if OK, -1 if no such meter and cannot create a new one
*/
Standard_EXPORT int perf_start_imeter (const int iMeter);
/* Forces meter with number iMeter to begin count by remembering
the current data of timer.
Returns : iMeter if OK, -1 if no such meter
*/
Standard_EXPORT int perf_stop_meter (const char * const MeterName);
/* Forces meter MeterName to stop and cumulate the time elapsed since the start
Returns : iMeter if OK, -1 if no such meter or it is has not been started
*/
Standard_EXPORT int perf_stop_imeter (const int iMeter);
/* Forces meter with number iMeter to stop and cumulate the time
elapsed since the start.
Returns : iMeter if OK, -1 if no such meter or it is has not been started
*/
Standard_EXPORT int perf_tick_meter (const char * const MeterName);
/* Increments the counter of meter MeterName without changing
its state with respect to measurement of time.
Creates new meter if there is no such meter
Returns : iMeter if OK, -1 if no such meter and cannot create a new one
*/
Standard_EXPORT int perf_tick_imeter (const int iMeter);
/* Increments the counter of meter iMeter without changing
its state with respect to measurement of time.
Returns : iMeter if OK, -1 if no such meter
*/
Standard_EXPORT int perf_get_meter (const char * const MeterName,
int * nb_enter,
double * seconds);
/* Tells the time cumulated by meter MeterName and the number
of enters to this meter
Output : *nb_enter, *seconds if the pointers != NULL
Returns : iMeter if OK, -1 if no such meter
*/
Standard_EXPORT void perf_close_meter (const char * const MeterName);
/* Prints on stdout the cumulated time and the number of enters
for the specified meter
*/
Standard_EXPORT void perf_close_imeter (const int iMeter);
/* Prints on stdout the cumulated time and the number of enters
for the specified meter
*/
Standard_EXPORT void perf_print_all_meters (void);
/* Prints on stdout the cumulated time and the number of
enters for each alive meter which have the number of enters > 0.
Resets all meters
*/
Standard_EXPORT void perf_destroy_all_meters (void);
/* Deletes all meters and frees memory
*/
extern void perf_print_and_destroy (void);
/* ATTENTION !!!
This func calls both perf_print_all_meters() and perf_destroy_all_meters()
and is called automatically at the end of a program
via system call atexit()
*/
#ifdef __cplusplus
}
#endif
#endif
|