Thread (34 messages) 34 messages, 5 authors, 2015-06-16
STALE4040d
Revisions (9)
  1. v13 current
  2. v14 [diff vs current]
  3. v15 [diff vs current]
  4. v16 [diff vs current]
  5. v17 [diff vs current]
  6. v17 [diff vs current]
  7. v19 [diff vs current]
  8. v20 [diff vs current]
  9. v21 [diff vs current]

[PATCH v13 10/14] perf, tools: Add override support for event list CPUID

From: Sukadev Bhattiprolu <hidden>
Date: 2015-06-02 17:15:20
Also in: lkml
Subsystem: performance events subsystem, the rest · Maintainers: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo, Namhyung Kim, Linus Torvalds

From: Andi Kleen <redacted>

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

Signed-off-by: Andi Kleen <redacted>
Signed-off-by: Sukadev Bhattiprolu <redacted>

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 8d91fa7..2cf03a7 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -481,10 +481,16 @@ static int pmu_add_cpu_aliases(void *data)
 	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.7.9.5
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help