On 15/11/2022 17:26, Ian Rogers wrote:
On Thu, Nov 10, 2022 at 10:48 AM Arnaldo Carvalho de Melo
<acme@xxxxxxxxxx> wrote:
Em Fri, Oct 28, 2022 at 10:57:02AM -0700, Ian Rogers escreveu:
On Wed, Oct 12, 2022 at 9:42 AM Ian Rogers <irogers@xxxxxxxxxx> wrote:
Currently the 'MetricExpr' json value is passed from the json
file to the pmu-events.c. This change introduces an expression
tree that is parsed into. The parsing is done largely by using
operator overloading and python's 'eval' function. Two advantages
in doing this are:
1) Broken metrics fail at compile time rather than relying on
`perf test` to detect. `perf test` remains relevant for checking
event encoding and actual metric use.
2) The conversion to a string from the tree can minimize the
metric's string size, for example, preferring 1e6 over 1000000
and removing unnecessary whitespace. On x86 this reduces the
string size by 2,823bytes (0.06%).
In future changes it would be possible to programmatically
generate the json expressions (a single line of text and so a
pain to write manually) for an architecture using the expression
tree. This could avoid copy-pasting metrics for all architecture
variants.
Signed-off-by: Ian Rogers <irogers@xxxxxxxxxx>
Ping, PTAL.
That would be really nice if people working with JSON, metrics, could
take a look at Ian's work and test it with their files, volunteers?
Perhaps John could help?
I'll have a look soon. I have to admit that I have not been tracking the jevents changes as close as before.