@@ -643,12 +643,14 @@ static char *pmu_id(const char *name)
return str;
}
-/*
- * PMU CORE devices have different name other than cpu in sysfs on some
- * platforms.
- * Looking for possible sysfs files to identify the arm core device.
+/**
+ * is_sysfs_pmu_core() - PMU CORE devices have different name other than cpu in
+ * sysfs on some platforms like ARM or Intel hybrid. Looking for
+ * possible the cpus file in sysfs files to identify whether this is a
+ * core device.
+ * @name: The PMU name such as "cpu_atom".
*/
-static int is_arm_pmu_core(const char *name)
+static int is_sysfs_pmu_core(const char *name)
{
char path[PATH_MAX];
@@ -814,7 +816,7 @@ void pmu_add_cpu_aliases_table(struct list_head *head, struct perf_pmu *pmu,
struct pmu_add_cpu_aliases_map_data data = {
.head = head,
.name = pmu->name,
- .cpu_name = is_arm_pmu_core(pmu->name) ? pmu->name : "cpu",
+ .cpu_name = is_sysfs_pmu_core(pmu->name) ? pmu->name : "cpu",
.pmu = pmu,
};
@@ -1647,22 +1649,27 @@ static int cmp_sevent(const void *a, const void *b)
bool is_pmu_core(const char *name)
{
- return !strcmp(name, "cpu") || is_arm_pmu_core(name);
+ return !strcmp(name, "cpu") || is_sysfs_pmu_core(name);
+}
+
+bool is_pmu_hybrid(const char *name)
+{
+ return !strcmp(name, "cpu_atom") || !strcmp(name, "cpu_core");
}
bool perf_pmu__supports_legacy_cache(const struct perf_pmu *pmu)
{
- return is_pmu_core(pmu->name) || perf_pmu__is_hybrid(pmu->name);
+ return is_pmu_core(pmu->name);
}
bool perf_pmu__supports_wildcard_numeric(const struct perf_pmu *pmu)
{
- return is_pmu_core(pmu->name) || perf_pmu__is_hybrid(pmu->name);
+ return is_pmu_core(pmu->name);
}
bool perf_pmu__auto_merge_stats(const struct perf_pmu *pmu)
{
- return !perf_pmu__is_hybrid(pmu->name);
+ return !is_pmu_hybrid(pmu->name);
}
static bool pmu_alias_is_duplicate(struct sevent *alias_a,
@@ -1716,7 +1723,7 @@ void print_pmu_events(const struct print_callbacks *print_cb, void *print_state)
pmu = NULL;
j = 0;
while ((pmu = perf_pmu__scan(pmu)) != NULL) {
- bool is_cpu = is_pmu_core(pmu->name) || perf_pmu__is_hybrid(pmu->name);
+ bool is_cpu = is_pmu_core(pmu->name);
list_for_each_entry(event, &pmu->aliases, list) {
aliases[j].event = event;
@@ -220,6 +220,7 @@ void perf_pmu__del_formats(struct list_head *formats);
struct perf_pmu *perf_pmu__scan(struct perf_pmu *pmu);
bool is_pmu_core(const char *name);
+bool is_pmu_hybrid(const char *name);
bool perf_pmu__supports_legacy_cache(const struct perf_pmu *pmu);
bool perf_pmu__supports_wildcard_numeric(const struct perf_pmu *pmu);
bool perf_pmu__auto_merge_stats(const struct perf_pmu *pmu);