Next: C++ Throttle On/Off Up: C++ Throttle Setup Previous: C++ JLAB Filter Throttle Setup
int cmlogFilterSLAC::setThrottle(char *ctag, int limit, double deltaTime, <CTYPE> val)where supported <CTYPE> values are:
BYTE -- unsigned 8-bit ints/chars short -- signed 16-bit ints unsigned short -- unsigned 16-bit ints long -- signed 32-bit ints unsigned long -- unsigned 32-bit ints float -- 32-bit floats double -- 64-bit floats char * -- char array (ie. string)
char* ctagA string containing a tag name. In the SLAC CMLOG environment, message fields have tags such as "facility", "verbosity", "severity", etc (see Common/cmlogUtil.h). Message strings that are passed to functions like logMsg() etc. all end up in the field labeled "text", so if you want to throttle something in that field, specify tag "text". See the sample code below.
int limit double deltaTimeThese parameters specify how many messages (limit) we want to allow through in a specified time period (deltaTime seconds). Only "limit" number of messages with matching "tag" and "val" fields will be logged during a given deltaTime period, and a count is maintained of how many messages were dropped. After the period is up, a summary message is output to the log and another "limit" messages are allowed through. "Limit" may equal zero, in which case only summary messages are output. An alternative is to call throttleOn() or throttleOff() to temporarily suspend *all* throttling. An alternative is to use throttleShow() to obtain a numbered list of current throttles, and then calling throttleRemove() with the appropriate index.
<CTYPE> valThis is the actual value to throttle on.
filter -> setThrottle ("text", 1, 10.0, "abc");will subject all of the following messages to potential throttling:
"abc" "myApp: flabcounter overflow (399)" "Danger, Will Robinson! Frabcous snark!"
filter -> setThrottle ("text", 1, 10.0, "");This throttle will only allow 1 message per 10.0 seconds for all messages with a valid "text" tag. The "wildcard" will match for any defined data for that tag of any data type.
CMLOG_SUCCESS CMLOG_ERROR