timer_stats slimmed down: statistics prereq, labels
Subsystems (2)
RFC PATCH 2/4 timer_stats slimmed down: statistics prereq, labels
This patch allows clients of the statistics infrastructure to be called back when an entry of a statistic is printed and if the client might want to add some kind of label to the output string. A line would look like this then:
<statistic name> <basket> <hits> <label>
Signed-off-by Martin Peschke <[email protected]>
---
include/linux/statistic.h | 5 +++ lib/statistic.c | 68 ++++++++++++++++++++++++++++++++-------------- 2 files changed, 53 insertions(+), 20 deletions(-)
include/linux/statistic.h +5 -0
@@ -55,6 +55,7 @@ struct statistic_info {int flags;#define STATISTIC_FLAGS_NOINCR 0x01/* no incremental data */ #define STATISTIC_FLAGS_NOFLEX 0x02/* type can't be altered by user */ +#define STATISTIC_FLAGS_LABEL 0x04/* client want's to label buckets */ char *defaults; };
@@ -106,6 +107,7 @@ struct statistic {* @info: a struct statistic_info array describing the struct statistic array * @number: number of entries in both arrays * @pull: an optional function called when user reads data from file +* @label: an optional function retrieving a label for each statistics entry * @private: optional data pointer reserved for use by clients * * Exploiters must setup a struct statistic_interface prior to calling
@@ -122,6 +124,9 @@ struct statistic_interface {struct statistic_info *info;int number;int (*pull)(struct statistic_interface *interface); +void (*label)(struct statistic_interface *interface, +int i,s64 value, +struct seq_file *seq);void *private; };
lib/statistic.c +48 -20
129 lines not on this page · raw message