Skip to content

Commit

Permalink
docs(readme.md): add usage and update example
Browse files Browse the repository at this point in the history
Signed-off-by: Massimiliano Giovagnoli <me@maxgio.it>
  • Loading branch information
maxgio92 committed May 23, 2024
1 parent 78d9c48 commit 9d3a9cf
Showing 1 changed file with 34 additions and 7 deletions.
41 changes: 34 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# Yet Another Profiler
# Yap

Yet Another Profiler written in Go and eBPF

> This project is in **development** phase.
This is yet another low-overhead kernel-assisted sampling-based CPU time continuous profile. It does not need instrumentation in the profiled binary.
This is a low-overhead kernel-assisted sampling-based CPU time continuous profile. It does not need instrumentation in the profiled binary.

A simple sampling eBPF program attached to a timer collects:
- stack traces
Expand All @@ -29,9 +31,9 @@ The information about how much a specific stack has been sampled is tracked with

and made available to userspace, alongside the stack traces.

In userspace symbolization is made with frame instruction pointer addresses read from the map.
In userspace symbolization is made with frame instruction pointer addresses and the ELF symbol table.

Finally the information is extracted as percentage of profile time a stack trace has been executing.
Finally, the information is extracted as percentage of profile time a stack trace has been executing.

## Current limitations

Expand All @@ -41,8 +43,31 @@ Due to the current implementation there are some limitations on the supported bi

## Quickstart

## Usage

```
yap [--debug] --pid PID
Options:
-debug
Sets log level to debug
-pid int
The PID of the process
```

### Example

Considering a go program made it running in background:

```shell
go build -v -o myprogram
./myprogram &
[1] 95541
```

Let's profile it:

```shell
$ sudo yap --pid 95541
sudo yap --pid 95541
{"level":"info","message":"collecting data"}
^C{"level":"info","message":"terminating..."}
Residency Stack trace
Expand All @@ -65,7 +90,7 @@ make yap
make yap/bpf
```

## Thanks
## Credits

- Pixie:
- [pixie-demos/ebpf-profiler](https://github.com/pixie-io/pixie-demos/tree/main/ebpf-profiler)
Expand All @@ -74,4 +99,6 @@ make yap/bpf
- [samples/bpf/trace_event_user.c](https://github.com/torvalds/linux/blob/8f2c057754b25075aa3da132cd4fd4478cdab854/samples/bpf/trace_event_user.c)
- [samples/bpf/trace_event_kern.c](https://github.com/torvalds/linux/blob/8f2c057754b25075aa3da132cd4fd4478cdab854/samples/bpf/trace_event_kern.c)
- Brendan Gregg:
- [Linux eBPF Stack Trace Hack](https://www.brendangregg.com/blog/2016-01-18/ebpf-stack-trace-hack.html)
- [Linux eBPF Stack Trace Hack](https://www.brendangregg.com/blog/2016-01-18/ebpf-stack-trace-hack.html)
- Aqua Security
- [Tracee](https://github.com/aquasecurity/tracee)

0 comments on commit 9d3a9cf

Please sign in to comment.