Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp127611pxf; Wed, 10 Mar 2021 23:10:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJxOWK0yyMd8kw7vUURNsn5JlX0XqJPG5OnKU/FKbjaNgMM6G1h2WUa8+ci6XeUktATbVA/9 X-Received: by 2002:a17:907:72ce:: with SMTP id du14mr1662859ejc.301.1615446653421; Wed, 10 Mar 2021 23:10:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615446653; cv=none; d=google.com; s=arc-20160816; b=BKkfz+LWuO914Lpq+v8BIeNqoAnf/NULBm3YZBKNiA4qlebdE+0ma9Rr2NZeMrWH/A bqcIGjc5ANmYrU9JrRPP06VCmjS4lXAf+KlJKtjzzImpirLLbPQaLqzEEoR1aUXQt8KX XCEhQ2ZiTvGQPzFfaUQlCLQuJoKG1KAyhD/TbrXBTNVTBx5aEIDA2wiRmAAlV3hQtqg2 3uFBeSX4uFud9mH+t1QSMgSjU+33H+UfM0wjY9iYqJVavTzBNBRudRTNVAGNL5kPyV9Q vMcHtYQKNaef6Bs5A5l+AOEwgaxT+c0NTKGj+0TR+1hT+fULpHpItZUdxNbpHVp1jahE RfEg== 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=Qt2Z+cSi5CUFakOUKD2b8Iac90zk5nV7Tzs8EPk+4Rc=; b=pu2KhglY+NlS2fM6QfY0Gl2KDOChXPmMFh9ejQod6Oopllx3/c7lzW1bJBMxyXSm5Q P41VNTgE2tTiTr/8CsFfkMxpzIwy3EpeB+UDgauF5q534qXDO1Yn2bAGqB/nDodVp1va 1PERufUAcs3UfZ4sjY0Ww/zG7mzOfbeR0iRH7YnvzCb8zC+ckJ0X1wXIw2/0tP951lFO 3ENoUm89+PvThs21s6CHI/XIP6HjsGpoXez+Q+1marx+KCyqqcbESYlwV4q88vxjfUZl 6XiU1DQN37fIwWRwO5QJ9S9O2BEws3J/95tfMPnYmEtlQ8i6RJ941JPooal7LkdfiN9D MX5Q== 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 h20si1067257ejc.687.2021.03.10.23.10.31; Wed, 10 Mar 2021 23:10:53 -0800 (PST) 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 S231781AbhCKHJD (ORCPT + 99 others); Thu, 11 Mar 2021 02:09:03 -0500 Received: from mga04.intel.com ([192.55.52.120]:22599 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231634AbhCKHIi (ORCPT ); Thu, 11 Mar 2021 02:08:38 -0500 IronPort-SDR: Su8z6nYHnKtOJn70rERqmcA2NMMiVjxBKnf+VHSX4DCiB/MioycxLmxbpLlCEVKtgBl1U5XUFL Yeuhrz9TdGrw== X-IronPort-AV: E=McAfee;i="6000,8403,9919"; a="186246045" X-IronPort-AV: E=Sophos;i="5.81,239,1610438400"; d="scan'208";a="186246045" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Mar 2021 23:08:38 -0800 IronPort-SDR: YlkUpQeC1kx9OJ/tey6AvKkooA90TXWAH650L6hlGdCsFKrbZ8KREdMvR347vuB6gnEiEYXVDa p5lnNEIB5b8A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,239,1610438400"; d="scan'208";a="509937877" Received: from kbl-ppc.sh.intel.com ([10.239.159.163]) by fmsmga001.fm.intel.com with ESMTP; 10 Mar 2021 23:08:36 -0800 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 v2 08/27] perf stat: Uniquify hybrid event name Date: Thu, 11 Mar 2021 15:07:23 +0800 Message-Id: <20210311070742.9318-9-yao.jin@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210311070742.9318-1-yao.jin@linux.intel.com> References: <20210311070742.9318-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/" Signed-off-by: Jin Yao --- tools/perf/builtin-stat.c | 3 +++ tools/perf/util/stat-display.c | 12 ++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index 68ecf68699a9..6c0a21323814 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -2390,6 +2390,9 @@ int cmd_stat(int argc, const char **argv) evlist__check_cpu_maps(evsel_list); + if (perf_pmu__hybrid_exist()) + 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/stat-display.c b/tools/perf/util/stat-display.c index 7f09cdaf5b60..ed37d8e7ea1a 100644 --- a/tools/perf/util/stat-display.c +++ b/tools/perf/util/stat-display.c @@ -526,6 +526,7 @@ static void uniquify_event_name(struct evsel *counter) { char *new_name; char *config; + int ret; if (counter->uniquified_name || !counter->pmu_name || !strncmp(counter->name, counter->pmu_name, @@ -540,8 +541,15 @@ 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__hybrid_exist()) { + 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