lkml.org 
[lkml]   [2022]   [Dec]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v3] perf jevents: Parse metrics during conversion
From
On 05/12/2022 12:53, Arnaldo Carvalho de Melo wrote:
> Em Wed, Nov 30, 2022 at 07:41:38PM -0800, Ian Rogers escreveu:
>> 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, avoiding
>> multiplication by 1 and removing unnecessary whitespace. On x86
>> this reduces the string size by 3,050bytes (0.07%).
>>
>> 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@google.com>
>>
>> v3. Avoids generic types on standard types like set that aren't
>> supported until Python 3.9, fixing an issue with Python 3.6
>> reported-by John Garry. v3 also fixes minor pylint issues and adds
>> a call to Simplify on the read expression tree.
> Cool, John looked reviewed it (may I add the tag?). Applying to my local
> tree, will do some light testing.

Actually I just got as far as testing v2 (which gave rise to this v3). I
will look at it further today.

Thanks,
John

\
 
 \ /
  Last update: 2022-12-05 13:57    [W:0.165 / U:0.984 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site