From: John Garry <john.g.garry@oracle.com>
To: Ian Rogers <irogers@google.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Thomas Richter <tmricht@linux.ibm.com>,
Jiri Olsa <jolsa@kernel.org>, Leo Yan <leo.yan@linaro.org>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Namhyung Kim <namhyung@kernel.org>,
Sumanth Korikkar <sumanthk@linux.ibm.com>,
linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org
Subject: Re: [External] : Re: RFC Re: [PATCH v2] perf jevents: Parse metrics during conversion
Date: Thu, 17 Nov 2022 18:16:33 +0000 [thread overview]
Message-ID: <259f8e47-bd58-c8dc-c3fd-12e8dd5d013d@oracle.com> (raw)
In-Reply-To: <f3e704f9-988c-e01f-eb40-13aa405e2857@oracle.com>
On 15/11/2022 17:35, John Garry wrote:
> On 15/11/2022 17:26, Ian Rogers wrote:
>> On Thu, Nov 10, 2022 at 10:48 AM Arnaldo Carvalho de Melo
>> <acme@kernel.org> 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@google.com> 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@google.com>
>>>>
>>>> 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.
At least I can try to test it... so we support python 3.6 and later, right?
I have 3.6 and acme perf/core generated pmu-events.c is ok for me, but
this patch causes an error:
GEN pmu-events/pmu-events.c
PERF_VERSION = 6.1.rc3.g39b7ecfa5b4a
GEN perf-archive
GEN perf-iostat
Traceback (most recent call last):
File "pmu-events/jevents.py", line 7, in <module>
import metric
File "/home/john/kernel-dev2/tools/perf/pmu-events/metric.py", line
399, in <module>
class MetricGroup:
File "/home/john/kernel-dev2/tools/perf/pmu-events/metric.py", line
408, in MetricGroup
'MetricGroup']]):
TypeError: 'type' object is not subscriptable
make[3]: *** [pmu-events/Build:26: pmu-events/pmu-events.c] Error 1
make[2]: *** [Makefile.perf:672: pmu-events/pmu-events-in.o] Error 2
make[2]: *** Waiting for unfinished jobs....
Any idea?
Thanks,
John
next prev parent reply other threads:[~2022-11-17 18:17 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-12 16:42 [PATCH v2] perf jevents: Parse metrics during conversion Ian Rogers
2022-10-28 17:57 ` Ian Rogers
2022-11-10 18:48 ` RFC " Arnaldo Carvalho de Melo
2022-11-15 17:26 ` Ian Rogers
2022-11-15 17:35 ` John Garry
2022-11-15 17:47 ` Ian Rogers
2022-11-17 18:16 ` John Garry [this message]
2022-11-17 22:08 ` [External] : " Ian Rogers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=259f8e47-bd58-c8dc-c3fd-12e8dd5d013d@oracle.com \
--to=john.g.garry@oracle.com \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=leo.yan@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=sumanthk@linux.ibm.com \
--cc=tmricht@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).