From a5cf917892f31a7197ea9b58d2938f0cae3aaf9e Mon Sep 17 00:00:00 2001 From: Garret Rieger Date: Wed, 20 Apr 2022 22:31:26 +0000 Subject: [PATCH] [perf] Update readme with profiling instructions. --- perf/README.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/perf/README.md b/perf/README.md index f2fcb60be..c159338c7 100644 --- a/perf/README.md +++ b/perf/README.md @@ -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