[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221123180208.2068936-9-namhyung@kernel.org>
Date: Wed, 23 Nov 2022 10:02:01 -0800
From: Namhyung Kim <namhyung@...nel.org>
To: Arnaldo Carvalho de Melo <acme@...nel.org>,
Jiri Olsa <jolsa@...nel.org>
Cc: Ingo Molnar <mingo@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
LKML <linux-kernel@...r.kernel.org>,
Ian Rogers <irogers@...gle.com>,
Adrian Hunter <adrian.hunter@...el.com>,
linux-perf-users@...r.kernel.org,
Kan Liang <kan.liang@...ux.intel.com>,
Zhengjun Xing <zhengjun.xing@...ux.intel.com>,
James Clark <james.clark@....com>,
Athira Jajeev <atrajeev@...ux.vnet.ibm.com>
Subject: [PATCH 08/15] perf stat: Use struct outstate in evlist__print_counters()
This is a preparation for the later cleanup. No functional changes
intended.
Signed-off-by: Namhyung Kim <namhyung@...nel.org>
---
tools/perf/util/stat-display.c | 25 ++++++++++++++-----------
1 file changed, 14 insertions(+), 11 deletions(-)
diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c
index d2894a519d61..70aebf359e16 100644
--- a/tools/perf/util/stat-display.c
+++ b/tools/perf/util/stat-display.c
@@ -1372,13 +1372,16 @@ void evlist__print_counters(struct evlist *evlist, struct perf_stat_config *conf
bool metric_only = config->metric_only;
int interval = config->interval;
struct evsel *counter;
- char buf[64], *prefix = NULL;
+ char buf[64];
+ struct outstate os = {
+ .fh = config->output,
+ };
if (config->iostat_run)
evlist->selected = evlist__first(evlist);
if (interval) {
- prefix = buf;
+ os.prefix = buf;
prepare_interval(config, buf, sizeof(buf), ts);
}
@@ -1390,35 +1393,35 @@ void evlist__print_counters(struct evlist *evlist, struct perf_stat_config *conf
case AGGR_SOCKET:
case AGGR_NODE:
if (config->cgroup_list)
- print_aggr_cgroup(config, evlist, prefix);
+ print_aggr_cgroup(config, evlist, os.prefix);
else
- print_aggr(config, evlist, prefix);
+ print_aggr(config, evlist, os.prefix);
break;
case AGGR_THREAD:
case AGGR_GLOBAL:
if (config->iostat_run) {
- iostat_print_counters(evlist, config, ts, prefix = buf,
+ iostat_print_counters(evlist, config, ts, buf,
print_counter);
} else if (config->cgroup_list) {
- print_cgroup_counter(config, evlist, prefix);
+ print_cgroup_counter(config, evlist, os.prefix);
} else {
- print_metric_begin(config, evlist, prefix,
+ print_metric_begin(config, evlist, os.prefix,
/*aggr_idx=*/0, /*cgrp=*/NULL);
evlist__for_each_entry(evlist, counter) {
- print_counter(config, counter, prefix);
+ print_counter(config, counter, os.prefix);
}
print_metric_end(config);
}
break;
case AGGR_NONE:
if (metric_only)
- print_no_aggr_metric(config, evlist, prefix);
+ print_no_aggr_metric(config, evlist, os.prefix);
else {
evlist__for_each_entry(evlist, counter) {
if (counter->percore)
- print_percore(config, counter, prefix);
+ print_percore(config, counter, os.prefix);
else
- print_counter(config, counter, prefix);
+ print_counter(config, counter, os.prefix);
}
}
break;
--
2.38.1.584.g0f3c55d4c2-goog
Powered by blists - more mailing lists