From 3ab22d5d1358f82d57ebe0635e4aa7c57c60bcd4 Mon Sep 17 00:00:00 2001 From: Alessio Podda Date: Mon, 2 Dec 2024 07:44:07 +0000 Subject: [PATCH] Update CPU profiling using perf --- CPU-profiling-using-perf.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/CPU-profiling-using-perf.md b/CPU-profiling-using-perf.md index 42b0d7e..efcca9b 100644 --- a/CPU-profiling-using-perf.md +++ b/CPU-profiling-using-perf.md @@ -15,14 +15,14 @@ sudo dnf install perf flamegraph Replace calls to `inferno` with `flamegraph.pl` if necessary. - 1. *Optional* Enable profiling without `root` access: + 2. *Optional* Enable profiling without `root` access: ```sh echo -1 | sudo tee /proc/sys/kernel/perf_event_paranoid echo 0 | sudo tee /proc/sys/kernel/nmi_watchdog ``` - 1. Ensure you have compiled `named` with debug symbols. Optionally, set up a prefix + 3. Ensure you have compiled `named` with debug symbols. Optionally, set up a prefix ```sh cd ~/Path/to/bind9/checkout @@ -30,13 +30,13 @@ cd ~/Path/to/bind9/checkout make clean && make ``` - 2. Install `named`. Normally `libtool` runs `named` through a wrapper shell script that can make perf results more difficult to read. + 4. Install `named`. Normally `libtool` runs `named` through a wrapper shell script that can make perf results more difficult to read. ```sh make install ``` - 3. Run `named` under `perf`. + 5. Run `named` under `perf`. ```sh perf record --compression-level=1 --user-callchains -g --call-graph=dwarf,65528 -e cycles:ppp --output=$OUTPUT_FILE -- $YOUR_NAMED_CMDLINE_GOES_HERE ``` @@ -54,7 +54,7 @@ perf record --compression-level=1 --user-callchains -g --call-graph=dwarf,65528 `--output=$OUTPUT_FILE` Name of the output file. Otherwise it defaults to perf.data. -4. Generate a flamegraph with `inferno`: +6. Generate a flamegraph with `inferno`: ```sh perf script --input=$INPUT_DATA | inferno-collapse-perf | inferno-flamegraph --width=1920 > $OUTPUT_SVG