Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp88081ybd; Fri, 28 Jun 2019 15:09:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqy1uSqMAR4FKlcEQDdiyJ7S3c4hKgakZ6X2JXctjxQfsNtkmUftRigpf75toaeYKsIfUv3B X-Received: by 2002:a63:60cc:: with SMTP id u195mr11288787pgb.13.1561759750059; Fri, 28 Jun 2019 15:09:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561759750; cv=none; d=google.com; s=arc-20160816; b=cMSRuWhvrvq5LkKbmSy8cnI9D8E4SMuovF/xwK5qlRDxxePyp84z3fmvqNhstZUlGJ gJHaDpP7R8Oe6HsrrZ70quBFtTNUKS+rGrTWj0Ntqt3KxY789w5vO06R11Y5tzxwEs66 O0k32zfHU3ftdXpNvGb7O8LdeabhtpLquae+3MzAlYWZ2qFjpbo3faUf4LO9FbxamhmN ZLnHJOimqBEkuidz3L6pukckULTm+zWDutM6wyDZZau7bnBZJRA/ZsOnbr3sdP9irZE8 IQ09mIcfD4/5zpzztfDF1peQZVPK+BHFv7vkY8k05X1s8+CZ0qP/TsAM0K8xyicKOBOX yS+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=6zx2mhFi9Z3QZBIuj6NKnxSQ39yOcdTs6CTfIAT8cGM=; b=AsFfSV3BcsKn4DnWxIahwq9tiRs+DttEtmcmZ/WDkjsKPAyq6otwVvQ/2oSQvgvAZ8 ogLjsPNUx/cHCugyItZxvy6YL2XhuRE0Esvas+q9HHyITfT2j3yKD4b9ZOy87FL7VngT vkHejnlB7da3TVwzPQ7cESZOp4ibn1Ua+5k9KBk4RGdsYx602lNBlKWdHEXfSevzdfAv ok375es7pNFehnItGib2cQ9TzVw84gEs0YyuAVS+S52wfGikczUxem0AVWipxM61BRzU +trwr4wrw8IGf84JvvCisF44CaAlFZz3dNPLRhApNHRDmvP/Ygs7fUilcjAsARPzrnIj YtQA== 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 y2si2753911pgp.284.2019.06.28.15.08.54; Fri, 28 Jun 2019 15:09:10 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726849AbfF1WHr (ORCPT + 99 others); Fri, 28 Jun 2019 18:07:47 -0400 Received: from mga05.intel.com ([192.55.52.43]:49434 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726789AbfF1WHr (ORCPT ); Fri, 28 Jun 2019 18:07:47 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Jun 2019 15:07:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,429,1557212400"; d="scan'208";a="183771159" Received: from tassilo.jf.intel.com (HELO tassilo.localdomain) ([10.7.201.137]) by fmsmga001.fm.intel.com with ESMTP; 28 Jun 2019 15:07:46 -0700 Received: by tassilo.localdomain (Postfix, from userid 1000) id 6439F301BCC; Fri, 28 Jun 2019 15:07:46 -0700 (PDT) From: Andi Kleen To: acme@kernel.org Cc: jolsa@kernel.org, linux-kernel@vger.kernel.org, Andi Kleen Subject: [PATCH 3/3] perf tools metric: Don't include duration_time in group Date: Fri, 28 Jun 2019 15:07:37 -0700 Message-Id: <20190628220737.13259-3-andi@firstfloor.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190628220737.13259-1-andi@firstfloor.org> References: <20190628220737.13259-1-andi@firstfloor.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andi Kleen The Memory_BW metric generates groups including duration_time, which maps to a software event. For some reason this makes the group always not count. Always put duration_time outside a group when generating metrics. It's always the same time, so no need to group it. Signed-off-by: Andi Kleen --- tools/perf/util/metricgroup.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/tools/perf/util/metricgroup.c b/tools/perf/util/metricgroup.c index 1c85c9624c58..17ec05e17e7b 100644 --- a/tools/perf/util/metricgroup.c +++ b/tools/perf/util/metricgroup.c @@ -410,6 +410,7 @@ static int metricgroup__add_metric(const char *metric, struct strbuf *events, const char **ids; int idnum; struct egroup *eg; + bool no_group = false; pr_debug("metric expr %s for %s\n", pe->metric_expr, pe->metric_name); @@ -420,11 +421,25 @@ static int metricgroup__add_metric(const char *metric, struct strbuf *events, strbuf_addf(events, ","); for (j = 0; j < idnum; j++) { pr_debug("found event %s\n", ids[j]); + /* + * Duration time maps to a software event and can make + * groups not count. Always use it outside a + * group. + */ + if (!strcmp(ids[j], "duration_time")) { + if (j > 0) + strbuf_addf(events, "}:W,"); + strbuf_addf(events, "duration_time"); + no_group = true; + continue; + } strbuf_addf(events, "%s%s", - j == 0 ? "{" : ",", + j == 0 || no_group ? "{" : ",", ids[j]); + no_group = false; } - strbuf_addf(events, "}:W"); + if (!no_group) + strbuf_addf(events, "}:W"); eg = malloc(sizeof(struct egroup)); if (!eg) { -- 2.20.1