xref: /aosp_15_r20/external/harfbuzz_ng/perf/README.md (revision 2d1272b857b1f7575e6e246373e1cb218663db8a)
1# Building and Running
2
3Benchmarks are implemented using [Google Benchmark](https://github.com/google/benchmark).
4
5To build the benchmarks in this directory you need to set the benchmark
6option while configuring the build with meson:
7
8```
9meson build -Dbenchmark=enabled --buildtype=release
10```
11or:
12```
13meson build -Dbenchmark=enabled --buildtype=debugoptimized
14```
15
16
17Then build a specific benchmark binaries with ninja:
18```
19ninja -Cbuild perf/benchmark-set
20```
21or just build the whole project:
22```
23ninja -Cbuild
24```
25
26Finally, to run one of the benchmarks:
27
28```
29./build/perf/benchmark-set
30```
31
32It's possible to filter the benchmarks being run and customize the output
33via flags to the benchmark binary. See the
34[Google Benchmark User Guide](https://github.com/google/benchmark/blob/main/docs/user_guide.md#user-guide) for more details.
35
36# Profiling
37
38Configure the build to include debug information for profiling:
39
40```
41CXXFLAGS="-fno-omit-frame-pointer" meson --reconfigure build -Dbenchmark=enabled --buildtype=debug
42ninja -Cbuild
43```
44
45Then run the benchmark with perf:
46
47```
48perf record -g build/perf/benchmark-subset --benchmark_filter="BM_subset_codepoints/subset_notocjk/100000" --benchmark_repetitions=5
49```
50You 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.
51
52Finally view the profile with:
53
54perf report
55