Skip to content
This repository was archived by the owner on Aug 5, 2022. It is now read-only.

Commit b1ced6b

Browse files
authored
perf: attach perf to existing process (#15)
1 parent cff8229 commit b1ced6b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

performance.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ Let's assume we have compiled the above code using `swift build -c release` into
108108
```
109109
# Step 1: Record the stack frames with a 99 Hz sampling frequency
110110
sudo perf record -F 99 -g -- ./slow
111+
# Alternatively, to attach to an existing process use
112+
# sudo perf record -F 99 -g -p PID_OF_SLOW
113+
# or if you don't know the pid, you can try (assuming your binary name is "slow")
114+
# sudo perf record -F 99 -g -p $(pgrep slow)
111115
112116
# Step 2: Export the recording into `out.perf`
113117
sudo perf script > out.perf

0 commit comments

Comments
 (0)