perf pmu: Refactor pmu_add_cpu_aliases()

Create pmu_add_cpu_aliases_map() from pmu_add_cpu_aliases(), so the caller
can pass the map; the pmu-events test would use this since there would
be no CPUID matching to a mapfile there.

Signed-off-by: John Garry <john.garry@huawei.com>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: James Clark <james.clark@arm.com>
Cc: Joakim Zhang <qiangqing.zhang@nxp.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Will Deacon <will@kernel.org>
Cc: linuxarm@huawei.com
Link: http://lore.kernel.org/lkml/1584442939-8911-4-git-send-email-john.garry@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
John Garry
2020-03-17 19:02:15 +08:00
committed by Arnaldo Carvalho de Melo
parent d844780887
commit e45ad701e7
2 changed files with 16 additions and 8 deletions

View File

@@ -21,7 +21,6 @@
#include "pmu.h"
#include "parse-events.h"
#include "header.h"
#include "pmu-events/pmu-events.h"
#include "string2.h"
#include "strbuf.h"
#include "fncache.h"
@@ -744,16 +743,11 @@ out:
* to the current running CPU. Then, add all PMU events from that table
* as aliases.
*/
static void pmu_add_cpu_aliases(struct list_head *head, struct perf_pmu *pmu)
void pmu_add_cpu_aliases_map(struct list_head *head, struct perf_pmu *pmu,
struct pmu_events_map *map)
{
int i;
struct pmu_events_map *map;
const char *name = pmu->name;
map = perf_pmu__find_map(pmu);
if (!map)
return;
/*
* Found a matching PMU events table. Create aliases
*/
@@ -788,6 +782,17 @@ new_alias:
}
}
static void pmu_add_cpu_aliases(struct list_head *head, struct perf_pmu *pmu)
{
struct pmu_events_map *map;
map = perf_pmu__find_map(pmu);
if (!map)
return;
pmu_add_cpu_aliases_map(head, pmu, map);
}
struct perf_event_attr * __weak
perf_pmu__get_default_config(struct perf_pmu *pmu __maybe_unused)
{