Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2184654pxa; Mon, 3 Aug 2020 09:28:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwxD+nfhCMZPngfZ5TIm/Zj3Lf0KihCzHX0wVM9rRg1FNarTD9TlikUngz38uvxchOUgZ+C X-Received: by 2002:a17:906:6083:: with SMTP id t3mr16554753ejj.531.1596472081179; Mon, 03 Aug 2020 09:28:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596472081; cv=none; d=google.com; s=arc-20160816; b=Mvzv8yC9ULtrmzXPyFLmSYtM7W6l1fLPMNJS7avQqstCWnpo1NU9nBWnZH3+7WF/Et 1wsfiIG7oOvLTZKuTp312gexG4DtxZ1nx2mUlzjnwSbwkvsOCM2FpgGyLQzUjUQxSJhO crwHCdxofSQc1X69Fj32+DDBmhbrvuqHVNMC61wkbaHGLDK3NBmsrHRwCUIhECMpXixw dLfuPBgD4D2wBO7ByFiBJ2juJs4oor1ERPA4EHj0GOvexskri/qGQhREqCQhsBs7tGVq 7N++UgMzFZS2fuZOpmfVjOIFA09aKQRzUOQvV+uXAkrjS/9hj8LKhoyLmQwDwZSD3OYW glDg== 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=ltJG4zktCSntDkNDayw7z+gChix7SCDzCjd72YBUIQ0=; b=rleb3KOpVtRD5O0EBjwJf+3QFCTYV9s2BYUg+DC3iBGTJDe8MxRtMs6Qx9TsI0znx5 /bhBIRFeA/LEYda9KjkrAtdlcAiowaYXE9IfKpVjPN5i486ku1zvqIPcflz8p5jvofJf /oZ3tJv1cdafoWh8J6LkMHh17Bsg2dUvxRX68969YehomoKGDTsdKvaIMq5Fz+PSlfdS 2HFw+IzBC57CRQDASIaW1s01MbxX42vDpz8hiXlWMBoi4UEOQ5s+U0aL8dU2JSrkjLOh 1L/K/RtoZ3z0uhPEqB7RIevZlFGO40VXePUw8PAnQ67LtfpNxpVqZYF+tx6yGBBkkTZr DQ8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=KwkxeTFO; 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 r17si8844807eda.525.2020.08.03.09.27.37; Mon, 03 Aug 2020 09:28:01 -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=KwkxeTFO; 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 S1727816AbgHCQ0t (ORCPT + 99 others); Mon, 3 Aug 2020 12:26:49 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:47928 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726878AbgHCQ0t (ORCPT ); Mon, 3 Aug 2020 12:26:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1596472007; 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=ltJG4zktCSntDkNDayw7z+gChix7SCDzCjd72YBUIQ0=; b=KwkxeTFOAcxZGGFTOKx2Now+iyvD9QO6S0I0drd1cY0+BkF+jXHV3dFkEBPrbVuJjE3lXB gnHyQtJ+P+VOYf97ydFfYZv/xzq1zZk+sVkqPzFT7xIq73mTbw/L1r8O0WVcHnQnFmAQ9s 7D9NVVvYM+ULqfvKdvMtu2wfPuClpsQ= 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-100-Btw4iw8GMn6mFEAi_QW12g-1; Mon, 03 Aug 2020 12:26:43 -0400 X-MC-Unique: Btw4iw8GMn6mFEAi_QW12g-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 729FC800685; Mon, 3 Aug 2020 16:26:41 +0000 (UTC) Received: from krava (unknown [10.40.194.146]) by smtp.corp.redhat.com (Postfix) with SMTP id E201A87E27; Mon, 3 Aug 2020 16:26:37 +0000 (UTC) Date: Mon, 3 Aug 2020 18:26:36 +0200 From: Jiri Olsa To: Ian Rogers Cc: "Paul A. Clarke" , Jiri Olsa , Arnaldo Carvalho de Melo , lkml , Ingo Molnar , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Michael Petlan , Andi Kleen , Kajol Jain , John Garry , Stephane Eranian Subject: Re: [PATCHv4 00/19] perf metric: Add support to reuse metric Message-ID: <20200803162636.GF139381@krava> References: <20200729091908.1378911-1-jolsa@kernel.org> <20200801114050.GB377079@li-24c3614c-2adc-11b2-a85c-85f334518bdb.ibm.com> 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.11 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 03, 2020 at 08:54:16AM -0700, Ian Rogers wrote: > On Sat, Aug 1, 2020 at 4:41 AM Paul A. Clarke wrote: > > > > On Wed, Jul 29, 2020 at 11:18:49AM +0200, Jiri Olsa wrote: > > > this patchset is adding the support to reused metric in > > > another metric. > > > > > > 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/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. > > > > > > v4 changes: > > > - removed acks from patch because it changed a bit > > > with the last fixes: > > > perf metric: Collect referenced metrics in struct metric_ref_node > > > - fixed runtime metrics [Kajol Jain] > > > - increased recursion depth [Paul A. Clarke] > > > - changed patches due to dependencies: > > > perf metric: Collect referenced metrics in struct metric_ref_node > > > perf metric: Add recursion check when processing nested metrics > > > perf metric: Rename struct egroup to metric > > > perf metric: Rename group_list to metric_list > > > > > > Also available in here: > > > git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git > > > perf/metric > > > > I built and ran from the above git branch, and things seem to work. > > Indeed, I was able to apply my changes to exploit the new capabilities > > via modifications to tools/perf/pmu-events/arch/powerpc/power9/metrics.json, > > as I posted earlier (and will submit once this set gets merged). > > > > Tested-by: Paul A. Clarke > > > > One thing I noted, but which also occurs without these patches, is that > > the perf metrics are not computed unless run as root: > > -- > > $ perf stat --metrics br_misprediction_percent command > > > > Performance counter stats for 'command': > > > > 1,823,530,051 pm_br_pred:u > > 2,662,705 pm_br_mpred_cmpl:u it's because when you don't run as root, events will get the :u suffix, so they will not match the events in metric.. we need to decide if we want the metric to match events without modifiers or be strict about it > > > > $ /usr/bin/sudo perf stat --metrics br_misprediction_percent command > > > > Performance counter stats for 'command': > > > > 1,824,655,269 pm_br_pred # 0.09 br_misprediction_percent > > 1,654,466 pm_br_mpred_cmpl > > -- > > > > Is that expected? I don't think it's always been that way. > > I agree Paul, this seems broken. I've noticed a bunch of issues with > printing CSV, per-socket output and so on. Jiri may have a better idea > but I plan to look at problems in this area later, and hopefully stick > a few tests on it :-) ok, that'd be great, thanks jirka