Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1145162ybh; Thu, 16 Jul 2020 04:33:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxO5cMvxbIZkrl5D3WCo/3aXy6oGJ2eipAy0p3CkrnmkyfhafVHYRS3suC0BFsLXivd6w7C X-Received: by 2002:a17:906:3984:: with SMTP id h4mr3523243eje.254.1594899216197; Thu, 16 Jul 2020 04:33:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594899216; cv=none; d=google.com; s=arc-20160816; b=yIfDN8buRxQMf/rDvHb/9BcFrxxelJsSBZyw84PsH+kF9icrahYgmjEnd/p0vx9qDJ +VYe1duAHou6NCJ/Jzp2RLbXkSRJKSViuk4Zz/jrDmB/P6Cj8DlExH6RHdR7kD2U0u3E gVgsLIn/Jj54L0yOxjp/+Aq7zuKb7e1oR9tU3q8hy+GEbgwrEKIqrt2uADeAb2wNyNxo hQkQRzGZG08YYwwe5cF0FkJPLptlUbbRnt3CefHxpU3XEeLxRYBvqR+uGxZ/uvFHUutO I1Mls5AzU53YGsR+o8QBFie29YdGJymTOWuiEQH8W9FcALSCsaeSWjYs9RXMexuYrTZS P3rQ== 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=OM0/E3JTIV3DiHHi14L/MCyUHZ2lg/8TgZHfcW5otWg=; b=pJ2jGTKMheTXRRFEechdhUkD/Q6gEkmiL7pGEeLnhGQB11UkD0ryw4ilkhirTuVwdt /Btzc/jPcSpRDLv1DBJXExAv8wyXJBfJ5d9g19FvT387Z65LxPrx9YR3X7wrFQeNGHCp D7w2ru0T3goigJb5DMbDoaGiQGUzaB7bhu2Caxi0LfqFkFDIFxEn8mdA3gl/mqYsK+3Q BRIjy5P0YkU507XbnKN+d5DKe3tiT5F8kv2uRW0NkixN/zBHeGllEATWWHFUlzFieI0k EICO0FMyrzXuKADIdKxJAlMEHx2O1N1C9pksHGHhrrBiWF40kJE3iMVfx/TXyIK9olHR TPSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=BFZjlkTC; 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 rn15si3132974ejb.513.2020.07.16.04.33.12; Thu, 16 Jul 2020 04:33:36 -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=BFZjlkTC; 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 S1728362AbgGPLcK (ORCPT + 99 others); Thu, 16 Jul 2020 07:32:10 -0400 Received: from us-smtp-1.mimecast.com ([207.211.31.81]:35510 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728124AbgGPLcK (ORCPT ); Thu, 16 Jul 2020 07:32:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594899128; 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=OM0/E3JTIV3DiHHi14L/MCyUHZ2lg/8TgZHfcW5otWg=; b=BFZjlkTCWbpCjfjRZzrGxHpo4tdQDl07AZZW90CJ+WAMEXeiBlmBZfVqVx0aEPAPOFSDlr BSSu94UlXNWozTJnNx0HsG36DnwZxOFMSa0p4nOUWi1G9IaUvBZDYVul2FxXMIq7CscsBp XR4hpfdMG1DAkY6Z6W5OtVEDuUwoTqo= 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-355-ZzxdcRKeMkq7VfOuRqwVDQ-1; Thu, 16 Jul 2020 07:32:06 -0400 X-MC-Unique: ZzxdcRKeMkq7VfOuRqwVDQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D2B498015F7; Thu, 16 Jul 2020 11:32:04 +0000 (UTC) Received: from krava (unknown [10.40.192.177]) by smtp.corp.redhat.com (Postfix) with SMTP id 97D13710D7; Thu, 16 Jul 2020 11:32:01 +0000 (UTC) Date: Thu, 16 Jul 2020 13:32:00 +0200 From: Jiri Olsa To: John Garry Cc: Jiri Olsa , Arnaldo Carvalho de Melo , lkml , Ingo Molnar , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Michael Petlan , Andi Kleen , Kajol Jain , "Paul A. Clarke" , Stephane Eranian , Ian Rogers Subject: Re: [PATCH 00/18] perf metric: Add support to reuse metric Message-ID: <20200716113200.GD391962@krava> References: <20200712132634.138901-1-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.15 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 16, 2020 at 08:50:56AM +0100, John Garry wrote: > On 12/07/2020 14:26, 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. > > > > 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. > > > > v2 changes: > > - collected Ian's acks for few patches [Ian] > > - renamed expr__add_id to expr__add_id_val [Ian] > > - renamed expr_parse_data to expr_id_data [Ian] > > - added recursion check [Ian] > > - added metric test for DCache_L2 metric [Ian] > > - added some renames as discussed in review [Ian] > > > > Also available in here: > > git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git > > perf/metric > > > > thanks, > > jirka > > > > > > --- > > Jiri Olsa (18): > > perf metric: Rename expr__add_id to expr__add_val > > perf metric: Add struct expr_id_data to keep expr value > > perf metric: Add expr__add_id function > > perf metric: Change expr__get_id to return struct expr_id_data > > perf metric: Add expr__del_id function > > perf metric: Add find_metric function > > perf metric: Add add_metric function > > perf metric: Rename __metricgroup__add_metric to __add_metric > > perf metric: Collect referenced metrics in struct metric_ref_node > > perf metric: Collect referenced metrics in struct metric_expr > > perf metric: Add referenced metrics to hash data > > perf metric: Compute referenced metrics > > perf metric: Add events for the current group > > perf metric: Add cache_miss_cycles to metric parse test > > perf metric: Add DCache_L2 to metric parse test > > perf metric: Add recursion check when processing nested metrics > > perf metric: Rename struct egroup to metric > > perf metric: Rename group_list to list > > I was thinking that a test metric using this reuse feature could be added in > pmu-events/arch/test/test_cpu. But since no relevant parsing is done in > jevents, maybe not a lot of value. Just for a bit more completeness. ok, I think it's a good idea thanks, jirka