gstat shows > 100% busy
Ivan Voras
ivoras at fer.hr
Sat Apr 16 16:02:13 PDT 2005
Poul-Henning Kamp wrote:
> The reason gstat shows >100% busy is that there are some outstanding
> requests. (the 2 in the left hand column).
>
> I tried to make the statistics collection as cheap as possible, and
> as a side effect some of the columns can be somewhat misleading.
Could it be (for reasons of prettyfication) clipped to [0-100] range?
Something like in the attached?
-------------- next part --------------
--- gstat_ori.c Sun Apr 17 00:45:32 2005
+++ gstat.c Sun Apr 17 00:59:44 2005
@@ -51,6 +51,7 @@
static int flag_I = 500000;
static void usage(void);
+static double clip_double(double x, double min, double max);
int
main(int argc, char **argv)
@@ -209,7 +210,7 @@
else
i = 1;
attron(COLOR_PAIR(i));
- printw(" %6.1lf", (double)ld[7]);
+ printw(" %6.1lf", clip_double((double)ld[7], 0, 100));
attroff(COLOR_PAIR(i));
printw("|");
if (gid == NULL) {
@@ -264,3 +265,18 @@
exit(1);
/* NOTREACHED */
}
+
+
+/*
+ * Clip a double value to [min..max]
+ */
+static double
+clip_double(double x, double min, double max)
+{
+ if (x > max)
+ return max;
+ if (x < min)
+ return min;
+ return x;
+}
+
More information about the freebsd-current
mailing list