Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
x/sys/linux/perf: add package for Linux perf tracing #24918
Linux ships with a robust suite of performance counters and samplers accessed via the perf_event_open system call.
Recent changes to x/sys/unix make it possible to call perf_event_open from Go, but using the perf events system correctly is notoriously hard.
Having recently implemented a wrapper for perf events in Go, I would like to generalize and contribute it upstream.
As regards the code location: x/sys/windows seems to have specialized subpackages, so maybe similar structure under x/sys/unix would work.
This would be wonderful, though getting the API right will be tricky.
If it's any help, I have an implementation of the perf events API for internal use in the runtime in CL 77651 and a more user-friendly API for reading perf.data files here. The latter doesn't support
Also relevant: #21295.
changed the title
proposal: x/sys/unix/perf: performance tracing using the Linux perf support
Jul 16, 2018
I have been working on this issue for the last couple of weeks. I have built a working perf package, which covers a large portion of the perf API surface. I'm going to abandon https://golang.org/cl/160097, and send a new CL, with working code, that can be tested and used.
I am hoping that a CL with actual documentation and working code might be easier to review and get feedback on than the previous API sketch. Please take a look.
After also implementing yet another library my experience has been that it becomes extremely tricky to get meaningful data at the goroutine level due to the runtime (which is generally what everyone wants). Yes, you can call