From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752319AbbFAKaM (ORCPT ); Mon, 1 Jun 2015 06:30:12 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46174 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751955AbbFAK3u (ORCPT ); Mon, 1 Jun 2015 06:29:50 -0400 Date: Mon, 1 Jun 2015 12:29:44 +0200 From: Jiri Olsa To: Andi Kleen Cc: acme@kernel.org, namhyung@kernel.org, eranian@google.com, linux-kernel@vger.kernel.org, mingo@kernel.org, sukadev@linux.vnet.ibm.com, Andi Kleen Subject: Re: [PATCH 1/3] perf, tools: Add override support for event list CPUID Message-ID: <20150601102944.GC19893@krava.redhat.com> References: <1433088696-15491-1-git-send-email-andi@firstfloor.org> <1433088696-15491-2-git-send-email-andi@firstfloor.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1433088696-15491-2-git-send-email-andi@firstfloor.org> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, May 31, 2015 at 09:11:34AM -0700, Andi Kleen wrote: > 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 .. within a current architecture (x86, powerpc) .. > can be tested on a single > system. > > v2: Fix double free in earlier version. > Signed-off-by: Andi Kleen > --- > tools/perf/util/pmu.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c > index 578a537..5c30f89 100644 > --- a/tools/perf/util/pmu.c > +++ b/tools/perf/util/pmu.c > @@ -474,7 +474,11 @@ 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; I tried and it's hard to actually say you're looking on another CPU events. Could we advertise the CPUID in perf list? Or at least some pr_debug print. thanks, jirka