justincormack / ljsyscall

LuaJIT Unix syscall FFI
http://www.myriabit.com/ljsyscall/
Other
440 stars 54 forks source link

linux: performance monitoring API #191

Closed vavrusa closed 8 years ago

vavrusa commented 8 years ago

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.

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.

vavrusa commented 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

justincormack commented 8 years ago

Sorry, I forgot to look at it again, looks like a good start, will experiment with it a bit too.