![]() |
libklvanc
|
Generic code to limit the running of certain code to N times per second. Primary use case is to prevent errors from spamming system logs. User allocates a small context, context contains max latency.__msfr_align Users asks whether its permitted to execute the code block, function determines answer. First occurence is always allowed to execute. More...
#include <stdint.h>
#include <string.h>
#include <sys/time.h>
Go to the source code of this file.
Classes | |
struct | klrestricted_code_path_block_s |
Generic code to limit the running of certain code to N times per second. Primary use case is to prevent errors from spamming system logs. User allocates a small context, context contains max latency.__msfr_align Users asks whether its permitted to execute the code block, function determines answer. First occurence is always allowed to execute.
USAGE during runtime: if (klrestricted_code_path_block_execute(&global_mypathXYZ)) { fprintf(stderr, "I logged a high volume message, but only once per second!\n"); }