https://github.com/cirocosta/perfer
A wrapper on top of `perf` and `flamegraphs` to generate flamegraphs on demand.
https://github.com/cirocosta/perfer
flamegraph golang linux perf
Last synced: 11 months ago
JSON representation
A wrapper on top of `perf` and `flamegraphs` to generate flamegraphs on demand.
- Host: GitHub
- URL: https://github.com/cirocosta/perfer
- Owner: cirocosta
- License: mit
- Created: 2018-11-09T15:04:42.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-03-13T18:18:55.000Z (almost 7 years ago)
- Last Synced: 2025-02-10T11:51:13.173Z (about 1 year ago)
- Topics: flamegraph, golang, linux, perf
- Language: Go
- Homepage:
- Size: 13.7 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.txt
- License: LICENSE
Awesome Lists containing this project
README
A wrapper on top of `perf` and `flamegraphs` to generate flamegraphs on demand.
RATIONALE
pprof[1] is great for a user to understand what's going under
the hood of a particular golang application, but it limits
its reach to the userspace.
perf[2] + flamegraph[3] gives us a deeper view into how the
kernel is seeing the execution of a given process (or set
of them).
By providing an agent that can perform such analysis, we're
able to mimic the greatness of pprof: providing a known
endpoint which a remote user can use to gather insights
about the runtime behavior of an application.
[1]: https://golang.org/pkg/runtime/pprof/
[2]: http://man7.org/linux/man-pages/man1/perf.1.html
[3]: https://github.com/brendangregg/FlameGraph
USAGE
Run the server in a given machine you want to analyze:
perfer --addr=:1313
Create a flamegraph that samples all procs:
curl machine_ip:1313/flamegraph?freq=99&seconds=10'
Create a flamegraph that samples a specific pid:
curl machine_ip:1313/flamegraph?freq=99&seconds=10&pid=3212'
DEPENDENCIES
- perf
- flamegrapudo
- kallsyms available
API
GET /profile?pid=$PID&freq=$FREQ&seconds=$SECONDS
Performs the capture and streams back in tgz the `perf script`
results (after a record happens) so that further processing can
be performed by the user.
If no `PID` specified, all of processes get sampled.
GET /flamegraph?pid=$PID&freq=$FREQ&seconds=$SECONDS
Performs the capture and then returns a URL where a given
flamegraph.svg is served, allowing the user to share it.
If no `PID` specified, all of processes get sampled.
GET /static/
Retrieves the contents stored under the configured assets
directory (this is where profiles and framegraphs get saved).