Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp976218ybi; Wed, 3 Jul 2019 07:29:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqx8WA4VSC44ui9EFrMcxED631AiDg1O1VodPiGlOWnIqe25FOXcsryAbdvSoZD+wyJ0sWzn X-Received: by 2002:a17:902:9b81:: with SMTP id y1mr44692224plp.194.1562164151861; Wed, 03 Jul 2019 07:29:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562164151; cv=none; d=google.com; s=arc-20160816; b=UEXKWWcplNMeLC3FEshy6RBRbpsUkI1r9g2S+pPQrRumGEXQVONE4txt6JrnvZjee+ g/mox36hWI2rVysrTTh/PAtqhl/d5jLRXrlZFFFS2tBPYO3OC07pQJsRgwKJj+r4GTEy +HTOJ7zsOQ5piBWG5ezEQ1sPCPq7emRVRXV2hmzv5l2ePjmNm2T2h3LWUJTiBXb8jmli QECktig/mE/aom+9+7C+bU1HkoptaH6hNfqCZprcSijoKClUs3HlkZsUypXcr23w9WyT 88GfH2RUpoD53I48cr4J4uzBXfxw+Q09VShRDc9AfIbP5VJRRAUjp7RF4dpp8rD8jGvt 5tFg== 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:dkim-signature:dkim-filter; bh=wU1K/XwJMno8cHqoLmV+jJjjpGSNVErjtRupzb4JzlA=; b=m1Dr9yuspW8uvS1E64CzESA4CGrQX3BPocSVMeWWMEIQ6Jx/74DoTViIzZsetSJtV4 hpeDFav12VMKJTRAvQ67Qi8Wf/cmWy/Dg5tjgLl99FFjoBseqYsLu6BmR4VHs8MA1s83 xTxTlw9gSg2UiFZ2mNi1l0ATMFb/rroxaOSiC5LEJqXo+8siQ9jIGyJFA6cYUfX+ihN4 mSsYHf1UIXZgTt6CcyTj0kql1oveasrb5S6TpJhaE1hjj+BvzsFZpEc3vldiaL+gJRAX ViJqIONiQsfuL8s04UyCD9eFOGUayjwAvEcSBIRayZN6Rv34qTbyh9ttuSGg1wlL9S8a q7Cw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zytor.com header.s=2019061801 header.b="PbTxhM/Y"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=zytor.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l4si2207385pjq.69.2019.07.03.07.28.56; Wed, 03 Jul 2019 07:29:11 -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; dkim=pass header.i=@zytor.com header.s=2019061801 header.b="PbTxhM/Y"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=zytor.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727032AbfGCO2H (ORCPT + 99 others); Wed, 3 Jul 2019 10:28:07 -0400 Received: from terminus.zytor.com ([198.137.202.136]:59579 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726628AbfGCO2G (ORCPT ); Wed, 3 Jul 2019 10:28:06 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id x63ERoKX3326835 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Wed, 3 Jul 2019 07:27:50 -0700 DKIM-Filter: OpenDKIM Filter v2.11.0 terminus.zytor.com x63ERoKX3326835 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2019061801; t=1562164070; bh=wU1K/XwJMno8cHqoLmV+jJjjpGSNVErjtRupzb4JzlA=; h=Date:From:Cc:Reply-To:In-Reply-To:References:To:Subject:From; b=PbTxhM/Yik0bGYQIzm4AvQBIkHDob2wQUN/Kw9FlGEvqWqE4Zasu7jELanqLU4tpz v6oFzQ7OGvlFmLU6plCvx5QfT7509ES0nDOVaX+xDYrnFhuW4we85jIkzVKwyNoCHB JE09Oyz5V+KKbpKnDLoJH5dGmEWdyP8DjgUWd2ECgWeLOzQmhKQ7+ikmw1xM93eCAh xsx1vk//zDl6gURoWCwYPVDGm2faallrc0lsD/LAwLcO7XFlALJHcxzMkWP55YieSA 3Kw1RBurhDfvQYtTiTMuZHWUQLksAbuPKclNxDNQXE7CAHMfmZ0+63zANa0Yqct+Z9 Fkep0o1bp54lw== Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id x63ERnJ63326832; Wed, 3 Jul 2019 07:27:49 -0700 Date: Wed, 3 Jul 2019 07:27:49 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Andi Kleen Message-ID: Cc: hpa@zytor.com, acme@redhat.com, ak@linux.intel.com, kan.liang@linux.intel.com, tglx@linutronix.de, mingo@kernel.org, jolsa@kernel.org, linux-kernel@vger.kernel.org Reply-To: tglx@linutronix.de, kan.liang@linux.intel.com, jolsa@kernel.org, mingo@kernel.org, linux-kernel@vger.kernel.org, hpa@zytor.com, acme@redhat.com, ak@linux.intel.com In-Reply-To: <20190624193711.35241-2-andi@firstfloor.org> References: <20190624193711.35241-2-andi@firstfloor.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf stat: Make metric event lookup more robust Git-Commit-ID: 145c407c808352acd625be793396fd4f33c794f8 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=-3.1 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: 145c407c808352acd625be793396fd4f33c794f8 Gitweb: https://git.kernel.org/tip/145c407c808352acd625be793396fd4f33c794f8 Author: Andi Kleen AuthorDate: Mon, 24 Jun 2019 12:37:08 -0700 Committer: Arnaldo Carvalho de Melo CommitDate: Mon, 1 Jul 2019 22:50:41 -0300 perf stat: Make metric event lookup more robust After setting up metric groups through the event parser, the metricgroup code looks them up again in the event list. Make sure we only look up events that haven't been used by some other metric. The data structures currently cannot handle more than one metric per event. This avoids problems with multiple events partially overlapping. Signed-off-by: Andi Kleen Acked-by: Jiri Olsa Cc: Kan Liang Link: http://lkml.kernel.org/r/20190624193711.35241-2-andi@firstfloor.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/stat-shadow.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/perf/util/stat-shadow.c b/tools/perf/util/stat-shadow.c index 027b09aaa4cf..3f8fd127d31e 100644 --- a/tools/perf/util/stat-shadow.c +++ b/tools/perf/util/stat-shadow.c @@ -304,7 +304,7 @@ static struct perf_evsel *perf_stat__find_event(struct perf_evlist *evsel_list, struct perf_evsel *c2; evlist__for_each_entry (evsel_list, c2) { - if (!strcasecmp(c2->name, name)) + if (!strcasecmp(c2->name, name) && !c2->collect_stat) return c2; } return NULL; @@ -343,7 +343,8 @@ void perf_stat__collect_metric_expr(struct perf_evlist *evsel_list) if (leader) { /* Search in group */ for_each_group_member (oc, leader) { - if (!strcasecmp(oc->name, metric_names[i])) { + if (!strcasecmp(oc->name, metric_names[i]) && + !oc->collect_stat) { found = true; break; }