From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751452AbdKTPxs (ORCPT ); Mon, 20 Nov 2017 10:53:48 -0500 Received: from mx1.redhat.com ([209.132.183.28]:54390 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751301AbdKTPxr (ORCPT ); Mon, 20 Nov 2017 10:53:47 -0500 Date: Mon, 20 Nov 2017 16:53:45 +0100 From: Jiri Olsa To: Andi Kleen Cc: acme@kernel.org, jolsa@kernel.org, linux-kernel@vger.kernel.org, Andi Kleen Subject: Re: [PATCH v3 3/3] perf, tools, script: Allow computing metrics in perf script Message-ID: <20171120155345.GB13495@krava> References: <20171117214300.32746-1-andi@firstfloor.org> <20171117214300.32746-4-andi@firstfloor.org> <20171120090419.GB5684@krava> <20171120153505.GJ2482@two.firstfloor.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171120153505.GJ2482@two.firstfloor.org> User-Agent: Mutt/1.9.1 (2017-09-22) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 20 Nov 2017 15:53:47 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 20, 2017 at 07:35:05AM -0800, Andi Kleen wrote: > On Mon, Nov 20, 2017 at 10:04:19AM +0100, Jiri Olsa wrote: > > On Fri, Nov 17, 2017 at 01:43:00PM -0800, Andi Kleen wrote: > > > > SNIP > > > > > --- > > > tools/perf/Documentation/perf-script.txt | 10 +++- > > > tools/perf/builtin-script.c | 97 +++++++++++++++++++++++++++++++- > > > tools/perf/util/metricgroup.c | 4 ++ > > > 3 files changed, 108 insertions(+), 3 deletions(-) > > > > > > diff --git a/tools/perf/Documentation/perf-script.txt b/tools/perf/Documentation/perf-script.txt > > > index 2811fcf684cb..974ceb12c7f3 100644 > > > --- a/tools/perf/Documentation/perf-script.txt > > > +++ b/tools/perf/Documentation/perf-script.txt > > > @@ -117,7 +117,7 @@ OPTIONS > > > Comma separated list of fields to print. Options are: > > > comm, tid, pid, time, cpu, event, trace, ip, sym, dso, addr, symoff, > > > srcline, period, iregs, uregs, brstack, brstacksym, flags, bpf-output, brstackinsn, > > > - brstackoff, callindent, insn, insnlen, synth, phys_addr. > > > + brstackoff, callindent, insn, insnlen, synth, phys_addr, metric. > > > Field list can be prepended with the type, trace, sw or hw, > > > to indicate to which event type the field list applies. > > > e.g., -F sw:comm,tid,time,ip,sym and -F trace:time,cpu,trace > > > @@ -217,6 +217,14 @@ OPTIONS > > > > > > The brstackoff field will print an offset into a specific dso/binary. > > > > > > + With the metric option perf script can compute metrics for > > > + sampling periods, similar to perf stat. This requires > > > + specifying a group with multiple metrics with the :S option > > > + for perf record. perf will sample on the first event, and > > > + compute metrics for all the events in the group. Please note > > > + that the metric computed is averaged over the whole sampling > > > + period, not just for the sample point. > > > > hum, is it? I see you call perf_stat__reset_shadow_stats for every > > group start.. which I'd think means you see metric for current > > leader sample point > > Yes it is. > > It's for the complete sampling period because it is computed > over the delta from the last sample to the previous sample. > > There isn't really a metric at a point, it is always over a interval. agreed, it's the count we meassured from the last sample.. but the 'averaged' word above implies to me we compute some average over the 'sampling' period, which we dont do jirka