Skip to content

Commit

Permalink
coverage: Rate-limit logging coverage information.
Browse files Browse the repository at this point in the history
I'd always assumed that the exponentially weighted moving average code in
timeval was enough rate-limiting, but I actually encountered a pathological
case some time ago that forced this coverage information to print once a
second or so, which seems too often.

Signed-off-by: Ben Pfaff <[email protected]>
  • Loading branch information
blp committed Apr 26, 2012
1 parent c563de0 commit 275a506
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/coverage.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,14 @@ coverage_log_counter(enum vlog_level level, const struct coverage_counter *c)
void
coverage_log(enum vlog_level level, bool suppress_dups)
{
static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 3);
size_t n_never_hit;
uint32_t hash;
size_t i;

if (!vlog_is_enabled(THIS_MODULE, level)) {
if (suppress_dups
? !vlog_is_enabled(THIS_MODULE, level)
: vlog_should_drop(THIS_MODULE, level, &rl)) {
return;
}

Expand Down

0 comments on commit 275a506

Please sign in to comment.