Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759874AbbFBRPU (ORCPT ); Tue, 2 Jun 2015 13:15:20 -0400 Received: from e31.co.us.ibm.com ([32.97.110.149]:36267 "EHLO e31.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759361AbbFBRNE (ORCPT ); Tue, 2 Jun 2015 13:13:04 -0400 From: Sukadev Bhattiprolu To: mingo@redhat.com, ak@linux.intel.com, Michael Ellerman , Jiri Olsa , Arnaldo Carvalho de Melo Cc: namhyung@kernel.org, linuxppc-dev@lists.ozlabs.org, Subject: [PATCH v13 10/14] perf, tools: Add override support for event list CPUID Date: Tue, 2 Jun 2015 10:12:10 -0700 Message-Id: <1433265135-20426-11-git-send-email-sukadev@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1433265135-20426-1-git-send-email-sukadev@linux.vnet.ibm.com> References: <1433265135-20426-1-git-send-email-sukadev@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15060217-8236-0000-0000-00000C012D21 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1266 Lines: 45 From: Andi Kleen 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 Signed-off-by: Sukadev Bhattiprolu 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/