Re: [RFC PATCH 2/5] perf jevents: add support for arch recommended events

From: Andi Kleen
Date: Tue Jan 02 2018 - 12:48:29 EST


> Can you describe how you autogenerate the JSONs? Do you have some internal
> proprietary HW file format describing events, with files supplied from HW
> designer, which you can just translate into a JSON? Would the files support
> deferencing events to improve scalability?

For Intel JSON is an official format, which is maintained for each CPU.
It is automatically generated from an internal database
https://download.01.org/perfmon/

I have some python scripts to convert these Intel JSONs into the perf
format (which has some additional headers, and is split into
different categories, and add metrics).

They have some Intel specifics, so may not be useful for you.

There's no support for dereference, each CPU gets its own unique file.

But you could do the a merge simply with the attached script which merges
two JSON files.

-Andi
#!/usr/bin/python
# merge json event files
# merge-json file1.json file2... > merged.json
import sys
import json

all = []

for fn in sys.argv[1:]:
jf = json.load(open(fn))
for n in jf:
all.append(n)

print json.dumps(all, sort_keys=True, indent=4, separators=(',', ': '))