Closed vavrusa closed 8 years ago
Is this something you're considering or not at all? It's groundworks, but I'd really like to merge friendlier interface[1] when the foundations are done.
[1] i.e. statically compiled event readers have to make wild guesses (section "Usage examples") about how probe ABI looks like, with LJ we can parse the format and turn it into ctype on runtime, that'd be really cool
Sorry, I forgot to look at it again, looks like a good start, will experiment with it a bit too.
This PR implements perf_event_open(2) and a higher level API. It also creates a perf reader metatype as a high-level interface modelled after perf(1) and libbpf perf reader interface.
struct perf_attr
struct perf_attr
for easy filling (strflag conversions)read(2)
andmmap(2)
interfacesmmap(2)
sampling interface, it can read events off ringbuffer with standardipairs()
I'm not adding perf event ABI dissectors here because it's (a) really complicated and unstable and (b) events have variable sizes, so generic parser may be cost-prohibitive. Caller gets standard event header that contains event type, size and raw contents. I'll probably work on parsing code for more complicated event types, but as a separate PR.