summaryrefslogtreecommitdiff
path: root/tools/perf/util/stat-display.c
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@kernel.org>2022-11-23 21:01:58 +0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2022-11-24 15:37:31 +0300
commitf123b2d84ecec9a3c551e745f43d36bba1d69e1c (patch)
treec5c4956a401e1e41b03a01eb3b438a9786677308 /tools/perf/util/stat-display.c
parenta7ec1dd2d744208ca814ebde8c97f94e041625ef (diff)
downloadlinux-f123b2d84ecec9a3c551e745f43d36bba1d69e1c.tar.xz
perf stat: Remove prefix argument in print_metric_headers()
It always passes a whitespace to the function, thus we can just add it to the function body. Furthermore, it's only used in the normal output mode. Well, actually CSV used it but it doesn't need to since we don't care about the indentation or alignment in the CSV output. Signed-off-by: Namhyung Kim <namhyung@kernel.org> Acked-by: Ian Rogers <irogers@google.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: James Clark <james.clark@arm.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Kan Liang <kan.liang@linux.intel.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com> Link: https://lore.kernel.org/r/20221123180208.2068936-6-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/stat-display.c')
-rw-r--r--tools/perf/util/stat-display.c26
1 files changed, 10 insertions, 16 deletions
diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c
index 744b7a40f59a..deed6ccf072f 100644
--- a/tools/perf/util/stat-display.c
+++ b/tools/perf/util/stat-display.c
@@ -996,10 +996,9 @@ static void print_no_aggr_metric(struct perf_stat_config *config,
}
static void print_metric_headers_std(struct perf_stat_config *config,
- const char *prefix, bool no_indent)
+ bool no_indent)
{
- if (prefix)
- fprintf(config->output, "%s", prefix);
+ fputc(' ', config->output);
if (!no_indent) {
int len = aggr_header_lens[config->aggr_mode];
@@ -1012,11 +1011,8 @@ static void print_metric_headers_std(struct perf_stat_config *config,
}
static void print_metric_headers_csv(struct perf_stat_config *config,
- const char *prefix,
bool no_indent __maybe_unused)
{
- if (prefix)
- fprintf(config->output, "%s", prefix);
if (config->interval)
fputs("time,", config->output);
if (!config->iostat_run)
@@ -1024,7 +1020,6 @@ static void print_metric_headers_csv(struct perf_stat_config *config,
}
static void print_metric_headers_json(struct perf_stat_config *config,
- const char *prefix __maybe_unused,
bool no_indent __maybe_unused)
{
if (config->interval)
@@ -1032,8 +1027,7 @@ static void print_metric_headers_json(struct perf_stat_config *config,
}
static void print_metric_headers(struct perf_stat_config *config,
- struct evlist *evlist,
- const char *prefix, bool no_indent)
+ struct evlist *evlist, bool no_indent)
{
struct evsel *counter;
struct outstate os = {
@@ -1047,11 +1041,11 @@ static void print_metric_headers(struct perf_stat_config *config,
};
if (config->json_output)
- print_metric_headers_json(config, prefix, no_indent);
+ print_metric_headers_json(config, no_indent);
else if (config->csv_output)
- print_metric_headers_csv(config, prefix, no_indent);
+ print_metric_headers_csv(config, no_indent);
else
- print_metric_headers_std(config, prefix, no_indent);
+ print_metric_headers_std(config, no_indent);
if (config->iostat_run)
iostat_print_header_prefix(config);
@@ -1132,7 +1126,7 @@ static void print_header_interval_std(struct perf_stat_config *config,
}
if (config->metric_only)
- print_metric_headers(config, evlist, " ", true);
+ print_metric_headers(config, evlist, true);
else
fprintf(output, " %*s %*s events\n",
COUNTS_LEN, "counts", config->unit_width, "unit");
@@ -1168,7 +1162,7 @@ static void print_header_std(struct perf_stat_config *config,
fprintf(output, ":\n\n");
if (config->metric_only)
- print_metric_headers(config, evlist, " ", false);
+ print_metric_headers(config, evlist, false);
}
static void print_header_csv(struct perf_stat_config *config,
@@ -1178,7 +1172,7 @@ static void print_header_csv(struct perf_stat_config *config,
const char **argv __maybe_unused)
{
if (config->metric_only)
- print_metric_headers(config, evlist, " ", true);
+ print_metric_headers(config, evlist, true);
}
static void print_header_json(struct perf_stat_config *config,
struct target *_target __maybe_unused,
@@ -1187,7 +1181,7 @@ static void print_header_json(struct perf_stat_config *config,
const char **argv __maybe_unused)
{
if (config->metric_only)
- print_metric_headers(config, evlist, " ", true);
+ print_metric_headers(config, evlist, true);
}
static void print_header(struct perf_stat_config *config,