Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp4369798pxb; Tue, 25 Jan 2022 08:58:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJzh6bQ0wNQV+skksCvXLPOZwQYoXHlvU0/CJt4MicbJgx7NjkcM62sXIwfK9IB3I81AMdFw X-Received: by 2002:a17:906:3004:: with SMTP id 4mr16308818ejz.579.1643129927451; Tue, 25 Jan 2022 08:58:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643129927; cv=none; d=google.com; s=arc-20160816; b=knpP/kuN9PIyrzHj233GtQdGdhNJ0RyCpV5bhD/6aiR0m3Ea17Ysz0ewLUnMQDjyGR 8MJb4vYaRBrF5+nN5tt+skdLjXIuWwDZp4wgbiFFQpyufqZxL4CXyP+prf4pJtPnka1d a0JQ9y7kHZHlGiU0MBrvSeyJ4/APLccUE3Ttkoj7apzGru3xtuq218xl9gqsnAU5Ggg8 omSrXwDmYYsnn3n0mSAYGquZh7WkClRvyDw+wkewUPdROaj7fPQQZDkC45kwGJvmg7lF BrJYYRJQOHis62Ngj9mefRO5n4kfcCCDM8H16LAQ305g2PfKBELxRyYmiINg1It9evdp BEpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=PFE6J4uBNxv/58s3Huaj381NfdeDcJF+R4e1ocXM3SU=; b=HgO4vQdORjZ+Y9MBuVv0ecT9OVsgZpxQa30tf8J0LnRSNA5TvcEWXGqB+KpyKAyArp vs6MTPk4mNAs2eWPN+fgi6xX+mhkqbr9KFVPzdgCzKrqHRRWeJM9SILESTl86uKJhE/7 WJO/XoNlwaT0uBSP7kY+u7j77Xyesw7GflRVyiq4HZqc/QQ0QEB17sImLBYhN5ZbXc2b X3l92VbLpM0HY6CGTqA49V/KtG4SXEmVRP0JCqeHP1h14r7dy8mpiqVhIi+GEEN4OrWj oBBAPBRErg/GoaRFKtMoRjgG2Ox4D/iQv3BcRL/sSTQSAFGM7k8X9woE01FvYuWAIyH3 aeKQ== 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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h20si4316858edb.221.2022.01.25.08.58.21; Tue, 25 Jan 2022 08:58:47 -0800 (PST) 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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345698AbiAYMjU (ORCPT + 99 others); Tue, 25 Jan 2022 07:39:20 -0500 Received: from frasgout.his.huawei.com ([185.176.79.56]:4509 "EHLO frasgout.his.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1383416AbiAYMfG (ORCPT ); Tue, 25 Jan 2022 07:35:06 -0500 Received: from fraeml714-chm.china.huawei.com (unknown [172.18.147.201]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4JjmRz52k3z687Zg; Tue, 25 Jan 2022 20:31:27 +0800 (CST) Received: from lhreml724-chm.china.huawei.com (10.201.108.75) by fraeml714-chm.china.huawei.com (10.206.15.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Tue, 25 Jan 2022 13:34:52 +0100 Received: from [10.47.95.36] (10.47.95.36) 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.2308.21; Tue, 25 Jan 2022 12:34:51 +0000 Subject: Re: [PATCHv3 0/4] perf tools: Add support for user defined metric To: Jiri Olsa , Arnaldo Carvalho de Melo CC: lkml , Ingo Molnar , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Michael Petlan , Joe Mario , Andi Kleen , Kajol Jain , "liuqi (BA)" , Guangbin Huang , Zhangshaokun , "irogers@google.com" References: <20200511205307.3107775-1-jolsa@kernel.org> From: John Garry Message-ID: <2e2da73a-7085-b488-4764-705adbff70cc@huawei.com> Date: Tue, 25 Jan 2022 12:34:19 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.12.1 MIME-Version: 1.0 In-Reply-To: <20200511205307.3107775-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.47.95.36] X-ClientProxiedBy: lhreml744-chm.china.huawei.com (10.201.108.194) To lhreml724-chm.china.huawei.com (10.201.108.75) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/05/2020 21:53, Jiri Olsa wrote: + Hi jirka, Did you a plan to continue to work? I don't think that this support was ever merged. We have a requirement to be able to tune parameters of metrics, and support here seems suitable. Thanks, John > hi, > Joe asked for possibility to add user defined metrics. Given that > we already have metrics support, I added --metrics-file option that > allows to specify custom metrics. > > $ cat metrics > # IPC > mine1 = instructions / cycles; > /* DECODED_ICACHE_UOPS% */ > mine2 = 100 * (idq.dsb_uops / \ (idq.ms_uops + idq.mite_uops + idq.dsb_uops + lsd.uops)); > > $ sudo perf stat --metrics-file ./metrics -M mine1,mine2 --metric-only -a -I 1000 > # time insn per cycle mine1 mine2 > 1.000536263 0.71 0.7 41.4 > 2.002069025 0.31 0.3 14.1 > 3.003427684 0.27 0.3 14.8 > 4.004807132 0.25 0.2 12.1 > ... > > v3 changes: > - added doc for metrics file in perf stat man page > - reporting error line number now > - changed '#' style comment to C way with '//' > > v2 changes: > - add new --metrics-file option > - rebased on current perf/core expression bison/flex enhancements > > Also available in: > git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git > perf/metric > > thanks, > jirka > > > --- > Jiri Olsa (4): > perf expr: Add parsing support for multiple expressions > perf expr: Allow comments in custom metric file > perf stat: Add --metrics-file option > perf expr: Report line number with error > > tools/perf/Documentation/perf-stat.txt | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > tools/perf/builtin-stat.c | 7 +++++-- > tools/perf/tests/expr.c | 18 ++++++++++++++++++ > tools/perf/util/expr.c | 6 ++++++ > tools/perf/util/expr.h | 21 +++++++++++++++++++-- > tools/perf/util/expr.l | 34 ++++++++++++++++++++++++++++++++++ > tools/perf/util/expr.y | 21 +++++++++++++++++---- > tools/perf/util/metricgroup.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------- > tools/perf/util/metricgroup.h | 3 ++- > tools/perf/util/stat.h | 1 + > 10 files changed, 242 insertions(+), 16 deletions(-) > > . >