Skip to content

Commit 3425b42

Browse files
committed
perf stat: Remove empty new_line_metric function
JIRA: https://issues.redhat.com/browse/RHEL-77935 upstream ======== commit d226f43 Author: James Clark <james.clark@linaro.org> Date: Tue Nov 12 16:00:43 2024 +0000 description =========== 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> Signed-off-by: Michael Petlan <mpetlan@redhat.com>
1 parent ed508bb commit 3425b42

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

tools/perf/util/stat-display.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -673,11 +673,6 @@ static void print_metric_only_json(struct perf_stat_config *config __maybe_unuse
673673
json_out(os, "\"%s\" : \"%s\"", unit, vals);
674674
}
675675

676-
static void new_line_metric(struct perf_stat_config *config __maybe_unused,
677-
void *ctx __maybe_unused)
678-
{
679-
}
680-
681676
static void print_metric_header(struct perf_stat_config *config,
682677
void *ctx,
683678
enum metric_threshold_classify thresh __maybe_unused,
@@ -839,16 +834,16 @@ static void printout(struct perf_stat_config *config, struct outstate *os,
839834

840835
if (config->csv_output) {
841836
pm = config->metric_only ? print_metric_only_csv : print_metric_csv;
842-
nl = config->metric_only ? new_line_metric : new_line_csv;
837+
nl = config->metric_only ? NULL : new_line_csv;
843838
pmh = print_metricgroup_header_csv;
844839
os->nfields = 4 + (counter->cgrp ? 1 : 0);
845840
} else if (config->json_output) {
846841
pm = config->metric_only ? print_metric_only_json : print_metric_json;
847-
nl = config->metric_only ? new_line_metric : new_line_json;
842+
nl = config->metric_only ? NULL : new_line_json;
848843
pmh = print_metricgroup_header_json;
849844
} else {
850845
pm = config->metric_only ? print_metric_only : print_metric_std;
851-
nl = config->metric_only ? new_line_metric : new_line_std;
846+
nl = config->metric_only ? NULL : new_line_std;
852847
pmh = print_metricgroup_header_std;
853848
}
854849

@@ -1319,7 +1314,7 @@ static void print_metric_headers(struct perf_stat_config *config,
13191314
struct perf_stat_output_ctx out = {
13201315
.ctx = &os,
13211316
.print_metric = print_metric_header,
1322-
.new_line = new_line_metric,
1317+
.new_line = NULL,
13231318
.force_header = true,
13241319
};
13251320

tools/perf/util/stat-shadow.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,8 @@ static void print_instructions(struct perf_stat_config *config,
327327
"insn per cycle", 0);
328328
}
329329
if (max_stalled && instructions) {
330-
out->new_line(config, ctxp);
330+
if (out->new_line)
331+
out->new_line(config, ctxp);
331332
print_metric(config, ctxp, METRIC_THRESHOLD_UNKNOWN, "%7.2f ",
332333
"stalled cycles per insn", max_stalled / instructions);
333334
}
@@ -670,7 +671,7 @@ void *perf_stat__print_shadow_stats_metricgroup(struct perf_stat_config *config,
670671
}
671672
}
672673

673-
if ((*num)++ > 0)
674+
if ((*num)++ > 0 && out->new_line)
674675
out->new_line(config, ctxp);
675676
generic_metric(config, mexp, evsel, aggr_idx, out);
676677
}

0 commit comments

Comments
 (0)