diff options
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/systat/iostat.c | 4 | ||||
-rw-r--r-- | usr.bin/systat/vmstat.c | 26 | ||||
-rw-r--r-- | usr.bin/vmstat/vmstat.c | 4 |
3 files changed, 17 insertions, 17 deletions
diff --git a/usr.bin/systat/iostat.c b/usr.bin/systat/iostat.c index ba39f3e..a54bb6d 100644 --- a/usr.bin/systat/iostat.c +++ b/usr.bin/systat/iostat.c @@ -148,8 +148,6 @@ fetchiostat() last.dinfo = cur.dinfo; cur.dinfo = tmp_dinfo; - last.busy_time = cur.busy_time; - /* * Here what we want to do is refresh our device stats. * getdevs() returns 1 when the device list has changed. @@ -322,7 +320,7 @@ devstats(row, _col, dn) di = dev_select[dn].position; - busy_seconds = devstat_compute_etime(cur.busy_time, last.busy_time); + busy_seconds = cur.snap_time - last.snap_time; if (devstat_compute_statistics(&cur.dinfo->devices[di], &last.dinfo->devices[di], busy_seconds, diff --git a/usr.bin/systat/vmstat.c b/usr.bin/systat/vmstat.c index 5fc1985..ff7a37b 100644 --- a/usr.bin/systat/vmstat.c +++ b/usr.bin/systat/vmstat.c @@ -798,7 +798,7 @@ getinfo(ls) last.dinfo = cur.dinfo; cur.dinfo = tmp_dinfo; - last.busy_time = cur.busy_time; + last.snap_time = cur.snap_time; switch (devstat_getdevs(NULL, &cur)) { case -1: errx(1, "%s", devstat_errbuf); @@ -852,12 +852,19 @@ dinfo(dn, lc, now, then) di = dev_select[dn].position; - elapsed_time = devstat_compute_etime(now->busy_time, - then ? then->busy_time : now->dinfo->devices[di].dev_creation_time); - - device_busy = devstat_compute_etime(now->dinfo->devices[di].busy_time, - then ? then->dinfo->devices[di].busy_time : - now->dinfo->devices[di].dev_creation_time); + if (then != NULL) { + /* Calculate relative to previous sample */ + elapsed_time = now->snap_time - then->snap_time; + device_busy = devstat_compute_etime( + &now->dinfo->devices[di].busy_time, + &then->dinfo->devices[di].busy_time); + } else { + /* Calculate relative to device creation */ + elapsed_time = now->snap_time - devstat_compute_etime( + &now->dinfo->devices[di].creation_time, NULL); + device_busy = devstat_compute_etime( + &now->dinfo->devices[di].busy_time, NULL); + } if (devstat_compute_statistics(&now->dinfo->devices[di], then ? &then->dinfo->devices[di] : NULL, elapsed_time, @@ -866,11 +873,6 @@ dinfo(dn, lc, now, then) DSM_NONE) != 0) errx(1, "%s", devstat_errbuf); - if ((device_busy == 0) && (transfers_per_second > 5)) - /* the device has been 100% busy, fake it because - * as long as the device is 100% busy the busy_time - * field in the devstat struct is not updated */ - device_busy = elapsed_time; if (device_busy > elapsed_time) /* this normally happens after one or more periods * where the device has been 100% busy, correct it */ diff --git a/usr.bin/vmstat/vmstat.c b/usr.bin/vmstat/vmstat.c index fb99b2c..88c1d21 100644 --- a/usr.bin/vmstat/vmstat.c +++ b/usr.bin/vmstat/vmstat.c @@ -428,7 +428,7 @@ dovmstat(interval, reps) tmp_dinfo = last.dinfo; last.dinfo = cur.dinfo; cur.dinfo = tmp_dinfo; - last.busy_time = cur.busy_time; + last.snap_time = cur.snap_time; /* * Here what we want to do is refresh our device stats. @@ -680,7 +680,7 @@ devstats() last.cp_time[state] = tmp; } - busy_seconds = devstat_compute_etime(cur.busy_time, last.busy_time); + busy_seconds = cur.snap_time - last.snap_time; for (dn = 0; dn < num_devices; dn++) { int di; |