From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3sZtKX3kqFzDsYs for ; Fri, 16 Sep 2016 08:25:52 +1000 (AEST) Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id u8FMN3YK034354 for ; Thu, 15 Sep 2016 18:25:50 -0400 Received: from e17.ny.us.ibm.com (e17.ny.us.ibm.com [129.33.205.207]) by mx0a-001b2d01.pphosted.com with ESMTP id 25fmcrefvf-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 15 Sep 2016 18:25:49 -0400 Received: from localhost by e17.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 15 Sep 2016 18:25:49 -0400 From: Sukadev Bhattiprolu To: Arnaldo Carvalho de Melo Cc: peterz@infradead.org, maddy@linux.vnet.ibm.com, linuxppc-dev@lists.ozlabs.org, Subject: [PATCH v21 09/19] perf, tools: Add override support for event list CPUID Date: Thu, 15 Sep 2016 15:24:46 -0700 In-Reply-To: <1473978296-20712-1-git-send-email-sukadev@linux.vnet.ibm.com> References: <1473978296-20712-1-git-send-email-sukadev@linux.vnet.ibm.com> Message-Id: <1473978296-20712-10-git-send-email-sukadev@linux.vnet.ibm.com> List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Andi Kleen 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 Signed-off-by: Sukadev Bhattiprolu Acked-by: Jiri Olsa Acked-by: Ingo Molnar --- 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