Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp4257334pxy; Tue, 27 Apr 2021 00:04:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwnuDGRTjk27+hJd3zLMyC0tGWMKAWYV8tb9EEKRwmeHsU/b0t609wuaWxFj4srfJ/1c/zb X-Received: by 2002:a62:7dcd:0:b029:25d:e0c7:46f3 with SMTP id y196-20020a627dcd0000b029025de0c746f3mr21472679pfc.53.1619507063507; Tue, 27 Apr 2021 00:04:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619507063; cv=none; d=google.com; s=arc-20160816; b=AlONca4KbqwZbTARwMzyst0Q3QMmWbePySX9+nlT5iTwSyPg82HjZKN2s4D1r8RKmb MXhBN4S1cNPe/cNeMO0PWF9M0COzES7hWk+hH6Hk3yjlm4GWTGFUAVwl4lTqFMLcvGdz 0/Tkd9LMR6GTXrSwEo6lRH14E9EaiAm30KAPzMUR4GutFewHHorxqHgEoVB51g14wAd2 McMQdr9C8sryy3t4HayxC/t3oZdeAWmUF7mu8Ac6a9pLpT1iwwEh8P7hggWTJlAC58Rf 78L5H3CkJqrkJTMVuhuNNMxKd68BgB2Z/Mba9fd8IHK8x3xT/15ahgqdtTpyD14/mDOX TmIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:ironport-sdr:ironport-sdr; bh=xZAo3Q5rLQvde8GfV97L+qsOZqMW4gSMTWZyMbmZdqk=; b=HcAmZgXCR3WZqKZB1+aTmeBtUYpZlwszwRCbe0rc9oByUjkmuCZ2WV8pPPt1uKUn7O +x2kn0QoSBt7S54l/rZN4R8mK949FacSOHhG4P1IYr5YhWr4tFsY6RUonlVMsouCUlX/ sUh8ued8iXloQjk3v/Bv6Q7jMfq/0Z7EQ6jkdU+nCp+I3kyO+SonV+nfZv8PzShaId7s WzZb6Qj40ey6xm/yjqXfEImfq4jU9XbvBLCB8TKt0gPzXtn0tuyQc6md5EHcvAErmEgd 0/XWWvvP/TFiJAAYLutqedTod5QK4PLGgeeh9/7cUUHnKzjaA+3vuPZrh608u9tkZyae caRQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y11si2913467plh.307.2021.04.27.00.04.11; Tue, 27 Apr 2021 00:04:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234922AbhD0HEO (ORCPT + 99 others); Tue, 27 Apr 2021 03:04:14 -0400 Received: from mga12.intel.com ([192.55.52.136]:3195 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234898AbhD0HEL (ORCPT ); Tue, 27 Apr 2021 03:04:11 -0400 IronPort-SDR: VRuIkhUpZKUN3DN1AxYsapYgdcJ2d49haioAnEAFAhv4iMPQHQNxvIPak4QTXheCsg7kj0azI0 knkdBUOY1dgQ== X-IronPort-AV: E=McAfee;i="6200,9189,9966"; a="175944191" X-IronPort-AV: E=Sophos;i="5.82,254,1613462400"; d="scan'208";a="175944191" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Apr 2021 00:03:28 -0700 IronPort-SDR: IsFeZPUrtCqepgQRLIlBUa7+PaUYT/yKKZIx4VMIFG9rjiWTkwZ4BqCnE0zjzScXG5al3qQg4M t0wId+wZEsQQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,254,1613462400"; d="scan'208";a="447506656" Received: from kbl-ppc.sh.intel.com ([10.239.159.163]) by fmsmga004.fm.intel.com with ESMTP; 27 Apr 2021 00:03:24 -0700 From: Jin Yao To: acme@kernel.org, jolsa@kernel.org, peterz@infradead.org, mingo@redhat.com, alexander.shishkin@linux.intel.com Cc: Linux-kernel@vger.kernel.org, ak@linux.intel.com, kan.liang@intel.com, yao.jin@intel.com, Jin Yao Subject: [PATCH v6 07/26] perf stat: Uniquify hybrid event name Date: Tue, 27 Apr 2021 15:01:20 +0800 Message-Id: <20210427070139.25256-8-yao.jin@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210427070139.25256-1-yao.jin@linux.intel.com> References: <20210427070139.25256-1-yao.jin@linux.intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It would be useful to let user know the pmu which the event belongs to. perf-stat has supported '--no-merge' option and it can print the pmu name after the event name, such as: "cycles [cpu_core]" Now this option is enabled by default for hybrid platform but change the format to: "cpu_core/cycles/" If user configs the name, we still use the user specified name. Signed-off-by: Jin Yao --- v6: - Rebase to tmp.perf/core branch. v5: - Move 'evsel->use_config_name = true;' from '[PATCH v5 12/26] perf parse-events: Support event inside hybrid pmu' to the patch. v4: - If user configs the name, we still use the user specified name. v3: - No change. tools/perf/builtin-stat.c | 4 ++++ tools/perf/util/evsel.h | 1 + tools/perf/util/parse-events.c | 3 +++ tools/perf/util/stat-display.c | 15 +++++++++++++-- 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index 5ec2190e45cd..835e3696b9ce 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -69,6 +69,7 @@ #include "util/pfm.h" #include "util/bpf_counter.h" #include "util/iostat.h" +#include "util/pmu-hybrid.h" #include "asm/bug.h" #include @@ -2402,6 +2403,9 @@ int cmd_stat(int argc, const char **argv) evlist__check_cpu_maps(evsel_list); + if (perf_pmu__has_hybrid()) + stat_config.no_merge = true; + /* * Initialize thread_map with comm names, * so we could print it out on output. diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h index 8f66cdcb338d..ad74c83bd35b 100644 --- a/tools/perf/util/evsel.h +++ b/tools/perf/util/evsel.h @@ -116,6 +116,7 @@ struct evsel { bool merged_stat; bool reset_group; bool errored; + bool use_config_name; struct hashmap *per_pkg_mask; struct evsel *leader; struct list_head config_terms; diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index 46ebd269a98d..f4628c886e30 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c @@ -1567,6 +1567,9 @@ int parse_events_add_pmu(struct parse_events_state *parse_state, if (!evsel) return -ENOMEM; + if (evsel->name) + evsel->use_config_name = true; + evsel->pmu_name = name ? strdup(name) : NULL; evsel->use_uncore_alias = use_uncore_alias; evsel->percore = config_term_percore(&evsel->config_terms); diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c index 98664caef6af..0679129ad05e 100644 --- a/tools/perf/util/stat-display.c +++ b/tools/perf/util/stat-display.c @@ -18,6 +18,7 @@ #include #include "util.h" #include "iostat.h" +#include "pmu-hybrid.h" #define CNTR_NOT_SUPPORTED "" #define CNTR_NOT_COUNTED "" @@ -538,6 +539,7 @@ static void uniquify_event_name(struct evsel *counter) { char *new_name; char *config; + int ret = 0; if (counter->uniquified_name || !counter->pmu_name || !strncmp(counter->name, counter->pmu_name, @@ -552,8 +554,17 @@ static void uniquify_event_name(struct evsel *counter) counter->name = new_name; } } else { - if (asprintf(&new_name, - "%s [%s]", counter->name, counter->pmu_name) > 0) { + if (perf_pmu__has_hybrid()) { + if (!counter->use_config_name) { + ret = asprintf(&new_name, "%s/%s/", + counter->pmu_name, counter->name); + } + } else { + ret = asprintf(&new_name, "%s [%s]", + counter->name, counter->pmu_name); + } + + if (ret) { free(counter->name); counter->name = new_name; } -- 2.17.1