From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753871AbdH1INo (ORCPT ); Mon, 28 Aug 2017 04:13:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45894 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751757AbdH1INh (ORCPT ); Mon, 28 Aug 2017 04:13:37 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 13F0880472 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=jolsa@redhat.com Date: Mon, 28 Aug 2017 10:13:35 +0200 From: Jiri Olsa To: Andi Kleen Cc: acme@kernel.org, jolsa@kernel.org, linux-kernel@vger.kernel.org, Andi Kleen Subject: Re: [PATCH v2 14/19] perf, tools, stat: Support JSON metrics in perf stat Message-ID: <20170828081335.GA31013@krava> References: <20170811232634.30465-1-andi@firstfloor.org> <20170811232634.30465-14-andi@firstfloor.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170811232634.30465-14-andi@firstfloor.org> User-Agent: Mutt/1.8.3 (2017-05-23) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 28 Aug 2017 08:13:37 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 11, 2017 at 04:26:29PM -0700, Andi Kleen wrote: SNIP > diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c > index ac16a9db1fb5..4f049285e3ac 100644 > --- a/tools/perf/util/pmu.c > +++ b/tools/perf/util/pmu.c > @@ -516,16 +516,8 @@ char * __weak get_cpuid_str(void) > return NULL; > } > > -/* > - * From the pmu_events_map, find the table of PMU events that corresponds > - * to the current running CPU. Then, add all PMU events from that table > - * as aliases. > - */ > -static void pmu_add_cpu_aliases(struct list_head *head, const char *name) > +char *perf_pmu__getcpuid(void) please add this function in separate patch > { > - int i; > - struct pmu_events_map *map; > - struct pmu_event *pe; > char *cpuid; also you could make cpuid static and not rerun the check every time it's called jirka > static bool printed; > > @@ -535,12 +527,26 @@ static void pmu_add_cpu_aliases(struct list_head *head, const char *name) > if (!cpuid) > cpuid = get_cpuid_str(); > if (!cpuid) > - return; > + return NULL; > > if (!printed) { > pr_debug("Using CPUID %s\n", cpuid); > printed = true; > } > + return cpuid; > +}