Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp424220pxb; Fri, 16 Apr 2021 08:54:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwFv+IJrC8z+CpaqXpMJhVUTqAqQW9TMB58wKM9L/nOPm98MgK3xDKS2D2JKvLJLylX/EhQ X-Received: by 2002:a62:1b50:0:b029:257:da1e:837f with SMTP id b77-20020a621b500000b0290257da1e837fmr7868473pfb.57.1618588486828; Fri, 16 Apr 2021 08:54:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618588486; cv=none; d=google.com; s=arc-20160816; b=IXW3sNPEO4QWEZGJBsrF7k/KV+S5Kz/brJgE/1jaxqDm5VYJlRDmQNRUhayHIjAj7s 5rM3ODHN9LgEHHnftw1j/Dw6Mho4fH4+2tNV8IJXvGcH4CNv5vv1qu6DfGtNjwfgy26y BGAycqA3jBVOz4ImJrskLA10tNiH7/5u8Vb7iRd2/CrK3vqhKlh0Nss+pzLKQm4URd37 q9eSzcoRTGch6gsLygco8Zuojl5YFcaE22L1vMUieUJokW0PW/TuPbY6hgd7A4pM+1XM tyvD6fzHiakqZz46VW0CMCaO0uK2hcnMxrQoSXNrU09mqGVNYbJGDiQoF0H+Pi5gIM6C K2ZA== 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=4HImVYI8RLyDAHNUERq7askEzS6HfXo0gkKiByHSXjM=; b=Q2IH7wP1bh/tDchWz/A4V3F1udN5yWEYwrI6vbLasG6lQSi3eiOMN4QDRzH9ROtmiH n29k2OTNxwMubBcHsPa7uVvFVpTB9D1oqtFaqz3kCaIm3PXIYEVAjt3rwTHTs6I3F3fh SdJ2H2eOce1b4acqK59/5970h4d1CP68bnD1ns0U99vTNO+l63/wWhmF+c1nu6uGDUpL 1SMTxQ3HJiU8rgfnVR9w+GTQlEqHCwlSlGUa/m5RoJGGKTp+p8mc20T3F5lvfO5uJQhE 2KzScK02Ocht99STtM/Yi/nBsF4PTZFg4KY05p45B6DJbOpXq7FBZxQCVscShIoQiaXg xkyw== 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 p12si7109653plr.125.2021.04.16.08.54.34; Fri, 16 Apr 2021 08:54:46 -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 S236223AbhDPOHD (ORCPT + 99 others); Fri, 16 Apr 2021 10:07:03 -0400 Received: from mga06.intel.com ([134.134.136.31]:11215 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236198AbhDPOG7 (ORCPT ); Fri, 16 Apr 2021 10:06:59 -0400 IronPort-SDR: KbJ6nWmJ5xxYThAAloipjvKKFK2t3UTDzvNPuCp/g4Xreih722O9bHZ0lUea5G9oOkQMbPEdZH PjzcihVMZX7w== X-IronPort-AV: E=McAfee;i="6200,9189,9956"; a="256358379" X-IronPort-AV: E=Sophos;i="5.82,226,1613462400"; d="scan'208";a="256358379" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Apr 2021 07:06:33 -0700 IronPort-SDR: f8Zduror1R2d/ynL6zKz22vH4HSimYAcO40cyZzVLSYJMdzS6XPDBfe5CLZtU98zlagDBAam+a P3weizT4E0pA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,226,1613462400"; d="scan'208";a="612766686" Received: from kbl-ppc.sh.intel.com ([10.239.159.163]) by fmsmga006.fm.intel.com with ESMTP; 16 Apr 2021 07:06:30 -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 v4 07/25] perf stat: Uniquify hybrid event name Date: Fri, 16 Apr 2021 22:04:59 +0800 Message-Id: <20210416140517.18206-8-yao.jin@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210416140517.18206-1-yao.jin@linux.intel.com> References: <20210416140517.18206-1-yao.jin@linux.intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It would be useful to tell user 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 --- 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/stat-display.c | 15 +++++++++++++-- 3 files changed, 18 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/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