[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210115100829.GA1478666@krava>
Date: Fri, 15 Jan 2021 11:08:29 +0100
From: Jiri Olsa <jolsa@...hat.com>
To: Ian Rogers <irogers@...gle.com>
Cc: Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Namhyung Kim <namhyung@...nel.org>,
linux-kernel@...r.kernel.org, Andi Kleen <ak@...ux.intel.com>,
Jin Yao <yao.jin@...ux.intel.com>,
John Garry <john.garry@...wei.com>,
Paul Clarke <pc@...ibm.com>, kajoljain <kjain@...ux.ibm.com>,
Stephane Eranian <eranian@...gle.com>,
Sandeep Dasgupta <sdasgup@...gle.com>
Subject: Re: [PATCH v7 5/5] perf metric: Don't compute unused events.
On Tue, Jan 12, 2021 at 03:04:34PM -0800, Ian Rogers wrote:
> For a metric like:
> EVENT1 if #smt_on else EVENT2
>
> currently EVENT1 and EVENT2 will be measured and then when the metric is
> reported EVENT1 or EVENT2 will be printed depending on the value from
> smt_on() during the expr parsing. Computing both events is unnecessary and
> can lead to multiplexing as discussed in this thread:
> https://lore.kernel.org/lkml/20201110100346.2527031-1-irogers@google.com/
>
> This change modifies the expression parsing code by:
> - getting rid of the "other" parsing and introducing a boolean argument
> to say whether ids should be computed or not.
> - expressions are changed so that a pair of value and ids are returned.
> - when computing the metric value the ids are unused.
> - when computing the ids, constant values and smt_on are assigned to
> the value.
> - If the value is from an event ID then the event is added to the ids
> hashmap and the value set to bottom (encoded as NAN).
> - Typically operators union IDs for their inputs and set the value to
> bottom, however, if the inputs are constant then these are computed and
> propagated as the value.
> - If the input is constant to certain operators like:
> IDS1 if CONST else IDS2
> then the result will be either IDS1 or IDS2 depending on CONST (which
> may be evaluated from an entire expression), and so IDS1 or IDS2 may
> be discarded avoiding events from being programmed.
> - The ids at the end of parsing are added to the context.
there's lot of refactoring going on, any chance this could be broken
down to more patches?
thanks,
jirka
Powered by blists - more mailing lists