From: Martin Peschke Statistics might be compounds of several results, or buckets (see histogram). For any mode of data aggregation, we use one line per bucket in the output format - with the exception of a "utilisation indicator", which squeezes a handful of numbers into a single line (number of samples, minimim, average, maximum, variance). This patch splits this compound up into separate and appropriately named output lines, ridding us of a nasty exception, and improving readability. Signed-off-by: Martin Peschke Signed-off-by: Andrew Morton --- Documentation/statistics.txt | 22 +++++++++++++++++----- lib/statistic.c | 14 +++++++++++--- 2 files changed, 28 insertions(+), 8 deletions(-) diff -puN Documentation/statistics.txt~statistics-infrastructure-adapt-output-format-of-utilisation-indicator Documentation/statistics.txt --- a/Documentation/statistics.txt~statistics-infrastructure-adapt-output-format-of-utilisation-indicator +++ a/Documentation/statistics.txt @@ -199,7 +199,11 @@ has been implemented: size_write 0x14000 12 | ... | size_write 0x9000 1 / - queue_used_depth 970 1 18.122 32 > num min avg max for a queue + queue_used_depth samples 970 \ + queue_used_depth minimum 1 | + queue_used_depth average 18.122 > utilisation of a queue + queue_used_depth maximum 32 | + queue_used_depth variance 53.324 / Such output can grow as needed in debugfs files. It is human-readable and could be parsed and postprocessed by simple scripts that are aware of what the @@ -543,18 +547,26 @@ this: foo 0x1000 4 foo 0x2000 1 foo 0x5000 2 - bar 961 1 42.000 128 + bar samples 961 + bar minimum 1 + bar average 42.000 + bar maximum 128 + bar variance 149.254 Output formats of different statistic types Statistic Type Output Format Number of Lines - counter_inc 1 + counter_inc 1 - counter_prod 1 + counter_prod 1 - utilisation 1 + utilisation "samples" 5 + "minimum" + "average" + "maximum" + "variance" sparse <= entries ... diff -puN lib/statistic.c~statistics-infrastructure-adapt-output-format-of-utilisation-indicator lib/statistic.c --- a/lib/statistic.c~statistics-infrastructure-adapt-output-format-of-utilisation-indicator +++ a/lib/statistic.c @@ -984,14 +984,22 @@ static int statistic_fdata_util(struct s signed long long min = num ? util->min : 0, max = num ? util->max : 0; - seg = sgrb_seg_find(&fpriv->read_seg_lh, 128); + seg = sgrb_seg_find(&fpriv->read_seg_lh, 512); if (unlikely(!seg)) return -ENOMEM; statistic_div(&mean_w, &mean_d, acc, num, 3); statistic_div(&var_w, &var_d, sqr - mean_w * mean_w, num, 3); seg->offset += sprintf(seg->address + seg->offset, - "%s %Lu %Ld %Ld.%03Ld %Ld %Ld.%03Ld\n", name, - num, min, mean_w, mean_d, max, var_w, var_d); + "%s samples %Lu\n" + "%s minimum %Ld\n" + "%s average %Ld.%03Ld\n" + "%s maximum %Ld\n" + "%s variance %Ld.%03Ld\n", + name, num, + name, min, + name, mean_w, mean_d, + name, max, + name, var_w, var_d); return 0; } _