Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2305273ybt; Sun, 28 Jun 2020 15:07:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJysdWkArrtx64CsQDwUV4A4xHftHS+SW6rO12t1+azwuKM/DjW4mDEp+CHj4RIa13XihebZ X-Received: by 2002:a17:906:a28b:: with SMTP id i11mr11409315ejz.524.1593382063468; Sun, 28 Jun 2020 15:07:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593382063; cv=none; d=google.com; s=arc-20160816; b=cQZee3rjyjTpjWTm+j/xBaWufvnUgUuG4m5Vi2+Dq6HTm9Lh+cR1e0vCTX1lmbZ7Lx ICrXfRBn/D1sAm8IiPk0QZUF8o5x6NH8ew8A+c5vuTevq3ts0qkji5NVdJcUdNaVbbsk SNyAiHDx+PhOrIbEatOFir6jMEPcCivHGnCvzbtwItrjCpBOesH0YSaR/iOQ18PUrkFM jt0tRzbviNDz2kQCTHcvwIQCkIZ2GkwOWpZyRhRd9nGU2vSyqYU5JxFVXZxlyOaglYdh RtMh+LjkN6cZ2ACCoE5GbiUFmZlaX7/3nEBMzwPOEhxII06nPLc+RZddopuopfOhc3gy OFvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=Wrx+wMG9HM1GFKCj2tzsXVGQYf9X5x+VPovksnHdBSg=; b=PyuIu68WGKgUleDgNr74/Vdqyb/SNP8omEQaA4/he52uhpD2XBgdmZVOP5VMelhRny 2dSYJcSkzXgMbY4oy0UgnJB1nTpnA/byTiEwqEES/EGEkqyE9PjOWe3cS6Jy2X3mB+8F 1Us6JjPN6Mt32nHNnv2VQYhc1hZdM2bl/ON0WJ7rdyfqoMIkM0G6zKDgR6xHSPus6uCT ChOTKFY7eNksVTRuUx8dzhg7/MjHstWwxkK081nqQoErYfDInUnYTG0QCdjvNJ5X+j/t IIHMqnV7BB48XUVNhJvVKvdDlcH0E9bkkyVHKvvRve7wCSgDxPnZGhx6M01Oy+SllAMv uZuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=AV70+1RZ; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v12si5212891ejc.292.2020.06.28.15.07.20; Sun, 28 Jun 2020 15:07:43 -0700 (PDT) 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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=AV70+1RZ; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726686AbgF1WGO (ORCPT + 99 others); Sun, 28 Jun 2020 18:06:14 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:25441 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726138AbgF1WGN (ORCPT ); Sun, 28 Jun 2020 18:06:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1593381971; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Wrx+wMG9HM1GFKCj2tzsXVGQYf9X5x+VPovksnHdBSg=; b=AV70+1RZMxPI9SJTL9O3VncBRuLH4JmaUPgNP7nnEnzrN3/HcS8VwyxHSgZshcGR01uvQ8 Y+9O2Cg77EI/2c1R+vyHZnDPSOjm4jHK1YqSkoLIVQnYly5zW84lI1TEf4Ejby/Wvnagic 9y0M8KntjyqlEQcdmswX60OAJYsNn1U= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-165-9rZkSM_aMLWpo4Pq_1fylg-1; Sun, 28 Jun 2020 18:06:07 -0400 X-MC-Unique: 9rZkSM_aMLWpo4Pq_1fylg-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4668D107ACCA; Sun, 28 Jun 2020 22:06:05 +0000 (UTC) Received: from krava (unknown [10.40.192.56]) by smtp.corp.redhat.com (Postfix) with SMTP id 6D9AC5C1B2; Sun, 28 Jun 2020 22:06:02 +0000 (UTC) Date: Mon, 29 Jun 2020 00:06:01 +0200 From: Jiri Olsa To: Ian Rogers Cc: Jiri Olsa , Arnaldo Carvalho de Melo , lkml , Ingo Molnar , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Michael Petlan , Andi Kleen , Kajol Jain , John Garry , "Paul A. Clarke" , Stephane Eranian Subject: Re: [PATCH 06/10] perf tools: Collect other metrics in struct egroup Message-ID: <20200628220601.GR2988321@krava> References: <20200626194720.2915044-1-jolsa@kernel.org> <20200626194720.2915044-7-jolsa@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 26, 2020 at 02:48:02PM -0700, Ian Rogers wrote: > On Fri, Jun 26, 2020 at 12:47 PM Jiri Olsa wrote: > > > > Collecting other metrics in struct egroup object, > > so we can process them later on. > > > > The change will parse or 'other' metric names out of > > expression and 'resolve' them. > > > > Every used expression needs to have 'metric:' prefix, > > like: > > cache_miss_cycles = metric:dcache_miss_cpi + metric:icache_miss_cycles > > > > All 'other' metrics are disolved into one context, > > meaning all 'other' metrics events and addded to > > the parent context. > > > > Signed-off-by: Jiri Olsa > > --- > > .../arch/x86/skylake/skl-metrics.json | 2 +- > > tools/perf/util/expr.c | 11 ++ > > tools/perf/util/expr.h | 1 + > > tools/perf/util/metricgroup.c | 158 ++++++++++++++++-- > > 4 files changed, 157 insertions(+), 15 deletions(-) > > > > diff --git a/tools/perf/pmu-events/arch/x86/skylake/skl-metrics.json b/tools/perf/pmu-events/arch/x86/skylake/skl-metrics.json > > index 8704efeb8d31..71e5a2b471ac 100644 > > --- a/tools/perf/pmu-events/arch/x86/skylake/skl-metrics.json > > +++ b/tools/perf/pmu-events/arch/x86/skylake/skl-metrics.json > > @@ -57,7 +57,7 @@ > > }, > > { > > "BriefDescription": "Instructions Per Cycle (per Logical Processor)", > > - "MetricExpr": "INST_RETIRED.ANY / CPU_CLK_UNHALTED.THREAD", > > + "MetricExpr": "1/metric:CPI", > > "MetricGroup": "TopDownL1", > > "MetricName": "IPC" > > }, > > diff --git a/tools/perf/util/expr.c b/tools/perf/util/expr.c > > index aa14c7111ecc..cd73dae4588c 100644 > > --- a/tools/perf/util/expr.c > > +++ b/tools/perf/util/expr.c > > @@ -150,3 +150,14 @@ int expr__find_other(const char *expr, const char *one, > > > > return ret; > > } > > + > > +#define METRIC "metric:" > > + > > +bool expr__is_metric(const char *name, const char **metric) > > +{ > > + int ret = !strncmp(name, METRIC, sizeof(METRIC) - 1); > > + > > + if (ret && metric) > > + *metric = name + sizeof(METRIC) - 1; > > + return ret; > > +} > > Should expr.l recognize metric:... as a different kind of token rather > than an ID? hm, we still want it to be returned as ID token, and the processing code needs a way to distinguish between event and metric, so I'd think we need to keep it, but I'll double check thanks, jirka