]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
perf stat: Remove empty new_line_metric function
authorJames Clark <james.clark@linaro.org>
Tue, 12 Nov 2024 16:00:43 +0000 (16:00 +0000)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 26 Dec 2024 15:33:29 +0000 (12:33 -0300)
Despite the name new_line_metric doesn't make a new line, it actually
does nothing. Change it to NULL to avoid confusion.

Signed-off-by: James Clark <james.clark@linaro.org>
Tested-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Tim Chen <tim.c.chen@linux.intel.com>
Cc: Yicong Yang <yangyicong@hisilicon.com>
Link: https://lore.kernel.org/r/20241112160048.951213-4-james.clark@linaro.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/stat-display.c
tools/perf/util/stat-shadow.c

index 0e16eecfbad8284ce5e1d3746ab974c030ce5fbf..aa74543ae29863e826202a07df2b93531f02839f 100644 (file)
@@ -673,11 +673,6 @@ static void print_metric_only_json(struct perf_stat_config *config __maybe_unuse
        json_out(os, "\"%s\" : \"%s\"", unit, vals);
 }
 
-static void new_line_metric(struct perf_stat_config *config __maybe_unused,
-                           void *ctx __maybe_unused)
-{
-}
-
 static void print_metric_header(struct perf_stat_config *config,
                                void *ctx,
                                enum metric_threshold_classify thresh __maybe_unused,
@@ -839,16 +834,16 @@ static void printout(struct perf_stat_config *config, struct outstate *os,
 
        if (config->csv_output) {
                pm = config->metric_only ? print_metric_only_csv : print_metric_csv;
-               nl = config->metric_only ? new_line_metric : new_line_csv;
+               nl = config->metric_only ? NULL : new_line_csv;
                pmh = print_metricgroup_header_csv;
                os->nfields = 4 + (counter->cgrp ? 1 : 0);
        } else if (config->json_output) {
                pm = config->metric_only ? print_metric_only_json : print_metric_json;
-               nl = config->metric_only ? new_line_metric : new_line_json;
+               nl = config->metric_only ? NULL : new_line_json;
                pmh = print_metricgroup_header_json;
        } else {
                pm = config->metric_only ? print_metric_only : print_metric_std;
-               nl = config->metric_only ? new_line_metric : new_line_std;
+               nl = config->metric_only ? NULL : new_line_std;
                pmh = print_metricgroup_header_std;
        }
 
@@ -1319,7 +1314,7 @@ static void print_metric_headers(struct perf_stat_config *config,
        struct perf_stat_output_ctx out = {
                .ctx = &os,
                .print_metric = print_metric_header,
-               .new_line = new_line_metric,
+               .new_line = NULL,
                .force_header = true,
        };
 
index 47718610d5d8ccdf1e18de298269f894703a48c2..fa8b2a1048ff99326f7245d5c43c8a6e0baed0f5 100644 (file)
@@ -327,7 +327,8 @@ static void print_instructions(struct perf_stat_config *config,
                             "insn per cycle", 0);
        }
        if (max_stalled && instructions) {
-               out->new_line(config, ctxp);
+               if (out->new_line)
+                       out->new_line(config, ctxp);
                print_metric(config, ctxp, METRIC_THRESHOLD_UNKNOWN, "%7.2f ",
                             "stalled cycles per insn", max_stalled / instructions);
        }
@@ -670,7 +671,7 @@ void *perf_stat__print_shadow_stats_metricgroup(struct perf_stat_config *config,
                        }
                }
 
-               if ((*num)++ > 0)
+               if ((*num)++ > 0 && out->new_line)
                        out->new_line(config, ctxp);
                generic_metric(config, mexp, evsel, aggr_idx, out);
        }