From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751220AbdKMJaO (ORCPT ); Mon, 13 Nov 2017 04:30:14 -0500 Received: from mx1.redhat.com ([209.132.183.28]:38704 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750854AbdKMJaN (ORCPT ); Mon, 13 Nov 2017 04:30:13 -0500 Date: Mon, 13 Nov 2017 10:30:11 +0100 From: Jiri Olsa To: Andi Kleen Cc: acme@kernel.org, jolsa@kernel.org, linux-kernel@vger.kernel.org, Andi Kleen Subject: Re: [PATCH v1 5/5] perf, tools, script: Allow computing metrics in perf script Message-ID: <20171113093011.GA22209@krava> References: <20171109145528.23371-1-andi@firstfloor.org> <20171109145528.23371-6-andi@firstfloor.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171109145528.23371-6-andi@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.38]); Mon, 13 Nov 2017 09:30:13 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 09, 2017 at 06:55:28AM -0800, Andi Kleen wrote: SNIP > static void process_event(struct perf_script *script, > struct perf_sample *sample, struct perf_evsel *evsel, > struct addr_location *al, > @@ -1481,6 +1560,9 @@ static void process_event(struct perf_script *script, > if (PRINT_FIELD(PHYS_ADDR)) > printf("%16" PRIx64, sample->phys_addr); > printf("\n"); > + > + if (PRINT_FIELD(METRIC)) > + print_metric(script, thread, evsel, sample); > } > > static struct scripting_ops *scripting_ops; > diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h > index 25f21cde8826..27a72b883645 100644 > --- a/tools/perf/util/evsel.h > +++ b/tools/perf/util/evsel.h > @@ -108,6 +108,8 @@ struct perf_evsel { > struct cpu_map *cpus; > struct cpu_map *own_cpus; > struct thread_map *threads; > + u64 val; > + int gnum; please put this to the priv (struct perf_stat_evsel) with some comments that it's used in script only also there's per event dump feature that uses evsel->priv (please rebase to latest Arnaldo's perf/core) in script, so make sure you are mutualy exclusive thanks, jirka