lkml.org 
[lkml]   [2022]   [May]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v2 5/7] perf jevents: Add python converter script
On Wed, May 11, 2022 at 2:47 PM Andi Kleen <ak@linux.intel.com> wrote:
>
>
> On 5/11/2022 2:15 PM, Ian Rogers wrote:
> > jevents.c is large, has a dependency on an old forked version of jsmn,
> > and is challenging to work upon. A lot of jevents.c's complexity comes
> > from needing to write json and csv parsing from first principles. In
> > contrast python has this functionality in standard libraries and is
> > already a build pre-requisite for tools like asciidoc (that builds all
> > of the perf man pages).
>
>
> Well I was still hoping at some point we could have run time loading of
> events. But yes if that's not
>
> happening then this probably the right approach.

Thanks Andi, some thinking out loud below:

The perf tool already discovers events from sysfs, so could we have
runtime loading by turning the sysfs mount point into a list of
directories?

I'm thinking that for consistency the jevents API inside of the perf
code should look more like sysfs. There's then a question of how we
resolve events, perhaps we can have a config value something like
"sysfs,runtime=/home/me/my-events,jevents" where we treat the list as
setting up something like a unionfs in the tool. So if you ask for
instructions.retired, the tool would first check sysfs, then any
runtime events specified sysfs like directories, then jevents (or a
different order if you set a different config value). If the event is
defined more than once for the same PMU then the ordering says which
one has priority. If a PMU isn't specified for an event then we search
all PMUs and for jevents you'd only see PMUs relevant to the cpuid(s).

I'm hoping something like this will allow hybrid to work without all
the "if...hybrid" code that's getting added, and with a behavior
that's obvious and will allow us to debug errors. Maybe a runtime
sysfs like directory implies too many files so we could make a json
file to replace that directory, or use a zip file, etc. I'd prefer it
if the mappings were as 1-to-1 as possible (ie have a new json format
whose structure matches sysfs) and so I wouldn't like to use the
current jevents.c code for it.

Thanks,
Ian

> -Andi
>
>

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