Skip to content

Commit

Permalink
perf stat: Use evsel__is_hybrid() more
Browse files Browse the repository at this point in the history
[ Upstream commit 93d5e70 ]

In the stat-display code, it needs to check if the current evsel is
hybrid but it uses perf_pmu__has_hybrid() which can return true for
non-hybrid event too.  I think it's better to use evsel__is_hybrid().

Also remove a NULL check for the 'config' parameter in the
hybrid_merge() since it's called after config->no_merge check.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.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: Leo Yan <leo.yan@linaro.org>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
Link: https://lore.kernel.org/r/20221018020227.85905-4-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Stable-dep-of: fdc7d60 ("perf stat: Fix --metric-only --json output")
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
namhyung authored and gregkh committed Dec 31, 2022
1 parent 6c8d557 commit 1b2a63c
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 deletions tools/perf/util/stat-display.c
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ static void uniquify_event_name(struct evsel *counter)
counter->name = new_name;
}
} else {
if (perf_pmu__has_hybrid()) {
if (evsel__is_hybrid(counter)) {
ret = asprintf(&new_name, "%s/%s/",
counter->pmu_name, counter->name);
} else {
Expand Down Expand Up @@ -744,26 +744,14 @@ static void collect_all_aliases(struct perf_stat_config *config, struct evsel *c
}
}

static bool is_uncore(struct evsel *evsel)
{
struct perf_pmu *pmu = evsel__find_pmu(evsel);

return pmu && pmu->is_uncore;
}

static bool hybrid_uniquify(struct evsel *evsel)
{
return perf_pmu__has_hybrid() && !is_uncore(evsel);
}

static bool hybrid_merge(struct evsel *counter, struct perf_stat_config *config,
bool check)
{
if (hybrid_uniquify(counter)) {
if (evsel__is_hybrid(counter)) {
if (check)
return config && config->hybrid_merge;
return config->hybrid_merge;
else
return config && !config->hybrid_merge;
return !config->hybrid_merge;
}

return false;
Expand Down

0 comments on commit 1b2a63c

Please sign in to comment.