Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp1073740pxy; Thu, 22 Apr 2021 22:38:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzz/IZpj+2Q6A1zwTsTpAxEU5UrOojGNjp0T09V6NKnbr9kDzJ6wILRcsPpFqL+JB3CfM/J X-Received: by 2002:a17:907:7b98:: with SMTP id ne24mr2312731ejc.304.1619156328189; Thu, 22 Apr 2021 22:38:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619156328; cv=none; d=google.com; s=arc-20160816; b=WAhG2lhE7b7NTmtiK3r0YOF1DXs5oJSTWwOLBnhK58pgMXW1IqXYUsyjHN2eaNdaWH Vhz0kxIxqCD3uwjdw5FVkb7HL3d/IfHZRMtOMebJ8QoC9k9cjKdwL0ABVdI2aXXXi7JA jefGrxP7MlHt8Iub40500hk3kVNVOyyjtjLq+/UIYKlQsGF9bwxj4zqKMHKGpRHAEPRc Z88zF2AyortKxRoVq/sP6ZbDXzY1tBNZOBk17u0MNb/lE7hRPRgdKPzChlBYccghV0Ql DssvrKne2oYsNwdjqm/SNB4/sAAdlVU4lWZJhwRO2m9dpqYCBeqhA98tj8nieZqGxUzn XJRg== 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=9OVTmTqP1xs9WMr7PEeRHXBFnEFmtuQLaC5ufIYDYRw=; b=Zm/Pk6N//N3anhc/WdbTuOWOmkavkxW9rIDgFgqd0tSJw6sxP+igucH2Y8S1V6KP2E mjWlOeZwPiCMDPCclx2hQ4faCryG88+3P0cEDl9h0O/3widlqX2vYDliGU7y3DrTiWhy /d00SLCuFi6mhBp89EeuXgHvSViPMQjOwiNtXbQ3MTZpQpfgvasq1SVoTQ3YLhB/xQps sh/o6hgcD4He5NYH/G+X3HCbMhagFSy7J3rI2nJdRWhHl1gSXilzoaHkjN/H5IydgBW3 Cf7NyTmhelQWKAJbIoIX9DrB9Zt9zK0s0KLVuSVnW4qfzaWyPDfx9gqtw6ZJnzLRyuLt 19Hw== 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 hc43si4797896ejc.387.2021.04.22.22.38.25; Thu, 22 Apr 2021 22:38:48 -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 S240644AbhDWFhk (ORCPT + 99 others); Fri, 23 Apr 2021 01:37:40 -0400 Received: from mga18.intel.com ([134.134.136.126]:9279 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240663AbhDWFhc (ORCPT ); Fri, 23 Apr 2021 01:37:32 -0400 IronPort-SDR: ShKkxAReFjWtZT187KtqlI/vW8iSHU2DPdut2oCwnb+bHpZp2yHLHPsWN6AdpNR/QsV5Tn5Lus 3Y8v5aiwB0EQ== X-IronPort-AV: E=McAfee;i="6200,9189,9962"; a="183501794" X-IronPort-AV: E=Sophos;i="5.82,244,1613462400"; d="scan'208";a="183501794" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Apr 2021 22:36:56 -0700 IronPort-SDR: UkxhYQDJzt25Fv9s7WXWC6aps//dlx5LVFOzZUbKAEY2sBMCogmLtcWHDuEbjsKk64pTEv0pGq VjfLIlX3k64Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,244,1613462400"; d="scan'208";a="386293586" Received: from kbl-ppc.sh.intel.com ([10.239.159.163]) by orsmga006.jf.intel.com with ESMTP; 22 Apr 2021 22:36:53 -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 v5 07/26] perf stat: Uniquify hybrid event name Date: Fri, 23 Apr 2021 13:35:22 +0800 Message-Id: <20210423053541.12521-8-yao.jin@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210423053541.12521-1-yao.jin@linux.intel.com> References: <20210423053541.12521-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 --- 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 2a2c15cac80a..1255af4751c2 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -68,6 +68,7 @@ #include "util/affinity.h" #include "util/pfm.h" #include "util/bpf_counter.h" +#include "util/pmu-hybrid.h" #include "asm/bug.h" #include @@ -2378,6 +2379,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 eccc4fd5b3eb..d518da2fd2eb 100644 --- a/tools/perf/util/evsel.h +++ b/tools/perf/util/evsel.h @@ -115,6 +115,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 8123d218ad17..b5edcd6452b8 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 d3137bc17065..5255d78b1c30 100644 --- a/tools/perf/util/stat-display.c +++ b/tools/perf/util/stat-display.c @@ -17,6 +17,7 @@ #include "cgroup.h" #include #include "util.h" +#include "pmu-hybrid.h" #define CNTR_NOT_SUPPORTED "" #define CNTR_NOT_COUNTED "" @@ -532,6 +533,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, @@ -546,8 +548,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