Re: [PATCH 2/9] perf, tools, stat: Abstract stat metrics printing

Jiri Olsa
2015-09-04T09:00:38Z

On Wed, Sep 02, 2015 at 04:35:47PM -0700, Andi Kleen wrote:

SNIP

> diff --git a/tools/perf/util/stat.h b/tools/perf/util/stat.h
> index 62448c8..bb07e46 100644
> --- a/tools/perf/util/stat.h
> +++ b/tools/perf/util/stat.h
> @@ -67,11 +67,21 @@ void perf_stat_evsel_id_init(struct perf_evsel *evsel);
>
> extern struct stats walltime_nsecs_stats;
>
> +typedef void (*print_metric_t)(void *ctx, const char *color, const char *unit,
> + const char *fmt, double val);
> +
> void perf_stat__reset_shadow_stats(void);
> void perf_stat__update_shadow_stats(struct perf_evsel *counter, u64 *count,
> int cpu);
> -void perf_stat__print_shadow_stats(FILE *out, struct perf_evsel *evsel,
> - double avg, int cpu, enum aggr_mode aggr);
> +struct perf_stat_output_ctx {
> + void *ctx;
> + print_metric_t print_metric;
> + void (*new_line)(void *ctx);

please add typedef for new_line as well

jirka