[perf] Update readme with profiling instructions.

This commit is contained in:
Garret Rieger 2022-04-20 22:31:26 +00:00 committed by Behdad Esfahbod
parent df3ecea773
commit a5cf917892
1 changed files with 21 additions and 0 deletions

View File

@ -1,3 +1,5 @@
# Building and Running
Benchmarks are implemented using [Google Benchmark](https://github.com/google/benchmark).
To build the benchmarks in this directory you need to set the benchmark
@ -22,3 +24,22 @@ Finally, to run one of the benchmarks:
It's possible to filter the benchmarks being run and customize the output
via flags to the benchmark binary. See the
[Google Benchmark User Guide](https://github.com/google/benchmark/blob/main/docs/user_guide.md#user-guide) for more details.
# Profiling
Configure the build to include debug information for profiling:
```
CXXFLAGS="-fno-omit-frame-pointer" meson --reconfigure build -Dbenchmark=enabled --buildtype=debug
```
Then run the benchmark with perf:
```
perf record -g -o ~/tmp/profiles/subset.prof ./build/perf/benchmark-subset --benchmark_filter="BM_subset_codepoints/subset_notocjk/100000" --benchmark_repetitions=5
```
You probably want to filter to a specific benchmark of interest and set the number of repititions high enough to get a good sampling of profile data.
Finally view the profile with:
perf report -i ~/tmp/profiles/subset.prof