|
21 | 21 |
|
22 | 22 | The section contains examples how to perform CPU profiling for Apache DataFusion on different operating systems. |
23 | 23 |
|
24 | | -## Building a flamegraph |
| 24 | +## Building a flame graph |
25 | 25 |
|
26 | 26 | [Video: how to CPU profile DataFusion with a Flamegraph](https://youtu.be/2z11xtYw_xs) |
27 | 27 |
|
@@ -82,6 +82,43 @@ CARGO_PROFILE_RELEASE_DEBUG=true cargo flamegraph --root --bench sql_planner -- |
82 | 82 |
|
83 | 83 | [Video: how to CPU profile DataFusion with XCode Instruments](https://youtu.be/P3dXH61Kr5U) |
84 | 84 |
|
85 | | -## Linux |
| 85 | +## Profiling using Samply cross platform profiler |
86 | 86 |
|
87 | | -## Windows |
| 87 | +There is an opportunity to build flamegraphs, call trees and stack charts on any platform using |
| 88 | +[Samply](https://github.com/mstange/samply) |
| 89 | + |
| 90 | +Install Samply profiler |
| 91 | + |
| 92 | +```shell |
| 93 | +cargo install --locked samply |
| 94 | +``` |
| 95 | + |
| 96 | +More Samply [installation options](https://github.com/mstange/samply?tab=readme-ov-file#installation) |
| 97 | + |
| 98 | +Run the profiler |
| 99 | + |
| 100 | +```shell |
| 101 | +samply record --profile profiling ./my-application my-arguments |
| 102 | +``` |
| 103 | + |
| 104 | +### Profile the benchmark |
| 105 | + |
| 106 | +[Set up benchmarks](https://github.com/apache/datafusion/blob/main/benchmarks/README.md#running-the-benchmarks) if not yet done |
| 107 | + |
| 108 | +Example: Profile Q22 query from TPC-H benchmark. |
| 109 | +Note: `--profile profiling` to profile release optimized artifact with debug symbols |
| 110 | + |
| 111 | +```shell |
| 112 | +cargo build --profile profiling --bin tpch |
| 113 | +samply record ./target/profiling/tpch benchmark datafusion --iterations 5 --path datafusion/benchmarks/data/tpch_sf10 --prefer_hash_join true --format parquet -o datafusion/benchmarks/results/dev2/tpch_sf10.json --query 22 |
| 114 | +``` |
| 115 | + |
| 116 | +After sampling has completed the Samply starts a local server and navigates to the profiler |
| 117 | + |
| 118 | +```shell |
| 119 | +Local server listening at http://127.0.0.1:3000 |
| 120 | +``` |
| 121 | + |
| 122 | + |
| 123 | + |
| 124 | +Note: The Firefox profiler cannot be opened in Safari, please use Chrome or Firefox instead |
0 commit comments