Received: by 10.223.185.111 with SMTP id b44csp55629wrg; Fri, 9 Mar 2018 00:46:02 -0800 (PST) X-Google-Smtp-Source: AG47ELs7fpYBbswYfi4+EVLO/LGvy7HP29Pyjj8TEavRiUBz990f1z3AIOKMqcPxaEFjDXvMkrDF X-Received: by 2002:a17:902:8f8f:: with SMTP id z15-v6mr9160036plo.315.1520585162533; Fri, 09 Mar 2018 00:46:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520585162; cv=none; d=google.com; s=arc-20160816; b=Y1F3rfMCMaSgbqqC7ZlIaIwm6j6jIVM93TCM+W6CnTamkJ8HHooAI/zVoXnZLePswE sEDUVj1S1qQ4HoR5PZKkuNmmbkzE4tmS7a6XlYRV2YQQ4+9TQVMGqpsQgUAdtsAmT44O WiZi8uD7ii9MBtWvVVjSI+2JqA3wjV4Lcmm8dVbshKi4dt/hEiFjLYE8iQMveBnY5e0t 3AjdkwEV09ZoSz7Uf4jTYtVIYfVPdVwxEII5KbnR8lBzaZm4tq3a0Ozydl0MsDelyD9o wE5eIWhjucyO5iiPFmADgbrlmCE7chx/KhRDQatNEMHGtr8knFvo8h5lQ3tOIMrmatVC 6Ekg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:arc-authentication-results; bh=wC9vdg2wUle12bwk7qLuXgmWAeKhnXXBNNivSL++bY0=; b=W+E6zgGJe49Hs5yJCateAz1k84KWV46Z2NHqNn5f8hX0Ex3oV4GDyqL1ZoyM02PoCf W/ZJWGQT+/rdXFiGK+cinE7ypsuoT5Q0NVZBbRayoldcI/8p5g/vCzG1vb7zxLS3hb7l qOP/3AnxtT7hhH5YxaFhLixO31XhG/XkEJrOMCkQmdyv/2Oe4fcluHFnotBvVzCl3Y8H ukO2MlSnGGzf/IPLz2gXzYYJ9nfN06zWS6egAX9XVtN0Gw4OOUyC7IYIZ1x7DXswc2BZ n5FLWFhJFxqu89H4RBmUq463W/ly+IhIljJb4W9K5PcHANEhaesfGBl6pARF838+OpD6 IW0w== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c10si422350pgf.582.2018.03.09.00.45.48; Fri, 09 Mar 2018 00:46:02 -0800 (PST) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751121AbeCIIni (ORCPT + 99 others); Fri, 9 Mar 2018 03:43:38 -0500 Received: from terminus.zytor.com ([198.137.202.136]:36929 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751059AbeCIIng (ORCPT ); Fri, 9 Mar 2018 03:43:36 -0500 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTP id w298hEWs024163; Fri, 9 Mar 2018 00:43:14 -0800 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w298hEGp024160; Fri, 9 Mar 2018 00:43:14 -0800 Date: Fri, 9 Mar 2018 00:43:14 -0800 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Agustin Vega-Frias Message-ID: Cc: peterz@infradead.org, hpa@zytor.com, linux-kernel@vger.kernel.org, alexander.shishkin@linux.intel.com, tglx@linutronix.de, jolsa@kernel.org, mingo@kernel.org, acme@redhat.com, namhyung@kernel.org, agustinv@codeaurora.org, ak@linux.intel.com, timur@codeaurora.org Reply-To: timur@codeaurora.org, ak@linux.intel.com, agustinv@codeaurora.org, namhyung@kernel.org, acme@redhat.com, mingo@kernel.org, jolsa@kernel.org, tglx@linutronix.de, alexander.shishkin@linux.intel.com, hpa@zytor.com, linux-kernel@vger.kernel.org, peterz@infradead.org In-Reply-To: <1520345084-42646-4-git-send-email-agustinv@codeaurora.org> References: <1520345084-42646-4-git-send-email-agustinv@codeaurora.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf pmu: Auto-merge PMU events created by prefix or glob match Git-Commit-ID: c199c11dce197b12ff884ac0cfcb527b1164788b X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: c199c11dce197b12ff884ac0cfcb527b1164788b Gitweb: https://git.kernel.org/tip/c199c11dce197b12ff884ac0cfcb527b1164788b Author: Agustin Vega-Frias AuthorDate: Tue, 6 Mar 2018 09:04:44 -0500 Committer: Arnaldo Carvalho de Melo CommitDate: Thu, 8 Mar 2018 10:05:49 -0300 perf pmu: Auto-merge PMU events created by prefix or glob match Auto-merge for these events was disabled when auto-merging of non-alias events was disabled in commit 63ce844 (perf stat: Only auto-merge events that are PMU aliases). Non-merging of legacy events is preserved: $ perf stat -ag -e cache-misses,cache-misses sleep 1 Performance counter stats for 'system wide': 86,323 cache-misses 86,323 cache-misses 1.002623307 seconds time elapsed But prefix or glob matching auto-merges the events created: $ perf stat -a -e l3cache/read-miss/ sleep 1 Performance counter stats for 'system wide': 328 l3cache/read-miss/ 1.002627008 seconds time elapsed $ perf stat -a -e l3cache_0_[01]/read-miss/ sleep 1 Performance counter stats for 'system wide': 172 l3cache/read-miss/ 1.002627008 seconds time elapsed As with events created with aliases, auto-merging can be suppressed with the --no-merge option: $ perf stat -a -e l3cache/read-miss/ --no-merge sleep 1 Performance counter stats for 'system wide': 67 l3cache/read-miss/ 67 l3cache/read-miss/ 63 l3cache/read-miss/ 60 l3cache/read-miss/ 1.002622192 seconds time elapsed Signed-off-by: Agustin Vega-Frias Acked-by: Andi Kleen Acked-by: Jiri Olsa Cc: Alexander Shishkin Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Timur Tabi Cc: linux-arm-kernel@lists.infradead.org Change-Id: I0a47eed54c05e1982ca964d743b37f50f60c508c Link: http://lkml.kernel.org/r/1520345084-42646-4-git-send-email-agustinv@codeaurora.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/Documentation/perf-stat.txt | 14 +++++++++----- tools/perf/util/parse-events.c | 13 +++---------- tools/perf/util/parse-events.h | 2 +- tools/perf/util/parse-events.y | 4 ++-- 4 files changed, 15 insertions(+), 18 deletions(-) diff --git a/tools/perf/Documentation/perf-stat.txt b/tools/perf/Documentation/perf-stat.txt index 628026dbedc5..f15b306be183 100644 --- a/tools/perf/Documentation/perf-stat.txt +++ b/tools/perf/Documentation/perf-stat.txt @@ -267,11 +267,15 @@ taskset. --no-merge:: Do not merge results from same PMUs. -When multiple events are created from a single event alias, stat will, -by default, aggregate the event counts and show the result in a single -row. This option disables that behavior and shows the individual events -and counts. Aliases are listed immediately after the Kernel PMU events -by perf list. +When multiple events are created from a single event specification, +stat will, by default, aggregate the event counts and show the result +in a single row. This option disables that behavior and shows +the individual events and counts. + +Multiple events are created from a single event specification when: +1. Prefix or glob matching is used for the PMU name. +2. Aliases, which are listed immediately after the Kernel PMU events + by perf list, are used. --smi-cost:: Measure SMI cost if msr/aperf/ and msr/smi/ events are supported. diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index bafc91edcb44..4e80ca320399 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c @@ -1217,7 +1217,7 @@ int parse_events_add_numeric(struct parse_events_state *parse_state, get_config_name(head_config), &config_terms); } -static int __parse_events_add_pmu(struct parse_events_state *parse_state, +int parse_events_add_pmu(struct parse_events_state *parse_state, struct list_head *list, char *name, struct list_head *head_config, bool auto_merge_stats) { @@ -1287,13 +1287,6 @@ static int __parse_events_add_pmu(struct parse_events_state *parse_state, return evsel ? 0 : -ENOMEM; } -int parse_events_add_pmu(struct parse_events_state *parse_state, - struct list_head *list, char *name, - struct list_head *head_config) -{ - return __parse_events_add_pmu(parse_state, list, name, head_config, false); -} - int parse_events_multi_pmu_add(struct parse_events_state *parse_state, char *str, struct list_head **listp) { @@ -1323,8 +1316,8 @@ int parse_events_multi_pmu_add(struct parse_events_state *parse_state, return -1; list_add_tail(&term->list, head); - if (!__parse_events_add_pmu(parse_state, list, - pmu->name, head, true)) { + if (!parse_events_add_pmu(parse_state, list, + pmu->name, head, true)) { pr_debug("%s -> %s/%s/\n", str, pmu->name, alias->str); ok++; diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h index 88108cd11b4c..5015cfd58277 100644 --- a/tools/perf/util/parse-events.h +++ b/tools/perf/util/parse-events.h @@ -167,7 +167,7 @@ int parse_events_add_breakpoint(struct list_head *list, int *idx, void *ptr, char *type, u64 len); int parse_events_add_pmu(struct parse_events_state *parse_state, struct list_head *list, char *name, - struct list_head *head_config); + struct list_head *head_config, bool auto_merge_stats); int parse_events_multi_pmu_add(struct parse_events_state *parse_state, char *str, diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y index dedf184b5bed..7afeb80cc39e 100644 --- a/tools/perf/util/parse-events.y +++ b/tools/perf/util/parse-events.y @@ -232,7 +232,7 @@ PE_NAME opt_event_config YYABORT; ALLOC_LIST(list); - if (parse_events_add_pmu(_parse_state, list, $1, $2)) { + if (parse_events_add_pmu(_parse_state, list, $1, $2, false)) { struct perf_pmu *pmu = NULL; int ok = 0; char *pattern; @@ -251,7 +251,7 @@ PE_NAME opt_event_config free(pattern); YYABORT; } - if (!parse_events_add_pmu(_parse_state, list, pmu->name, terms)) + if (!parse_events_add_pmu(_parse_state, list, pmu->name, terms, true)) ok++; parse_events_terms__delete(terms); }