Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1208064ybt; Sat, 27 Jun 2020 01:17:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzjJp/p/KOaFif+goVgdFAzIlJMX4QUTHy+LZyiF0bSEbrrK+7FiTHW8/pme0qfw0pdlJoR X-Received: by 2002:a05:6402:2cb:: with SMTP id b11mr264771edx.66.1593245869662; Sat, 27 Jun 2020 01:17:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593245869; cv=none; d=google.com; s=arc-20160816; b=lrvt9NaTKGg2HRrFWVdWM69HGtfptLwe4RxvuAEvc02XFVAztIY4nLDiVttmQFdKjW 5ac1y/WRqH+TXdFUGmIF4hiR+mUsBj7oLSZ8cXgXjhiZpeITlRL0rAcfCYuBEvbQOkD5 gHf5KUKkpKIjGuLYSZ9Ie1fAlJb+Ack34xlhxucYg+TxzHgw2jWtCnkdJmqXIICveR/f GKgP9HLYO369ir9X0EOCRtdmd+GAUHlOAIz62dfumjYeWeOpgmRol53lmT6aiMmqHKJi UCFSWw4dP0u5wLrsClQ+NiOaWX9zn2xEwgLNJYeLqISMYJTT+afAuhd8fo7ANTxtDv5J /FpQ== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=5MyMZDPt8TYoMqn3/5HQbfWc+vdcjQjxQtKPxOnc7H4=; b=YlaHr3HirjBfqzqfE9QkNTBIyL8/7MNhQl0Sz8hdEH4DRHR1INfkp2cGQUs9MgVj0z jZ0p0YClTh5KNl1GfSkHY9ON/Dlcqsa2rq4s6TR3mG9mdeKbsb0+ZSpl7Vd+aJYcapkj a+lbFZoCvJwAQlbedr2EwQqY2OEGCmq0c7GtJ5AfSGoehi30C7cz9k0Ruh5vpn/qDMgT sIjPEpxgZyNjJdwBSw58NRe9+0LZKpLqwoBkAziJhdooUk1SfrdFvNdqmWyILa9WtFph dfwLN8Y/feCIkrGULuO7aw6GIF85ilQUzwYGLVvNgfLZ/uXiB2GXtzhE1bbf6IVVV/RW sHrQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l30si21716802edj.499.2020.06.27.01.17.27; Sat, 27 Jun 2020 01:17:49 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726410AbgF0IPD (ORCPT + 99 others); Sat, 27 Jun 2020 04:15:03 -0400 Received: from lhrrgout.huawei.com ([185.176.76.210]:2365 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725991AbgF0IPC (ORCPT ); Sat, 27 Jun 2020 04:15:02 -0400 Received: from lhreml724-chm.china.huawei.com (unknown [172.18.7.107]) by Forcepoint Email with ESMTP id 572573B0E92068A8C89E; Sat, 27 Jun 2020 09:15:01 +0100 (IST) Received: from [127.0.0.1] (10.210.171.165) by lhreml724-chm.china.huawei.com (10.201.108.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1913.5; Sat, 27 Jun 2020 09:15:00 +0100 Subject: Re: [RFC 00/10] perf tools: Add support to reuse metric To: Jiri Olsa , Arnaldo Carvalho de Melo CC: lkml , Ingo Molnar , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Michael Petlan , Andi Kleen , Kajol Jain , "Paul A. Clarke" , Stephane Eranian , Ian Rogers References: <20200626194720.2915044-1-jolsa@kernel.org> From: John Garry Message-ID: Date: Sat, 27 Jun 2020 09:13:28 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.1.2 MIME-Version: 1.0 In-Reply-To: <20200626194720.2915044-1-jolsa@kernel.org> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.210.171.165] X-ClientProxiedBy: lhreml743-chm.china.huawei.com (10.201.108.193) To lhreml724-chm.china.huawei.com (10.201.108.75) X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 26/06/2020 20:47, Jiri Olsa wrote: > hi, > this patchset is adding the support to reused metric in another > metric. The metric needs to be referenced by 'metric:' prefix. > I notice that there is much repetition in the x86 metric JSONs between CPUs. So I know it's not the same as what you propose here, but jevents standard arch events feature could be used to reduce the repetition. I'm guessing that those metric JSONs are human generated, so would be suitable; unlike the regular JSONs, which are automated. Thanks, John > For example, to define IPC by using CPI with change like: > > "BriefDescription": "Instructions Per Cycle (per Logical Processor)", > - "MetricExpr": "INST_RETIRED.ANY / CPU_CLK_UNHALTED.THREAD", > + "MetricExpr": "1/metric:CPI", > "MetricGroup": "TopDownL1", > "MetricName": "IPC" > > I won't be able to find all the possible places we could > use this at, so I wonder you guys (who was asking for this) > would try it and come up with comments if there's something > missing or we could already use it at some places. > > It's based on Arnaldo's tmp.perf/core. > > Also available in here: > git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git > perf/metric > > thanks, > jirka > > > --- > Jiri Olsa (10): > perf tools: Rename expr__add_id to expr__add_val > perf tools: Add struct expr_parse_data to keep expr value > perf tools: Add expr__add_id function > perf tools: Change expr__get_id to return struct expr_parse_data > perf tools: Add expr__del_id function > perf tools: Collect other metrics in struct egroup > perf tools: Collect other metrics in struct metric_expr > perf tools: Add other metrics to hash data > perf tools: Compute other metrics > perf tests: Add cache_miss_cycles to metric parse test > > tools/perf/pmu-events/arch/x86/skylake/skl-metrics.json | 2 +- > tools/perf/tests/expr.c | 7 ++-- > tools/perf/tests/parse-metric.c | 33 +++++++++++++++++ > tools/perf/tests/pmu-events.c | 4 +-- > tools/perf/util/expr.c | 115 +++++++++++++++++++++++++++++++++++++++++++++------------- > tools/perf/util/expr.h | 24 +++++++++++-- > tools/perf/util/expr.y | 34 ++++++++++++++---- > tools/perf/util/metricgroup.c | 187 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------- > tools/perf/util/metricgroup.h | 6 ++++ > tools/perf/util/stat-shadow.c | 23 +++++++----- > 10 files changed, 374 insertions(+), 61 deletions(-) > > . >