|
#define | BALL_LOGTHROTTLE_STREAM_CONST_IMP(SEVERITY, MAX_SIMULTANEOUS_MESSAGES, NANOSECONDS_PER_MESSAGE) |
|
#define | BALL_LOGTHROTTLE_STREAM_IMP(SEVERITY, MAX_SIMULTANEOUS_MESSAGES, NANOSECONDS_PER_MESSAGE) |
|
#define | BALL_LOGTHROTTLEVA_CONST_IMP(SEVERITY, MAX_SIMULTANEOUS_MESSAGES, NANOSECONDS_PER_MESSAGE, ...) |
|
#define | BALL_LOGTHROTTLE_STREAM(SEVERITY, MAX_SIMULTANEOUS_MESSAGES, NANOSECONDS_PER_MESSAGE) |
|
#define | BALL_LOGTHROTTLE_TRACE( MAX_SIMULTANEOUS_MESSAGES, NANOSECONDS_PER_MESSAGE) |
|
#define | BALL_LOGTHROTTLE_DEBUG( MAX_SIMULTANEOUS_MESSAGES, NANOSECONDS_PER_MESSAGE) |
|
#define | BALL_LOGTHROTTLE_INFO( MAX_SIMULTANEOUS_MESSAGES, NANOSECONDS_PER_MESSAGE) |
|
#define | BALL_LOGTHROTTLE_WARN( MAX_SIMULTANEOUS_MESSAGES, NANOSECONDS_PER_MESSAGE) |
|
#define | BALL_LOGTHROTTLE_ERROR( MAX_SIMULTANEOUS_MESSAGES, NANOSECONDS_PER_MESSAGE) |
|
#define | BALL_LOGTHROTTLE_FATAL( MAX_SIMULTANEOUS_MESSAGES, NANOSECONDS_PER_MESSAGE) |
|
#define | BALL_LOGTHROTTLE_BLOCK(SEVERITY, MAX_SIMULTANEOUS_MESSAGES, NANOSECONDS_PER_MESSAGE) |
|
#define | BALL_LOGTHROTTLE_TRACE_BLOCK( MAX_SIMULTANEOUS_MESSAGES, NANOSECONDS_PER_MESSAGE) |
|
#define | BALL_LOGTHROTTLE_DEBUG_BLOCK( MAX_SIMULTANEOUS_MESSAGES, NANOSECONDS_PER_MESSAGE) |
|
#define | BALL_LOGTHROTTLE_INFO_BLOCK( MAX_SIMULTANEOUS_MESSAGES, NANOSECONDS_PER_MESSAGE) |
|
#define | BALL_LOGTHROTTLE_WARN_BLOCK( MAX_SIMULTANEOUS_MESSAGES, NANOSECONDS_PER_MESSAGE) |
|
#define | BALL_LOGTHROTTLE_ERROR_BLOCK( MAX_SIMULTANEOUS_MESSAGES, NANOSECONDS_PER_MESSAGE) |
|
#define | BALL_LOGTHROTTLE_FATAL_BLOCK( MAX_SIMULTANEOUS_MESSAGES, NANOSECONDS_PER_MESSAGE) |
|
#define | BALL_LOGTHROTTLEVA(SEVERITY, MAX_SIMULTANEOUS_MESSAGES, NANOSECONDS_PER_MESSAGE, ...) |
|
#define | BALL_LOGTHROTTLEVA_TRACE(MAX_SIMULTANEOUS_MESSAGES, NANOSECONDS_PER_MESSAGE, ...) |
|
#define | BALL_LOGTHROTTLEVA_DEBUG(MAX_SIMULTANEOUS_MESSAGES, NANOSECONDS_PER_MESSAGE, ...) |
|
#define | BALL_LOGTHROTTLEVA_INFO(MAX_SIMULTANEOUS_MESSAGES, NANOSECONDS_PER_MESSAGE, ...) |
|
#define | BALL_LOGTHROTTLEVA_WARN(MAX_SIMULTANEOUS_MESSAGES, NANOSECONDS_PER_MESSAGE, ...) |
|
#define | BALL_LOGTHROTTLEVA_ERROR(MAX_SIMULTANEOUS_MESSAGES, NANOSECONDS_PER_MESSAGE, ...) |
|
#define | BALL_LOGTHROTTLEVA_FATAL(MAX_SIMULTANEOUS_MESSAGES, NANOSECONDS_PER_MESSAGE, ...) |
|
Outline
Purpose
Provide throttling equivalents of some of the ball_log
macros.
Macros
- BALL_LOGTHROTTLE_TRACE(MAX_SIMULTANEOUS_MSGS, NANOSEC_PER_MESSAGE)
- BALL_LOGTHROTTLE_DEBUG(MAX_SIMULTANEOUS_MSGS, NANOSEC_PER_MESSAGE)
- BALL_LOGTHROTTLE_INFO(MAX_SIMULTANEOUS_MSGS, NANOSEC_PER_MESSAGE)
- BALL_LOGTHROTTLE_WARN(MAX_SIMULTANEOUS_MSGS, NANOSEC_PER_MESSAGE)
- BALL_LOGTHROTTLE_ERROR(MAX_SIMULTANEOUS_MSGS, NANOSEC_PER_MESSAGE)
- BALL_LOGTHROTTLE_FATAL(MAX_SIMULTANEOUS_MSGS, NANOSEC_PER_MESSAGE)
BALL_LOGTHROTTLE_STREAM(MAX_SIMULTANEOUS_MSGS, NANOSEC_PER_MESSAGE)
BALL_LOGTHROTTLE_TRACE_BLOCK(MAX_SIMULTANEOUS_MSGS, NANOSEC_PER_MESSAGE) BALL_LOGTHROTTLE_DEBUG_BLOCK(MAX_SIMULTANEOUS_MSGS, NANOSEC_PER_MESSAGE) BALL_LOGTHROTTLE_INFO_BLOCK(MAX_SIMULTANEOUS_MSGS, NANOSEC_PER_MESSAGE) BALL_LOGTHROTTLE_WARN_BLOCK(MAX_SIMULTANEOUS_MSGS, NANOSEC_PER_MESSAGE) BALL_LOGTHROTTLE_ERROR_BLOCK(MAX_SIMULTANEOUS_MSGS, NANOSEC_PER_MESSAGE) BALL_LOGTHROTTLE_FATAL_BLOCK(MAX_SIMULTANEOUS_MSGS, NANOSEC_PER_MESSAGE) BALL_LOGTHROTTLE_BLOCK(MAX_SIMULTANEOUS_MSGS, NANOSEC_PER_MESSAGE)
BALL_LOGTHROTTLEVA_TRACE(MAX_SIMULTANEOUS_MSGS, NANOSEC_PER_MESSAGE, ...) BALL_LOGTHROTTLEVA_DEBUG(MAX_SIMULTANEOUS_MSGS, NANOSEC_PER_MESSAGE, ...) BALL_LOGTHROTTLEVA_INFO(MAX_SIMULTANEOUS_MSGS, NANOSEC_PER_MESSAGE, ...) BALL_LOGTHROTTLEVA_WARN(MAX_SIMULTANEOUS_MSGS, NANOSEC_PER_MESSAGE, ...) BALL_LOGTHROTTLEVA_ERROR(MAX_SIMULTANEOUS_MSGS, NANOSEC_PER_MESSAGE, ...) BALL_LOGTHROTTLEVA_FATAL(MAX_SIMULTANEOUS_MSGS, NANOSEC_PER_MESSAGE, ...) BALL_LOGTHROTTLEVA(SEV, MAX_SIMULTANEOUS_MSGS, NANOSEC_PER_MESSAGE, ...)
- See also
- ball_log, bdlmt_throttle
Description
This component provides numerous macros for performing logging where the number of messages logged is "throttled", meaning that the number of messages that will be logged within a given time interval is limited. The macros in this component are all analogous to corresponding macros in ball_log
. For example, the throttling version of BALL_LOG_INFO
is BALL_LOGTHROTTLE_INFO
, and the throttling version of BALL_LOGVA
is BALL_LOGTHROTTLEVA
.
Each log message has a SEVERITY
associated with it (see ball_severity for the definitions of the six standard severities). Those macros that don't contain a SEVERITY
in their name are passed an integral severity value in the range [0 .. 255]
, with suggested values defined in ball::Severity
, as their first argument. The next two arguments, MAX_SIMULTANEOUS_MESSAGES
and NANOSECONDS_PER_MESSAGE
, are described immediately below.
Each invocation of any of the macros provided by this component instantiates its own bdlmt::Throttle
object to effect the throttling behavior. Note that each throttle object is statically declared, so it is shared by all threads.
Throttling Parameters
Clients supply the throttling macros with configuration values for MAX_SIMULTANEOUS_MESSAGESS
, and NANOSECONDS_PER_MESSAGE
. The macros keep track of the number of logged messages, and over time throttles the average number of messages permitted to a rate of 1 / NANOSEC_PER_MESSAGE
(messages-per-nanosecond). So, for example, to limit the average rate of messages permitted to 10 messages per second (10 actions / one billion nanoseconds), the value for NANOSECONDS_PER_MESSAGE
would be 100,000,000 (which is one billion / 10).
As client code publishes a log message from a macro, the macro accumulates a time debt for each message, which dissipates over time. The maximum value for this time debt is given by MAX_SIMULTANEOUS_MESSAGES * NANOSECONDS_PER_MESSAGE
. The MAX_SIMULTANEOUS_MESSAGES
configuration parameter thereby limits the maximum number of messages that can be simultaneously published.
MAX_SIMULTANEOUS_MESSAGES
: configures (an approximation of) the maximum number of messages that can be simultaneously logged.
NANOSECONDS_PER_MESSAGE
: configures (an approximation of) the minimum period between messages (and, by extension, the maximum rate).
So, for example:
#define BALL_LOGTHROTTLE_WARN( MAX_SIMULTANEOUS_MESSAGES, NANOSECONDS_PER_MESSAGE)
Definition ball_logthrottle.h:505
static const bsls::Types::Int64 k_NANOSECONDS_PER_SECOND
Definition bdlt_timeunitratio.h:217
long long Int64
Definition bsls_types.h:132
Notice that NANOSECONDS_PER_MESSAGE
controls an approximation for the average rate of messages to be published, and MAX_SIMULTANEOUS_MESSAGES
controls an approximation for the size of bursts of messages to be published.
Note that this component is built on top of bdlmt_throttle , and mirrors its behavior.
Throttling Concepts
The behavior implemented by this component is known as a "leaky-bucket" algorithm: permitted actions place water in the bucket, the passage of time drains water from the bucket, and the bucket has a maximum capacity. Actions are permitted when there is enough empty room in the bucket that the water placed won't overflow it. A leaky bucket is an efficiently implementable approximation for allowing a certain number of actions over a window of time.
Thread Safety
All macros defined in this component are thread-safe, and can be invoked concurrently by multiple threads.
Macro Reference
The following constraints pertain to all of the macros defined in this component.
MAX_SIMULTANEOUS_MESSAGES
and NANOSECONDS_PER_MESSAGE
must be compile-time constants, and may not contain any floating-point subexpressions.
MAX_SIMULTANEOUS_MESSAGES
, NANOSECONDS_PER_MESSAGE
, and SEVERITY
are of types int
, bsls::Types::Int64
, and int
, respectively.
- The behavior is undefined unless
SEVERITY
is in the range [0 .. 255]
, 0 <= MAX_SIMULTANEOUS_MESSAGES
, 0 <= NANOSECONDS_PER_MESSAGE
, 0 < MAX_SIMULTANEOUS_MESSAGES || 0 < NANOSECONDS_PER_MESSAGE
, and MAX_SIMULTANEOUS_MESSAGES * NANOSECONDS_PER_MESSAGE <= LLONG_MAX
.
Each BALL_LOGTHROTTLE_*
is analogous to the corresponding BALL_LOG_*
macro, except that they take two additional throttle-related arguments, MAX_SIMULTANEOUS_MESSAGES
and NANOSECONDS_PER_MESSAGE
, described above.
Stream-Based Throttling Macros
The following macros mirror the corresponding BALL_LOG_<SEVERITY>
macros:
BALL_LOGTHROTTLE_<SEVERITY>(MAX_SIMULTANEOUS_MESSAGES,
NANOSECONDS_PER_MESSAGE) << X << Y ... ;
Throttle logging with the specified `MAX_SIMULTANEOUS_MESSAGES` and
`NANOSECONDS_PER_MESSAGE` as described in {Throttling Parameters}, where
`X, Y, ...` represents any sequence of values for which `operator<<` is
defined. If the throttle permits a message to be logged, the resulting
formatted message is logged with the severity indicated by the name of
BALL_LOGTHROTTLE_STREAM(SEVERITY,
MAX_SIMULTANEOUS_MESSAGES,
NANOSECONDS_PER_MESSAGE) << X << Y ... ;
Throttle logging with the specified `MAX_SIMULTANEOUS_MESSAGES` and
`NANOSECONDS_PER_MESSAGE` as described in {Throttling Parameters}, where
`X, Y, ...` represents any sequence of values for which `operator<<` is
defined. If the throttle permits a message to be logged, the resulting
formatted message is logged with the specified `SEVERITY`.
#define BALL_LOGTHROTTLE_ERROR( MAX_SIMULTANEOUS_MESSAGES, NANOSECONDS_PER_MESSAGE)
Definition ball_logthrottle.h:512
@ e_ERROR
Definition ball_severity.h:170
BLOCK-Style Throttling Macros
The following macros mirror the corresponding BALL_LOG_*_BLOCK
macros:
BALL_LOGTHROTTLE_<SEVERITY>_BLOCK(MAX_SIMULTANEOUS_MESSAGES,
NANOSECONDS_PER_MESSAGE) <block>
Throttle logging with the specified `MAX_SIMULTANEOUS_MESSAGES` and
`NANOSECONDS_PER_MESSAGE` as described in {Throttling Parameters}, where
any sequence of values for which `operator<<` is defined may be
If the throttle permits a message to be logged, the resulting formatted
message is logged with the severity indicated by the name of the macro
BALL_LOGTHROTTLE_BLOCK(SEVERITY,
MAX_SIMULTANEOUS_MESSAGES,
NANOSECONDS_PER_MESSAGE) <block>
Throttle logging with the specified `MAX_SIMULTANEOUS_MESSAGES` and
`NANOSECONDS_PER_MESSAGE` as described in {Throttling Parameters}, where
any sequence of values for which `operator<<` is defined may be
If the throttle permits a message to be logged, the resulting formatted
message is logged with the specified `SEVERITY`.
#define BALL_LOG_OUTPUT_STREAM
Definition ball_log.h:1035
#define BALL_LOGTHROTTLE_WARN_BLOCK( MAX_SIMULTANEOUS_MESSAGES, NANOSECONDS_PER_MESSAGE)
Definition ball_logthrottle.h:555
@ e_WARN
Definition ball_severity.h:171
printf-Style Throttling Macros
The following macros mirror the corresponding BALL_LOGVA_*
macros:
BALL_LOGTHROTTLEVA_<SEVERITY>(MAX_SIMULTANEOUS_MESSAGE,
NANOSECONDS_PER_MESSAGE,
MSG,
...);
Throttle logging with the specified `MAX_SIMULTANEOUS_MESSAGES` and
`NANOSECONDS_PER_MESSAGE` as described in {Throttling Parameters}. If
the throttle permits a message to be logged, format the specified `...`
optional arguments, if any, according to the `printf`-style format
specification in the specified `MSG` (assumed to be of type convertible
to `const char *`), and log the resulting formatted message with the
severity indicated by the name of the macro (e.g.,
The behavior is undefined unless the number and types of the optional
arguments are compatible with the format specification in `MSG`. Note
that each use of these macros must be terminated by a `;`.
BALL_LOGTHROTTLEVA(SEVERITY,
MAX_SIMULTANEOUS_MESSAGES,
NANOSECONDS_PER_MESSAGE,
MSG,
...);
Throttle logging with the specified `MAX_SIMULTANEOUS_MESSAGES` and
`NANOSECONDS_PER_MESSAGE` as described in {Throttling Parameters}. If
the throttle permits a message to be logged, format the specified `...`
optional arguments, if any, according to the `printf`-style format
specification in the specified `MSG` (assumed to be of type convertible
to `const char *`), and log the resulting formatted message with the
specified `SEVERITY`. The behavior is undefined unless the number and
types of the optional arguments are compatible with the format
specification in `MSG`. Note that each use of this macro must be
terminated by a `;`.
#define BALL_LOGTHROTTLEVA_INFO(MAX_SIMULTANEOUS_MESSAGES, NANOSECONDS_PER_MESSAGE, ...)
Definition ball_logthrottle.h:620
@ e_INFO
Definition ball_severity.h:172
Usage
This section illustrates the intended use of this component.
Example 1: C++ Stream-Style Throttling Macro Usage
Suppose a computer is reading double
values from a radio receiver, ten per second, which represent readings of radiation detected by a Geiger counter on a spacecraft, and is transmitting them to a ground control at Jet Propulsion Laboratories in California.
The readings are returned by the double yield()
manipulator of a RadiationMeterReceiver
object (the implementation of which is omitted). The yield
method blocks until it obtains a reading to return. If called in a tight loop, yield
returns ten readings per second.
Readings range from 0 to 100.
- Readings above 10 but not greater than 30 are a concern, but are not very serious. We will report those with an
e_TRACE
severity, and at most one per hour (i.e., messages will be throttled).
- Readings above 30 but not greater than 60 are more of a worry. We will report those with an
e_DEBUG
severity, and at most five per hour.
- Readings above 60 but not greater than 90 are very serious. They will be reported with an
e_INFO
severity, and at most twenty per hour.
- Readings above 90 are potentially catastrophic, and will be reported with an
e_WARN
severity, with no limit on the number of readings reported (i.e., no throttling).
We are to write a daemon process, which will loop gathering readings. A reading of an impossible value of -1.0 will indicate termination.
First we define a set of useful constants:
enum {
k_NUM_INFO = 20,
k_NUM_DEBUG = 5,
k_NUM_TRACE = 1
};
const Int64 k_NS_PER_HOUR =
BloombergLP::bdlt::TimeUnitRatio::k_NANOSECONDS_PER_HOUR;
const Int64 k_NS_PER_INFO = k_NS_PER_HOUR / k_NUM_INFO;
const Int64 k_NS_PER_DEBUG = k_NS_PER_HOUR / k_NUM_DEBUG;
const Int64 k_NS_PER_TRACE = k_NS_PER_HOUR / k_NUM_TRACE;
Then we implement the radiation monitor using the log-throttle macros to throttle the number of log records being published:
void radiationMonitorStreamDaemon()
{
RadiationMeterReceiver receiver;
double reading;
while (-1.0 != (reading = receiver.yield())) {
if (90 < reading) {
}
else if (60 < reading) {
"Radiation reading of " << reading;
}
else if (30 < reading) {
"Radiation reading of " << reading;
}
else if (10 < reading) {
"Radiation reading of " << reading;
}
}
}
#define BALL_LOG_DEBUG
Definition ball_log.h:1225
#define BALL_LOG_SET_CATEGORY(CATEGORY)
Definition ball_log.h:1041
#define BALL_LOG_WARN
Definition ball_log.h:1233
#define BALL_LOGTHROTTLE_INFO( MAX_SIMULTANEOUS_MESSAGES, NANOSECONDS_PER_MESSAGE)
Definition ball_logthrottle.h:498
#define BALL_LOGTHROTTLE_TRACE( MAX_SIMULTANEOUS_MESSAGES, NANOSECONDS_PER_MESSAGE)
Definition ball_logthrottle.h:484
#define BALL_LOGTHROTTLE_DEBUG( MAX_SIMULTANEOUS_MESSAGES, NANOSECONDS_PER_MESSAGE)
Definition ball_logthrottle.h:491
radiationMonitorPrintfDaemon
produces output like:
24APR2018_16:36:22.791 61260 139907579877152 DEBUG ball_logthrottle.t.cpp
460 RADIATION.MONITOR Start gathering data.
24APR2018_16:36:23.094 61260 139907579877152 TRACE ball_logthrottle.t.cpp
488 RADIATION.MONITOR Radiation reading of 12.3
24APR2018_16:36:23.396 61260 139907579877152 DEBUG ball_logthrottle.t.cpp
481 RADIATION.MONITOR Radiation reading of 33.1
24APR2018_16:36:23.597 61260 139907579877152 DEBUG ball_logthrottle.t.cpp
481 RADIATION.MONITOR Radiation reading of 53.7
24APR2018_16:36:23.901 61260 139907579877152 DEBUG ball_logthrottle.t.cpp
481 RADIATION.MONITOR Radiation reading of 46.1
24APR2018_16:36:24.102 61260 139907579877152 INFO ball_logthrottle.t.cpp
474 RADIATION.MONITOR Radiation reading of 67.4
◆ BALL_LOGTHROTTLE_BLOCK
#define BALL_LOGTHROTTLE_BLOCK |
( |
|
SEVERITY, |
|
|
|
MAX_SIMULTANEOUS_MESSAGES, |
|
|
|
NANOSECONDS_PER_MESSAGE |
|
) |
| |
Value:
(MAX_SIMULTANEOUS_MESSAGES), \
(NANOSECONDS_PER_MESSAGE))
#define BALL_LOGTHROTTLE_STREAM_IMP(SEVERITY, MAX_SIMULTANEOUS_MESSAGES, NANOSECONDS_PER_MESSAGE)
Definition ball_logthrottle.h:421
◆ BALL_LOGTHROTTLE_DEBUG
#define BALL_LOGTHROTTLE_DEBUG |
( |
|
MAX_SIMULTANEOUS_MESSAGES, |
|
|
|
NANOSECONDS_PER_MESSAGE |
|
) |
| |
Value:
(MAX_SIMULTANEOUS_MESSAGES), \
(NANOSECONDS_PER_MESSAGE)) \
#define BALL_LOGTHROTTLE_STREAM_CONST_IMP(SEVERITY, MAX_SIMULTANEOUS_MESSAGES, NANOSECONDS_PER_MESSAGE)
Definition ball_logthrottle.h:399
◆ BALL_LOGTHROTTLE_DEBUG_BLOCK
#define BALL_LOGTHROTTLE_DEBUG_BLOCK |
( |
|
MAX_SIMULTANEOUS_MESSAGES, |
|
|
|
NANOSECONDS_PER_MESSAGE |
|
) |
| |
Value:
(MAX_SIMULTANEOUS_MESSAGES), \
(NANOSECONDS_PER_MESSAGE))
◆ BALL_LOGTHROTTLE_ERROR
#define BALL_LOGTHROTTLE_ERROR |
( |
|
MAX_SIMULTANEOUS_MESSAGES, |
|
|
|
NANOSECONDS_PER_MESSAGE |
|
) |
| |
Value:
(MAX_SIMULTANEOUS_MESSAGES), \
(NANOSECONDS_PER_MESSAGE)) \
◆ BALL_LOGTHROTTLE_ERROR_BLOCK
#define BALL_LOGTHROTTLE_ERROR_BLOCK |
( |
|
MAX_SIMULTANEOUS_MESSAGES, |
|
|
|
NANOSECONDS_PER_MESSAGE |
|
) |
| |
Value:
(MAX_SIMULTANEOUS_MESSAGES), \
(NANOSECONDS_PER_MESSAGE))
◆ BALL_LOGTHROTTLE_FATAL
#define BALL_LOGTHROTTLE_FATAL |
( |
|
MAX_SIMULTANEOUS_MESSAGES, |
|
|
|
NANOSECONDS_PER_MESSAGE |
|
) |
| |
Value:
(MAX_SIMULTANEOUS_MESSAGES), \
(NANOSECONDS_PER_MESSAGE)) \
◆ BALL_LOGTHROTTLE_FATAL_BLOCK
#define BALL_LOGTHROTTLE_FATAL_BLOCK |
( |
|
MAX_SIMULTANEOUS_MESSAGES, |
|
|
|
NANOSECONDS_PER_MESSAGE |
|
) |
| |
Value:
(MAX_SIMULTANEOUS_MESSAGES), \
(NANOSECONDS_PER_MESSAGE))
◆ BALL_LOGTHROTTLE_INFO
#define BALL_LOGTHROTTLE_INFO |
( |
|
MAX_SIMULTANEOUS_MESSAGES, |
|
|
|
NANOSECONDS_PER_MESSAGE |
|
) |
| |
Value:
(MAX_SIMULTANEOUS_MESSAGES), \
(NANOSECONDS_PER_MESSAGE)) \
◆ BALL_LOGTHROTTLE_INFO_BLOCK
#define BALL_LOGTHROTTLE_INFO_BLOCK |
( |
|
MAX_SIMULTANEOUS_MESSAGES, |
|
|
|
NANOSECONDS_PER_MESSAGE |
|
) |
| |
Value:
(MAX_SIMULTANEOUS_MESSAGES), \
(NANOSECONDS_PER_MESSAGE))
◆ BALL_LOGTHROTTLE_STREAM
#define BALL_LOGTHROTTLE_STREAM |
( |
|
SEVERITY, |
|
|
|
MAX_SIMULTANEOUS_MESSAGES, |
|
|
|
NANOSECONDS_PER_MESSAGE |
|
) |
| |
Value:
(MAX_SIMULTANEOUS_MESSAGES), \
(NANOSECONDS_PER_MESSAGE)) \
◆ BALL_LOGTHROTTLE_STREAM_CONST_IMP
#define BALL_LOGTHROTTLE_STREAM_CONST_IMP |
( |
|
SEVERITY, |
|
|
|
MAX_SIMULTANEOUS_MESSAGES, |
|
|
|
NANOSECONDS_PER_MESSAGE |
|
) |
| |
Value:for (const BloombergLP::ball::CategoryHolder *ball_logthrottle_cAtEgOrYhOlDeR \
= BloombergLP::ball::Log::categoryHolderIfEnabled<(SEVERITY)>( \
ball_log_getCategoryHolder(BALL_LOG_CATEGORYHOLDER)); \
ball_logthrottle_cAtEgOrYhOlDeR; \
ball_logthrottle_cAtEgOrYhOlDeR = 0) \
for (static BloombergLP::bdlmt::Throttle ball_logthrottle_tHrOtTlE = \
(NANOSECONDS_PER_MESSAGE)); \
ball_logthrottle_cAtEgOrYhOlDeR \
&& ball_logthrottle_tHrOtTlE.requestPermission(); \
) \
for (BloombergLP::ball::Log_Stream ball_log_lOg_StReAm( \
ball_logthrottle_cAtEgOrYhOlDeR->category(), \
__FILE__, \
__LINE__, \
(SEVERITY)); \
ball_logthrottle_cAtEgOrYhOlDeR; \
ball_logthrottle_cAtEgOrYhOlDeR = 0)
#define BDLMT_THROTTLE_INIT(maxSimultaneousActions, nanosecondsPerAction)
Definition bdlmt_throttle.h:620
◆ BALL_LOGTHROTTLE_STREAM_IMP
#define BALL_LOGTHROTTLE_STREAM_IMP |
( |
|
SEVERITY, |
|
|
|
MAX_SIMULTANEOUS_MESSAGES, |
|
|
|
NANOSECONDS_PER_MESSAGE |
|
) |
| |
Value:for (const BloombergLP::ball::CategoryHolder *ball_logthrottle_cAtEgOrYhOlDeR \
= ball_log_getCategoryHolder(BALL_LOG_CATEGORYHOLDER); \
ball_logthrottle_cAtEgOrYhOlDeR \
&& ball_logthrottle_cAtEgOrYhOlDeR->threshold() >= (SEVERITY) \
&& BloombergLP::ball::Log::isCategoryEnabled( \
ball_logthrottle_cAtEgOrYhOlDeR, \
(SEVERITY)); \
ball_logthrottle_cAtEgOrYhOlDeR = 0) \
for (static BloombergLP::bdlmt::Throttle ball_logthrottle_tHrOtTlE = \
(NANOSECONDS_PER_MESSAGE)); \
ball_logthrottle_cAtEgOrYhOlDeR \
&& ball_logthrottle_tHrOtTlE.requestPermission(); \
) \
for (BloombergLP::ball::Log_Stream ball_log_lOg_StReAm( \
ball_logthrottle_cAtEgOrYhOlDeR->category(), \
__FILE__, \
__LINE__, \
(SEVERITY)); \
ball_logthrottle_cAtEgOrYhOlDeR; \
ball_logthrottle_cAtEgOrYhOlDeR = 0)
◆ BALL_LOGTHROTTLE_TRACE
#define BALL_LOGTHROTTLE_TRACE |
( |
|
MAX_SIMULTANEOUS_MESSAGES, |
|
|
|
NANOSECONDS_PER_MESSAGE |
|
) |
| |
Value:
(MAX_SIMULTANEOUS_MESSAGES), \
(NANOSECONDS_PER_MESSAGE)) \
◆ BALL_LOGTHROTTLE_TRACE_BLOCK
#define BALL_LOGTHROTTLE_TRACE_BLOCK |
( |
|
MAX_SIMULTANEOUS_MESSAGES, |
|
|
|
NANOSECONDS_PER_MESSAGE |
|
) |
| |
Value:
(MAX_SIMULTANEOUS_MESSAGES), \
(NANOSECONDS_PER_MESSAGE))
◆ BALL_LOGTHROTTLE_WARN
#define BALL_LOGTHROTTLE_WARN |
( |
|
MAX_SIMULTANEOUS_MESSAGES, |
|
|
|
NANOSECONDS_PER_MESSAGE |
|
) |
| |
Value:
(MAX_SIMULTANEOUS_MESSAGES), \
(NANOSECONDS_PER_MESSAGE)) \
◆ BALL_LOGTHROTTLE_WARN_BLOCK
#define BALL_LOGTHROTTLE_WARN_BLOCK |
( |
|
MAX_SIMULTANEOUS_MESSAGES, |
|
|
|
NANOSECONDS_PER_MESSAGE |
|
) |
| |
Value:
(MAX_SIMULTANEOUS_MESSAGES), \
(NANOSECONDS_PER_MESSAGE))
◆ BALL_LOGTHROTTLEVA
#define BALL_LOGTHROTTLEVA |
( |
|
SEVERITY, |
|
|
|
MAX_SIMULTANEOUS_MESSAGES, |
|
|
|
NANOSECONDS_PER_MESSAGE, |
|
|
|
... |
|
) |
| |
Value:do { \
static BloombergLP::bdlmt::Throttle ball_logthrottle_tHrOtTlE = \
BDLMT_THROTTLE_INIT((MAX_SIMULTANEOUS_MESSAGES), \
(NANOSECONDS_PER_MESSAGE)); \
const BloombergLP::ball::CategoryHolder *ball_logthrottle_cAtEgOrYhOlDeR \
= ball_log_getCategoryHolder(BALL_LOG_CATEGORYHOLDER); \
if (ball_logthrottle_cAtEgOrYhOlDeR->threshold() >= (SEVERITY) \
&& BloombergLP::ball::Log::isCategoryEnabled( \
ball_logthrottle_cAtEgOrYhOlDeR, \
(SEVERITY)) \
&& ball_logthrottle_tHrOtTlE.requestPermission()) { \
BloombergLP::ball::Log_Formatter ball_logthrottle_fOrMaTtEr( \
ball_logthrottle_cAtEgOrYhOlDeR->category(), \
__FILE__, \
__LINE__, \
(SEVERITY)); \
BloombergLP::ball::Log::format( \
ball_logthrottle_fOrMaTtEr.messageBuffer(), \
ball_logthrottle_fOrMaTtEr.messageBufferLen(), \
__VA_ARGS__); \
} \
} while(0)
◆ BALL_LOGTHROTTLEVA_CONST_IMP
#define BALL_LOGTHROTTLEVA_CONST_IMP |
( |
|
SEVERITY, |
|
|
|
MAX_SIMULTANEOUS_MESSAGES, |
|
|
|
NANOSECONDS_PER_MESSAGE, |
|
|
|
... |
|
) |
| |
Value:do { \
static BloombergLP::bdlmt::Throttle ball_logthrottle_tHrOtTlE = \
BDLMT_THROTTLE_INIT((MAX_SIMULTANEOUS_MESSAGES), \
(NANOSECONDS_PER_MESSAGE)); \
const BloombergLP::ball::CategoryHolder \
*ball_logthrottle_cAtEgOrYhOlDeR \
= BloombergLP::ball::Log::categoryHolderIfEnabled<(SEVERITY)>( \
ball_log_getCategoryHolder(BALL_LOG_CATEGORYHOLDER)); \
if (ball_logthrottle_cAtEgOrYhOlDeR && \
ball_logthrottle_tHrOtTlE.requestPermission()) { \
BloombergLP::ball::Log_Formatter ball_logthrottle_fOrMaTtEr( \
ball_logthrottle_cAtEgOrYhOlDeR->category(), \
__FILE__, \
__LINE__, \
(SEVERITY)); \
BloombergLP::ball::Log::format( \
ball_logthrottle_fOrMaTtEr.messageBuffer(), \
ball_logthrottle_fOrMaTtEr.messageBufferLen(), \
__VA_ARGS__); \
} \
} while(0)
◆ BALL_LOGTHROTTLEVA_DEBUG
#define BALL_LOGTHROTTLEVA_DEBUG |
( |
|
MAX_SIMULTANEOUS_MESSAGES, |
|
|
|
NANOSECONDS_PER_MESSAGE, |
|
|
|
... |
|
) |
| |
Value:
(MAX_SIMULTANEOUS_MESSAGES), \
(NANOSECONDS_PER_MESSAGE), \
__VA_ARGS__)
#define BALL_LOGTHROTTLEVA_CONST_IMP(SEVERITY, MAX_SIMULTANEOUS_MESSAGES, NANOSECONDS_PER_MESSAGE, ...)
Definition ball_logthrottle.h:446
◆ BALL_LOGTHROTTLEVA_ERROR
#define BALL_LOGTHROTTLEVA_ERROR |
( |
|
MAX_SIMULTANEOUS_MESSAGES, |
|
|
|
NANOSECONDS_PER_MESSAGE, |
|
|
|
... |
|
) |
| |
Value:
(MAX_SIMULTANEOUS_MESSAGES), \
(NANOSECONDS_PER_MESSAGE), \
__VA_ARGS__)
◆ BALL_LOGTHROTTLEVA_FATAL
#define BALL_LOGTHROTTLEVA_FATAL |
( |
|
MAX_SIMULTANEOUS_MESSAGES, |
|
|
|
NANOSECONDS_PER_MESSAGE, |
|
|
|
... |
|
) |
| |
Value:
(MAX_SIMULTANEOUS_MESSAGES), \
(NANOSECONDS_PER_MESSAGE), \
__VA_ARGS__)
◆ BALL_LOGTHROTTLEVA_INFO
#define BALL_LOGTHROTTLEVA_INFO |
( |
|
MAX_SIMULTANEOUS_MESSAGES, |
|
|
|
NANOSECONDS_PER_MESSAGE, |
|
|
|
... |
|
) |
| |
Value:
(MAX_SIMULTANEOUS_MESSAGES), \
(NANOSECONDS_PER_MESSAGE), \
__VA_ARGS__)
◆ BALL_LOGTHROTTLEVA_TRACE
#define BALL_LOGTHROTTLEVA_TRACE |
( |
|
MAX_SIMULTANEOUS_MESSAGES, |
|
|
|
NANOSECONDS_PER_MESSAGE, |
|
|
|
... |
|
) |
| |
Value:
(MAX_SIMULTANEOUS_MESSAGES), \
(NANOSECONDS_PER_MESSAGE), \
__VA_ARGS__)
◆ BALL_LOGTHROTTLEVA_WARN
#define BALL_LOGTHROTTLEVA_WARN |
( |
|
MAX_SIMULTANEOUS_MESSAGES, |
|
|
|
NANOSECONDS_PER_MESSAGE, |
|
|
|
... |
|
) |
| |
Value:
(MAX_SIMULTANEOUS_MESSAGES), \
(NANOSECONDS_PER_MESSAGE), \
__VA_ARGS__)