I tried to show the total rate separately, but it becomes messy. Adding
the total rate in the same line is easy, so lets start with this.
Showing both values in the same line may be confusing, so I added
labels:
read: 254 ops, 0.000326 s, 4.78 MiB, 14.31 GiB/s op, 3.80 MiB/s total
---
filters/stats/nbdkit-stats-filter.pod | 10 +++++-----
filters/stats/stats.c | 10 ++++++----
2 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/filters/stats/nbdkit-stats-filter.pod
b/filters/stats/nbdkit-stats-filter.pod
index 0a9f10a..ac8173c 100644
--- a/filters/stats/nbdkit-stats-filter.pod
+++ b/filters/stats/nbdkit-stats-filter.pod
@@ -25,11 +25,11 @@ number of read, write and trim operations involved:
run : \
mkfs ext4 /dev/sda
'
- elapsed time: 1.184586 s
- read: 253 ops, 0.000342 s, 4.77 MiB, 4.03 MiB/s
- write: 78 ops, 0.152594 s, 32.64 MiB, 27.56 MiB/s
- trim: 33 ops, 0.000214 s, 1.00 GiB, 864.44 MiB/s
- flush: 9 ops, 0.000003 s, 0 bytes, 0 bytes/s
+ elapsed time: 1.258933 s
+ read: 254 ops, 0.000326 s, 4.78 MiB, 14.31 GiB/s op, 3.80 MiB/s total
+ write: 78 ops, 0.167061 s, 32.64 MiB, 195.40 MiB/s op, 25.93 MiB/s total
+ trim: 33 ops, 0.000304 s, 1.00 GiB, 3289.47 GiB/s op, 813.39 MiB/s total
+ flush: 9 ops, 0.000002 s, 0 bytes, 0 bytes/s op, 0 bytes/s total
=head1 PARAMETERS
diff --git a/filters/stats/stats.c b/filters/stats/stats.c
index 0914248..fbd6b87 100644
--- a/filters/stats/stats.c
+++ b/filters/stats/stats.c
@@ -112,14 +112,16 @@ print_stat (const stat *st, int64_t usecs)
{
if (st->ops > 0) {
char *size = humansize (st->bytes);
- char *rate = humanrate (st->bytes, usecs);
+ char *op_rate = humanrate (st->bytes, st->usecs);
+ char *total_rate = humanrate (st->bytes, usecs);
- fprintf (fp, "%s: %" PRIu64 " ops, %.6f s, %s, %s/s\n",
+ fprintf (fp, "%s: %" PRIu64 " ops, %.6f s, %s, %s/s op, %s/s
total\n",
st->name, st->ops, st->usecs / 1000000.0, maybe (size),
- maybe (rate));
+ maybe (op_rate), maybe (total_rate));
free (size);
- free (rate);
+ free (op_rate);
+ free (total_rate);
}
}
--
2.21.0