perf pmu: Drop "default_core" from alias names
authorIan Rogers <irogers@google.com>
Fri, 8 Mar 2024 00:19:11 +0000 (16:19 -0800)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 21 Mar 2024 13:41:29 +0000 (10:41 -0300)
"default_core" is used by jevents.py for json events' PMU name when
none is specified. On x86 the "default_core" is typically the PMU
"cpu". When creating an alias see if the event's PMU name is
"default_core" in which case don't record it. This means in places
like "perf list" the PMU's name will be used in its place.

Before:

$ perf list --details
  ...
  cache:
    l1d.replacement
         [Counts the number of cache lines replaced in L1 data cache]
          default_core/event=0x51,period=0x186a3,umask=0x1/
  ...

After:

$ perf list --details
  ...
  cache:
    l1d.replacement
         [Counts the number of cache lines replaced in L1 data cache. Unit: cpu]
          cpu/event=0x51,period=0x186a3,umask=0x1/
  ...

Signed-off-by: Ian Rogers <irogers@google.com>
Tested-by: Kan Liang <kan.liang@linux.intel.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Clark <james.clark@arm.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ravi Bangoria <ravi.bangoria@amd.com>
Cc: Yang Jihong <yangjihong1@huawei.com>
Link: https://lore.kernel.org/r/20240308001915.4060155-3-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/pmu.c

index f39cbbc1a7ec1dcecd9052f917400a3596939363..24be587e3537847974ae3ac789c833477c048a26 100644 (file)
@@ -518,7 +518,8 @@ static int perf_pmu__new_alias(struct perf_pmu *pmu, const char *name,
                unit = pe->unit;
                perpkg = pe->perpkg;
                deprecated = pe->deprecated;
-               pmu_name = pe->pmu;
+               if (pe->pmu && strcmp(pe->pmu, "default_core"))
+                       pmu_name = pe->pmu;
        }
 
        alias = zalloc(sizeof(*alias));