aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-script.c
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@kernel.org>2018-08-30 02:32:28 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2018-08-30 14:52:23 -0400
commit6ca9a082b1908ff7f8adedf08166043b83b266f6 (patch)
tree0ce5a8f63ea34ec377ee7d4d9bb0496e9b41778b /tools/perf/builtin-script.c
parentf3ca50e61ff4aebfbefc666be2e064d277ad524c (diff)
perf stat: Pass a 'struct perf_stat_config' argument to global print functions
Add 'struct perf_stat_config' argument to the global print functions, so that these functions can be used out of the 'perf stat' command code. Signed-off-by: Jiri Olsa <jolsa@kernel.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Andi Kleen <andi@firstfloor.org> Cc: David Ahern <dsahern@gmail.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/20180830063252.23729-20-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-script.c')
-rw-r--r--tools/perf/builtin-script.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index ba481d73f910..6176bae177c2 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -1544,7 +1544,8 @@ struct metric_ctx {
1544 FILE *fp; 1544 FILE *fp;
1545}; 1545};
1546 1546
1547static void script_print_metric(void *ctx, const char *color, 1547static void script_print_metric(struct perf_stat_config *config __maybe_unused,
1548 void *ctx, const char *color,
1548 const char *fmt, 1549 const char *fmt,
1549 const char *unit, double val) 1550 const char *unit, double val)
1550{ 1551{
@@ -1562,7 +1563,8 @@ static void script_print_metric(void *ctx, const char *color,
1562 fprintf(mctx->fp, " %s\n", unit); 1563 fprintf(mctx->fp, " %s\n", unit);
1563} 1564}
1564 1565
1565static void script_new_line(void *ctx) 1566static void script_new_line(struct perf_stat_config *config __maybe_unused,
1567 void *ctx)
1566{ 1568{
1567 struct metric_ctx *mctx = ctx; 1569 struct metric_ctx *mctx = ctx;
1568 1570
@@ -1608,7 +1610,7 @@ static void perf_sample__fprint_metric(struct perf_script *script,
1608 evsel_script(evsel)->val = val; 1610 evsel_script(evsel)->val = val;
1609 if (evsel_script(evsel->leader)->gnum == evsel->leader->nr_members) { 1611 if (evsel_script(evsel->leader)->gnum == evsel->leader->nr_members) {
1610 for_each_group_member (ev2, evsel->leader) { 1612 for_each_group_member (ev2, evsel->leader) {
1611 perf_stat__print_shadow_stats(ev2, 1613 perf_stat__print_shadow_stats(&stat_config, ev2,
1612 evsel_script(ev2)->val, 1614 evsel_script(ev2)->val,
1613 sample->cpu, 1615 sample->cpu,
1614 &ctx, 1616 &ctx,