summaryrefslogtreecommitdiffstats
path: root/usr.sbin/iostat/iostat.c
diff options
context:
space:
mode:
authortrociny <trociny@FreeBSD.org>2012-12-15 18:21:09 +0000
committertrociny <trociny@FreeBSD.org>2012-12-15 18:21:09 +0000
commitfa6bd7906ae46bac5811a3dd6b67bd1d3ddb908d (patch)
tree75d20203f790fafff6d2bbc3e171e73a5bc0dfab /usr.sbin/iostat/iostat.c
parent7c744361c22d7640b2f1c05924fd05090c957fd5 (diff)
downloadFreeBSD-src-fa6bd7906ae46bac5811a3dd6b67bd1d3ddb908d.zip
FreeBSD-src-fa6bd7906ae46bac5811a3dd6b67bd1d3ddb908d.tar.gz
Change `iostat -Ix` to display total duration of transactions instead
of average duration, and total busy time instead of %. This looks more useful when one runs `iostat -Ix` periodically to collect statistics: e.g. now it is possible to calculate busy % between two runs subtracting total busy times and dividing per time period. Average duration and % busy are still available via `iostat -x`.
Diffstat (limited to 'usr.sbin/iostat/iostat.c')
-rw-r--r--usr.sbin/iostat/iostat.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/usr.sbin/iostat/iostat.c b/usr.sbin/iostat/iostat.c
index 1c32f94..92b98e4 100644
--- a/usr.sbin/iostat/iostat.c
+++ b/usr.sbin/iostat/iostat.c
@@ -731,10 +731,10 @@ devstats(int perf_select, long double etime, int havelast)
u_int64_t total_bytes, total_transfers, total_blocks;
u_int64_t total_bytes_read, total_transfers_read;
u_int64_t total_bytes_write, total_transfers_write;
- long double busy_pct;
+ long double busy_pct, busy_time;
u_int64_t queue_len;
long double total_mb;
- long double blocks_per_second, ms_per_transaction;
+ long double blocks_per_second, ms_per_transaction, total_duration;
int firstline = 1;
char *devname;
@@ -745,14 +745,13 @@ devstats(int perf_select, long double etime, int havelast)
if (Cflag > 0)
printf(" cpu ");
printf("\n");
- if (Iflag == 0)
- printf(
- "device r/s w/s kr/s kw/s qlen svc_t %%b "
- );
- else
- printf(
- "device r/i w/i kr/i kw/i qlen svc_t %%b "
- );
+ if (Iflag == 0) {
+ printf("device r/s w/s kr/s kw/s qlen "
+ "svc_t %%b ");
+ } else {
+ printf("device r/i w/i kr/i"
+ " kw/i qlen tsvc_t/i sb/i ");
+ }
if (Tflag > 0)
printf("tin tout ");
if (Cflag > 0)
@@ -789,6 +788,8 @@ devstats(int perf_select, long double etime, int havelast)
DSM_MS_PER_TRANSACTION, &ms_per_transaction,
DSM_BUSY_PCT, &busy_pct,
DSM_QUEUE_LENGTH, &queue_len,
+ DSM_TOTAL_DURATION, &total_duration,
+ DSM_TOTAL_BUSY_TIME, &busy_time,
DSM_NONE) != 0)
errx(1, "%s", devstat_errbuf);
@@ -827,7 +828,9 @@ devstats(int perf_select, long double etime, int havelast)
queue_len,
ms_per_transaction, busy_pct);
else
- printf("%-8.8s %5.1Lf %5.1Lf %7.1Lf %7.1Lf %4" PRIu64 " %5.1Lf %3.0Lf ",
+ printf("%-8.8s %11.1Lf %11.1Lf "
+ "%12.1Lf %12.1Lf %4" PRIu64
+ " %10.1Lf %9.1Lf ",
devname,
(long double)total_transfers_read,
(long double)total_transfers_write,
@@ -836,7 +839,7 @@ devstats(int perf_select, long double etime, int havelast)
(long double)
total_bytes_write / 1024,
queue_len,
- ms_per_transaction, busy_pct);
+ total_duration, busy_time);
if (firstline) {
/*
* If this is the first device
OpenPOWER on IntegriCloud