Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1388897imm; Wed, 6 Jun 2018 15:25:36 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJTt4agA4NYGUbpPjTf961N9zM8Si0syfGYMqwhUs2uQYjVNXQw8berUkwz09wNsoEwZmWe X-Received: by 2002:a62:4255:: with SMTP id p82-v6mr4127521pfa.227.1528323936219; Wed, 06 Jun 2018 15:25:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528323936; cv=none; d=google.com; s=arc-20160816; b=PagQ9+nWbiSVW94NEJvOQu6d8q79PzxpWautw3jrFVo5Cfiqkh7HVCeL+OPbB/22xL I+MMINOv6lp9ZXAsbcorkjItJ/uDV4cH/zyM42G4FfdyrJVJEmICkGRX46AprezMYv7q zmvkInB+65ZxzOKlohHo1siZ8kKhW/4jUboZiwfKugVg2s96A+QfVQ5/uXLNAj+fOqSo XbX6ByiCL6t3B0EVv0jCDrbMJFq8iq0eqL+Rk+iJHWKLKm4Z9iRYdVwPUtJ9c2W2gmLo ZlzSaed1x0d7XdmMVv2Stj4997lQULOUwF4BKhJDK3sfX2KzCFApxE3ywEHl8R3kE5SY +ZXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=HbjFfnqnKeNzfzc0BE+Qulh8/29Qujip/xAADaAJPAs=; b=NTQkE4mU9eemHsFU7NihfDN2CmxSbnILzyp9Fl9PfY1ZxkyXO0jzevgdePbnBGfXCR pi1kKD1EAuiRsaSjqGEb/guCFxcPH8fDRSnEv/naSIECWZk9I3QhreDJHPwYPJyqUCfs aPIdiQ/EEhejLS0DF6BJQB4jdk6nK2U5F9fHTRfp0HhxUJRy1FrsSPaFxynjVnbwaCwi 6aFboEo2Es9mti7XNbajRfty7DeLlnNFQ8d+lcd2/AzfAWxJ9TI0VOj5qtFpzZdjOeKw nhmTmti3WwJ+XsoDEu57ozlnxE/N2fJ3goM++85bQ656kNczHjdb8EBzLbjzvtYLjdbx cfpQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k7-v6si3009759pgc.401.2018.06.06.15.25.22; Wed, 06 Jun 2018 15:25:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752359AbeFFWPZ (ORCPT + 99 others); Wed, 6 Jun 2018 18:15:25 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:46234 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752228AbeFFWPW (ORCPT ); Wed, 6 Jun 2018 18:15:22 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1C5A2859C8; Wed, 6 Jun 2018 22:15:22 +0000 (UTC) Received: from krava.redhat.com (ovpn-204-89.brq.redhat.com [10.40.204.89]) by smtp.corp.redhat.com (Postfix) with ESMTP id AB24A2026DEF; Wed, 6 Jun 2018 22:15:18 +0000 (UTC) From: Jiri Olsa To: Arnaldo Carvalho de Melo , Peter Zijlstra Cc: Andi Kleen , Kan Liang , Agustin Vega-Frias , lkml , Ingo Molnar , Namhyung Kim , David Ahern , Alexander Shishkin , Stephane Eranian , Milian Wolff , Andi Kleen , Frederic Weisbecker Subject: [PATCH 01/10] perf tools: Uniquify the event name if there's no other matched event Date: Thu, 7 Jun 2018 00:15:04 +0200 Message-Id: <20180606221513.11302-2-jolsa@kernel.org> In-Reply-To: <20180606221513.11302-1-jolsa@kernel.org> References: <20180606221513.11302-1-jolsa@kernel.org> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Wed, 06 Jun 2018 22:15:22 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Wed, 06 Jun 2018 22:15:22 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jolsa@kernel.org' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently by default we try to match the user specified PMU name to all PMU units available and use them to aggregate all matched PMUs event counts into one 'pattern' event. While this is useful for uncore events, it screws up names for other events, where this is not desirable, like: Before: # perf stat -e cp/cpu-cycles/ kill Performance counter stats for 'kill': 1,573,757 cp/cpu-cycles/ Keeping the pattern matching logic, but making the name unique in case there's no other match found. That fixes the example above and hopefully does not screw up anything else. After: # perf stat -e cp/cpu-cycles/ kill Performance counter stats for 'kill': 1,573,757 cpu/cpu-cycles/ Cc: Andi Kleen Cc: Kan Liang Cc: Agustin Vega-Frias Link: http://lkml.kernel.org/n/tip-lpb7bmaj3szgmemf53yg4nke@git.kernel.org Signed-off-by: Jiri Olsa --- tools/perf/builtin-stat.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index 096ccb25c11f..fce46252f89c 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -1323,6 +1323,7 @@ static void collect_all_aliases(struct perf_evsel *counter, void *data) { struct perf_evsel *alias; + int cnt = 0; alias = list_prepare_entry(counter, &(evsel_list->entries), node); list_for_each_entry_continue (alias, &evsel_list->entries, node) { @@ -1334,7 +1335,15 @@ static void collect_all_aliases(struct perf_evsel *counter, break; alias->merged_stat = true; cb(alias, data, false); + cnt++; } + + /* + * There's no matching event to aggregate + * counts with, fix the event name + */ + if (!cnt) + uniquify_event_name(counter); } static bool collect_data(struct perf_evsel *counter, -- 2.13.6