readahead statistics slimmed down, statistics prereq
Subsystems (2)
RFC PATCH 1/3 readahead statistics slimmed down, statistics prereq
The statistics infrastruture used to offer two different counter
implementations: one that just counted the number of samples, and another one that summed up all samples. Users were required to chose one, while it is often useful to have both pieces of information. This patches merges them. Output looks like:
<statistic name> <samples> <total>
Signed-off-by Martin Peschke <[email protected]>
---
include/linux/statistic.h | 16 +++------- lib/statistic.c | 72 +++++++++++++++++++++------------------------- 2 files changed, 38 insertions(+), 50 deletions(-)
include/linux/statistic.h +5 -11
@@ -75,8 +75,7 @@ enum statistic_state { };enum statistic_type { -STAT_CNTR_INC , -STAT_CNTR_PROD , +STAT_CNTR ,STAT_UTIL ,STAT_HGRAM_LIN ,STAT_HGRAM_LOG2 ,
@@ -156,8 +155,7 @@ extern void statistic_add_key(struct sta* The declarations are needed to allow optimisation of _statistic_add_as() * at compile time. */ -extern void statistic_add_counter_inc (struct statistic *,s64 ,u64 ); -extern void statistic_add_counter_prod (struct statistic *,s64 ,u64 ); +extern void statistic_add_counter (struct statistic *,s64 ,u64 );extern void statistic_add_util (struct statistic *,s64 ,u64 );extern void statistic_add_histogram_lin (struct statistic *,s64 ,u64 );extern void statistic_add_histogram_log2 (struct statistic *,s64 ,u64 );
@@ -191,11 +189,8 @@ static inline void _statistic_add_as(int {if (stat[i].state ==STATISTIC_STATE_ON ) {switch (type) { -case STAT_CNTR_INC : -statistic_add_counter_inc (&stat[i], value, incr); -break ; -case STAT_CNTR_PROD : -statistic_add_counter_prod (&stat[i], value, incr); +case STAT_CNTR : +statistic_add_counter (&stat[i], value, incr);break ;case STAT_UTIL :statistic_add_util (&stat[i], value, incr);
@@ -269,8 +264,7 @@ static inline void _statistic_add_as_key {if (stat[i].state ==STATISTIC_STATE_ON ) {switch (type) { -case STAT_CNTR_INC : -case STAT_CNTR_PROD : +case STAT_CNTR :case STAT_UTIL :case STAT_HGRAM_LIN :case STAT_HGRAM_LOG2 :
lib/statistic.c +33 -39
113 lines not on this page · raw message