mirror of
https://github.com/openvswitch/ovs
synced 2025-09-01 06:45:17 +00:00
timeval: Rate-limit logging rusage information.
I'd always assumed that the exponentially weighted moving average code here was sufficient rate-limiting, but I actually encountered a pathological case some time ago that forced this rusage information to print once a second or so, which seems too often. Signed-off-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
@@ -463,6 +463,9 @@ log_poll_interval(long long int last_wakeup)
|
||||
/* Warn if we took too much time between polls: at least 50 ms and at least
|
||||
* 8X the mean interval. */
|
||||
if (n_samples > 10 && interval > mean_interval * 8 && interval > 50 * 16) {
|
||||
static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 3);
|
||||
|
||||
if (!VLOG_DROP_WARN(&rl)) {
|
||||
const struct rusage *last_rusage = get_recent_rusage();
|
||||
struct rusage rusage;
|
||||
|
||||
@@ -471,8 +474,10 @@ log_poll_interval(long long int last_wakeup)
|
||||
"is over %u times the weighted mean interval %u ms "
|
||||
"(%u samples)",
|
||||
now - last_wakeup,
|
||||
timeval_diff_msec(&rusage.ru_utime, &last_rusage->ru_utime),
|
||||
timeval_diff_msec(&rusage.ru_stime, &last_rusage->ru_stime),
|
||||
timeval_diff_msec(&rusage.ru_utime,
|
||||
&last_rusage->ru_utime),
|
||||
timeval_diff_msec(&rusage.ru_stime,
|
||||
&last_rusage->ru_stime),
|
||||
interval / mean_interval,
|
||||
(mean_interval + 8) / 16, n_samples);
|
||||
if (rusage.ru_minflt > last_rusage->ru_minflt
|
||||
@@ -493,7 +498,7 @@ log_poll_interval(long long int last_wakeup)
|
||||
rusage.ru_nvcsw - last_rusage->ru_nvcsw,
|
||||
rusage.ru_nivcsw - last_rusage->ru_nivcsw);
|
||||
}
|
||||
|
||||
}
|
||||
/* Care should be taken in the value chosen for logging. Depending
|
||||
* on the configuration, syslog can write changes synchronously,
|
||||
* which can cause the coverage messages to take longer to log
|
||||
|
Reference in New Issue
Block a user