From 79c84c6c7d227c4c949bed8060b66da76d7ecc64 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Tue, 1 May 2012 20:06:44 -0700 Subject: [PATCH] vmstat - Remove the busy_time == 0 hack Remove a very old busy_time == 0 hack which assumed that a delta busy time of 0 with transactions present simply meant that a transaction didn't complete within one second and that the device was 100% busy. In fact, disk devices are so fast these days (particularly SSDs) that it is possible for many transactions to complete without causing the busy counter to tick-over. The device is more likely to be less than 1% busy. This fixes the '% busy' display for e.g. 'systat -vm 1' to properly report 0% in these situations. --- usr.bin/systat/vmstat.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/usr.bin/systat/vmstat.c b/usr.bin/systat/vmstat.c index 8a36b9e8ff..2da62f4326 100644 --- a/usr.bin/systat/vmstat.c +++ b/usr.bin/systat/vmstat.c @@ -954,6 +954,13 @@ dinfo(int dn, int lc, struct statinfo *now, struct statinfo *then) NULL, NULL) != 0) errx(1, "%s", devstat_errbuf); +#if 0 + /* + * Remove this hack, it no longer works properly and will + * report 100% busy in situations where the device is able + * to respond to the requests faster than the busy counter's + * granularity. + */ if ((device_busy == 0) && (transfers_per_secondr > 5 || transfers_per_secondw > 5)) { /* the device has been 100% busy, fake it because @@ -961,6 +968,7 @@ dinfo(int dn, int lc, struct statinfo *now, struct statinfo *then) * field in the devstat struct is not updated */ device_busy = elapsed_time; } +#endif if (device_busy > elapsed_time) { /* this normally happens after one or more periods * where the device has been 100% busy, correct it */ -- 2.41.0