aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/util/pmu.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index af4bedf4cf98..d2fb597c9a8c 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -539,9 +539,10 @@ static bool pmu_is_uncore(const char *name)
539 539
540/* 540/*
541 * PMU CORE devices have different name other than cpu in sysfs on some 541 * PMU CORE devices have different name other than cpu in sysfs on some
542 * platforms. looking for possible sysfs files to identify as core device. 542 * platforms.
543 * Looking for possible sysfs files to identify the arm core device.
543 */ 544 */
544static int is_pmu_core(const char *name) 545static int is_arm_pmu_core(const char *name)
545{ 546{
546 struct stat st; 547 struct stat st;
547 char path[PATH_MAX]; 548 char path[PATH_MAX];
@@ -550,12 +551,6 @@ static int is_pmu_core(const char *name)
550 if (!sysfs) 551 if (!sysfs)
551 return 0; 552 return 0;
552 553
553 /* Look for cpu sysfs (x86 and others) */
554 scnprintf(path, PATH_MAX, "%s/bus/event_source/devices/cpu", sysfs);
555 if ((stat(path, &st) == 0) &&
556 (strncmp(name, "cpu", strlen("cpu")) == 0))
557 return 1;
558
559 /* Look for cpu sysfs (specific to arm) */ 554 /* Look for cpu sysfs (specific to arm) */
560 scnprintf(path, PATH_MAX, "%s/bus/event_source/devices/%s/cpus", 555 scnprintf(path, PATH_MAX, "%s/bus/event_source/devices/%s/cpus",
561 sysfs, name); 556 sysfs, name);
@@ -668,6 +663,7 @@ static void pmu_add_cpu_aliases(struct list_head *head, struct perf_pmu *pmu)
668 struct pmu_events_map *map; 663 struct pmu_events_map *map;
669 struct pmu_event *pe; 664 struct pmu_event *pe;
670 const char *name = pmu->name; 665 const char *name = pmu->name;
666 const char *pname;
671 667
672 map = perf_pmu__find_map(pmu); 668 map = perf_pmu__find_map(pmu);
673 if (!map) 669 if (!map)
@@ -686,11 +682,9 @@ static void pmu_add_cpu_aliases(struct list_head *head, struct perf_pmu *pmu)
686 break; 682 break;
687 } 683 }
688 684
689 if (!is_pmu_core(name)) { 685 if (!is_arm_pmu_core(name)) {
690 /* check for uncore devices */ 686 pname = pe->pmu ? pe->pmu : "cpu";
691 if (pe->pmu == NULL) 687 if (strncmp(pname, name, strlen(pname)))
692 continue;
693 if (strncmp(pe->pmu, name, strlen(pe->pmu)))
694 continue; 688 continue;
695 } 689 }
696 690