diff options
author | obrien <obrien@FreeBSD.org> | 2013-02-08 16:10:16 +0000 |
---|---|---|
committer | obrien <obrien@FreeBSD.org> | 2013-02-08 16:10:16 +0000 |
commit | 3028e3f8aba938dfd0bf9fda987b8a72140b8027 (patch) | |
tree | b2f038222ff8a70f687652441df00d2b564c8abe /lib/libdevstat | |
parent | 952a6d5a7cd3d3f9007acfa06805262fc04a105f (diff) | |
parent | 1d08d5f677c1dfa810e381073590adbae19cc69f (diff) | |
download | FreeBSD-src-3028e3f8aba938dfd0bf9fda987b8a72140b8027.zip FreeBSD-src-3028e3f8aba938dfd0bf9fda987b8a72140b8027.tar.gz |
Sync with HEAD.
Diffstat (limited to 'lib/libdevstat')
-rw-r--r-- | lib/libdevstat/devstat.3 | 31 | ||||
-rw-r--r-- | lib/libdevstat/devstat.c | 47 | ||||
-rw-r--r-- | lib/libdevstat/devstat.h | 6 |
3 files changed, 75 insertions, 9 deletions
diff --git a/lib/libdevstat/devstat.3 b/lib/libdevstat/devstat.3 index 8d0ce4d..39be6ac 100644 --- a/lib/libdevstat/devstat.3 +++ b/lib/libdevstat/devstat.3 @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 18, 2003 +.Dd December 15, 2012 .Dt DEVSTAT 3 .Os .Sh NAME @@ -526,6 +526,35 @@ the acquisition of .Fa previous and .Fa current . +.It Dv DSM_TOTAL_DURATION +type: +.Vt "long double *" +.Pp +The total duration of transactions, in seconds, between the acquisition of +.Fa previous +and +.Fa current . +.It Dv DSM_TOTAL_DURATION_OTHER +.It Dv DSM_TOTAL_DURATION_READ +.It Dv DSM_TOTAL_DURATION_WRITE +.It Dv DSM_TOTAL_DURATION_FREE +type: +.Vt "long double *" +.Pp +The total duration of transactions of the specified type between +the acquisition of +.Fa previous +and +.Fa current . +.It Dv DSM_TOTAL_BUSY_TIME +type: +.Vt "long double *" +.Pp +Total time the device had one or more transactions outstanding +between the acquisition of +.Fa previous +and +.Fa current . .It Dv DSM_TOTAL_BLOCKS type: .Vt "uint64_t *" diff --git a/lib/libdevstat/devstat.c b/lib/libdevstat/devstat.c index ff0767a..0f313fb 100644 --- a/lib/libdevstat/devstat.c +++ b/lib/libdevstat/devstat.c @@ -133,6 +133,12 @@ struct devstat_args { { DSM_MS_PER_TRANSACTION_FREE, DEVSTAT_ARG_LD }, { DSM_BUSY_PCT, DEVSTAT_ARG_LD }, { DSM_QUEUE_LENGTH, DEVSTAT_ARG_UINT64 }, + { DSM_TOTAL_DURATION, DEVSTAT_ARG_LD }, + { DSM_TOTAL_DURATION_READ, DEVSTAT_ARG_LD }, + { DSM_TOTAL_DURATION_WRITE, DEVSTAT_ARG_LD }, + { DSM_TOTAL_DURATION_FREE, DEVSTAT_ARG_LD }, + { DSM_TOTAL_DURATION_OTHER, DEVSTAT_ARG_LD }, + { DSM_TOTAL_BUSY_TIME, DEVSTAT_ARG_LD }, }; static const char *namelist[] = { @@ -1217,11 +1223,13 @@ devstat_compute_statistics(struct devstat *current, struct devstat *previous, u_int64_t totaltransfers, totaltransfersread, totaltransferswrite; u_int64_t totaltransfersother, totalblocks, totalblocksread; u_int64_t totalblockswrite, totaltransfersfree, totalblocksfree; + long double totalduration, totaldurationread, totaldurationwrite; + long double totaldurationfree, totaldurationother; va_list ap; devstat_metric metric; u_int64_t *destu64; long double *destld; - int retval, i; + int retval; retval = 0; @@ -1263,6 +1271,13 @@ devstat_compute_statistics(struct devstat *current, struct devstat *previous, totalblocksfree /= 512; } + totaldurationread = DELTA_T(duration[DEVSTAT_READ]); + totaldurationwrite = DELTA_T(duration[DEVSTAT_WRITE]); + totaldurationfree = DELTA_T(duration[DEVSTAT_FREE]); + totaldurationother = DELTA_T(duration[DEVSTAT_NO_DATA]); + totalduration = totaldurationread + totaldurationwrite + + totaldurationfree + totaldurationother; + va_start(ap, etime); while ((metric = (devstat_metric)va_arg(ap, devstat_metric)) != 0) { @@ -1484,9 +1499,7 @@ devstat_compute_statistics(struct devstat *current, struct devstat *previous, */ case DSM_MS_PER_TRANSACTION: if (totaltransfers > 0) { - *destld = 0; - for (i = 0; i < DEVSTAT_N_TRANS_FLAGS; i++) - *destld += DELTA_T(duration[i]); + *destld = totalduration; *destld /= totaltransfers; *destld *= 1000; } else @@ -1499,7 +1512,7 @@ devstat_compute_statistics(struct devstat *current, struct devstat *previous, */ case DSM_MS_PER_TRANSACTION_READ: if (totaltransfersread > 0) { - *destld = DELTA_T(duration[DEVSTAT_READ]); + *destld = totaldurationread; *destld /= totaltransfersread; *destld *= 1000; } else @@ -1507,7 +1520,7 @@ devstat_compute_statistics(struct devstat *current, struct devstat *previous, break; case DSM_MS_PER_TRANSACTION_WRITE: if (totaltransferswrite > 0) { - *destld = DELTA_T(duration[DEVSTAT_WRITE]); + *destld = totaldurationwrite; *destld /= totaltransferswrite; *destld *= 1000; } else @@ -1515,7 +1528,7 @@ devstat_compute_statistics(struct devstat *current, struct devstat *previous, break; case DSM_MS_PER_TRANSACTION_FREE: if (totaltransfersfree > 0) { - *destld = DELTA_T(duration[DEVSTAT_FREE]); + *destld = totaldurationfree; *destld /= totaltransfersfree; *destld *= 1000; } else @@ -1523,7 +1536,7 @@ devstat_compute_statistics(struct devstat *current, struct devstat *previous, break; case DSM_MS_PER_TRANSACTION_OTHER: if (totaltransfersother > 0) { - *destld = DELTA_T(duration[DEVSTAT_NO_DATA]); + *destld = totaldurationother; *destld /= totaltransfersother; *destld *= 1000; } else @@ -1541,6 +1554,24 @@ devstat_compute_statistics(struct devstat *current, struct devstat *previous, case DSM_QUEUE_LENGTH: *destu64 = current->start_count - current->end_count; break; + case DSM_TOTAL_DURATION: + *destld = totalduration; + break; + case DSM_TOTAL_DURATION_READ: + *destld = totaldurationread; + break; + case DSM_TOTAL_DURATION_WRITE: + *destld = totaldurationwrite; + break; + case DSM_TOTAL_DURATION_FREE: + *destld = totaldurationfree; + break; + case DSM_TOTAL_DURATION_OTHER: + *destld = totaldurationother; + break; + case DSM_TOTAL_BUSY_TIME: + *destld = DELTA_T(busy_time); + break; /* * XXX: comment out the default block to see if any case's are missing. */ diff --git a/lib/libdevstat/devstat.h b/lib/libdevstat/devstat.h index 7717cb1..9471f93 100644 --- a/lib/libdevstat/devstat.h +++ b/lib/libdevstat/devstat.h @@ -97,6 +97,12 @@ typedef enum { DSM_MS_PER_TRANSACTION_FREE, DSM_BUSY_PCT, DSM_QUEUE_LENGTH, + DSM_TOTAL_DURATION, + DSM_TOTAL_DURATION_READ, + DSM_TOTAL_DURATION_WRITE, + DSM_TOTAL_DURATION_FREE, + DSM_TOTAL_DURATION_OTHER, + DSM_TOTAL_BUSY_TIME, DSM_MAX } devstat_metric; |