perf stat: Avoid printing cpus with no counters
perf_evlist's user_requested_cpus can contain CPUs not present in any evsel's cpus, for example uncore counters. Avoid printing the prefix and trailing \n until the first valid counter is encountered. Reviewed-by: Adrian Hunter <adrian.hunter@intel.com> Signed-off-by: Ian Rogers <irogers@google.com> Cc: Alexander Antonov <alexander.antonov@linux.intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Alexei Starovoitov <ast@kernel.org> Cc: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Andrii Nakryiko <andrii@kernel.org> Cc: Daniel Borkmann <daniel@iogearbox.net> Cc: German Gomez <german.gomez@arm.com> Cc: James Clark <james.clark@arm.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: John Fastabend <john.fastabend@gmail.com> Cc: John Garry <john.garry@huawei.com> Cc: KP Singh <kpsingh@kernel.org> Cc: Kajol Jain <kjain@linux.ibm.com> Cc: Leo Yan <leo.yan@linaro.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Martin KaFai Lau <kafai@fb.com> Cc: Mathieu Poirier <mathieu.poirier@linaro.org> Cc: Mike Leach <mike.leach@linaro.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Riccardo Mancini <rickyman7@gmail.com> Cc: Song Liu <songliubraving@fb.com> Cc: Stephane Eranian <eranian@google.com> Cc: Suzuki Poulouse <suzuki.poulose@arm.com> Cc: Will Deacon <will@kernel.org> Cc: Yonghong Song <yhs@fb.com> Link: http://lore.kernel.org/lkml/20220503041757.2365696-4-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
committed by
Arnaldo Carvalho de Melo
parent
4d27cf1d9d
commit
570c44a01b
@@ -948,8 +948,6 @@ static void print_no_aggr_metric(struct perf_stat_config *config,
|
|||||||
struct evsel *counter;
|
struct evsel *counter;
|
||||||
bool first = true;
|
bool first = true;
|
||||||
|
|
||||||
if (prefix)
|
|
||||||
fputs(prefix, config->output);
|
|
||||||
evlist__for_each_entry(evlist, counter) {
|
evlist__for_each_entry(evlist, counter) {
|
||||||
u64 ena, run, val;
|
u64 ena, run, val;
|
||||||
double uval;
|
double uval;
|
||||||
@@ -961,6 +959,8 @@ static void print_no_aggr_metric(struct perf_stat_config *config,
|
|||||||
|
|
||||||
id = aggr_cpu_id__cpu(cpu, /*data=*/NULL);
|
id = aggr_cpu_id__cpu(cpu, /*data=*/NULL);
|
||||||
if (first) {
|
if (first) {
|
||||||
|
if (prefix)
|
||||||
|
fputs(prefix, config->output);
|
||||||
aggr_printout(config, counter, id, 0);
|
aggr_printout(config, counter, id, 0);
|
||||||
first = false;
|
first = false;
|
||||||
}
|
}
|
||||||
@@ -972,6 +972,7 @@ static void print_no_aggr_metric(struct perf_stat_config *config,
|
|||||||
printout(config, id, 0, counter, uval, prefix,
|
printout(config, id, 0, counter, uval, prefix,
|
||||||
run, ena, 1.0, &rt_stat);
|
run, ena, 1.0, &rt_stat);
|
||||||
}
|
}
|
||||||
|
if (!first)
|
||||||
fputc('\n', config->output);
|
fputc('\n', config->output);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user