[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: getloadavg test
From: |
Bruno Haible |
Subject: |
Re: getloadavg test |
Date: |
Wed, 16 Feb 2011 12:28:38 +0100 |
User-agent: |
KMail/1.9.9 |
Hi Paul,
A test can be non-silent when there is a hint that it is not working
correctly. For example, if the getloadavg() values are all 0, or if there
is a problem with the scaling. How about this? It's basically what a human
would do when executing the manual test.
2011-02-16 Bruno Haible <address@hidden>
getloadavg test: Add some plausibility checks.
* tests/test-getloadavg.c (check_avg): Print a warning when the value
is improbable.
--- tests/test-getloadavg.c.orig Wed Feb 16 12:24:44 2011
+++ tests/test-getloadavg.c Wed Feb 16 12:24:21 2011
@@ -30,6 +30,14 @@
{
if (printit)
printf ("%d-minute: %f ", minutes, avg);
+ else
+ {
+ /* Plausibility checks. */
+ if (avg < 0.01)
+ printf ("suspiciously low %d-minute average: %f\n", minutes, avg);
+ if (avg > 100)
+ printf ("suspiciously high %d-minute average: %f\n", minutes, avg);
+ }
if (avg < 0 || avg != avg)
exit (minutes);
}
--
In memoriam Mildred Fish-Harnack <http://en.wikipedia.org/wiki/Mildred_Harnack>
Re: getloadavg and errno, Bruno Haible, 2011/02/15
Re: getloadavg on Solaris 2.6, Bruno Haible, 2011/02/17
Re: getloadavg on IRIX, Bruno Haible, 2011/02/17