Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1484581

[PATCH v21 09/19] perf, tools: Add override support for event list CPUID

From Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Newsgroups linux.kernel
Subject [PATCH v21 09/19] perf, tools: Add override support for event list CPUID
Date 2016-09-16 00:30 +0200
Message-ID <shNkl-4te-25@gated-at.bofh.it> (permalink)
References <shNkl-4te-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Andi Kleen <ak@linux.intel.com>

Add a PERF_CPUID variable to override the CPUID of the current CPU (within
the current architecture). This is useful for testing, so that all event
lists can be tested on a single system.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Acked-by: Ingo Molnar <mingo@kernel.org>
---

v2: Fix double free in earlier version.
    Print actual CPUID being used with verbose option.
---
 tools/perf/util/pmu.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index cb4c215..2291d2a 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -501,10 +501,16 @@ static int pmu_add_cpu_aliases(struct list_head *head)
 	struct pmu_event *pe;
 	char *cpuid;
 
-	cpuid = get_cpuid_str();
+	cpuid = getenv("PERF_CPUID");
+	if (cpuid)
+		cpuid = strdup(cpuid);
+	if (!cpuid)
+		cpuid = get_cpuid_str();
 	if (!cpuid)
 		return 0;
 
+	pr_debug("Using CPUID %s\n", cpuid);
+
 	i = 0;
 	while (1) {
 		map = &pmu_events_map[i++];
-- 
1.8.3.1

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH v21 09/19] perf, tools: Add override support for event list CPUID Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> - 2016-09-16 00:30 +0200

csiph-web