/*
- * Copyright (c) 2008, 2009, 2010 Nicira Networks.
+ * Copyright (c) 2008, 2009, 2010, 2011 Nicira Networks.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include "coverage.h"
#include "fatal-signal.h"
#include "util.h"
-
#include "vlog.h"
-#define THIS_MODULE VLM_timeval
+
+VLOG_DEFINE_THIS_MODULE(timeval);
/* The clock to use for measuring time intervals. This is CLOCK_MONOTONIC by
* preference, but on systems that don't have a monotonic clock we fall back
*
* It is not necessary to call this function directly, because other time
* functions will call it automatically, but it doesn't hurt. */
-void
+static void
time_init(void)
{
static bool inited;
now = time_msec();
interval = MIN(10000, now - last_wakeup) << 4;
- /* Warn if we took too much time between polls. */
- if (n_samples > 10 && interval > mean_interval * 8) {
+ /* 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) {
struct rusage rusage;
getrusage(RUSAGE_SELF, &rusage);
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
+ /* 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
* than the processing delay that triggered it. */
coverage_log(VLL_INFO, true);
}