From 67b54fbf073c2238d1b05eea679cb726fcf77315 Mon Sep 17 00:00:00 2001 From: comphead Date: Wed, 20 Mar 2024 12:58:50 -0700 Subject: [PATCH] Comments --- docs/source/library-user-guide/profiling.md | 25 +++++++++++---------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/docs/source/library-user-guide/profiling.md b/docs/source/library-user-guide/profiling.md index c34c96a99e12..a20489496f0c 100644 --- a/docs/source/library-user-guide/profiling.md +++ b/docs/source/library-user-guide/profiling.md @@ -17,13 +17,7 @@ under the License. --> - - -# Profiling +# Profiling Cookbook The section contains examples how to perform CPU profiling for Apache Arrow DataFusion on different operating systems. @@ -32,13 +26,20 @@ The section contains examples how to perform CPU profiling for Apache Arrow Data ### Building a flamegraph - [cargo-flamegraph](https://github.com/flamegraph-rs/flamegraph) - Example: + +Test: + +```bash +CARGO_PROFILE_RELEASE_DEBUG=true cargo flamegraph --root --unit-test datafusion -- dataframe::tests::test_array_agg +``` + +Benchmark: ```bash -CARGO_PROFILE_RELEASE_DEBUG=true cargo flamegraph --root --unit-test datafusion -- dataframe::tests::test_xxx +CARGO_PROFILE_RELEASE_DEBUG=true cargo flamegraph --root --bench sql_planner -- --bench ``` -Open SVG file with the browser +Open `flamegraph.svg` file with the browser - dtrace with DataFusion CLI @@ -51,9 +52,9 @@ sudo dtrace -c './target/debug/datafusion-cli -f test.sql' -o out.stacks -n 'pro /tmp/fg/FlameGraph/stackcollapse.pl out.stacks | /tmp/fg/FlameGraph/flamegraph.pl > flamegraph.svg ``` -Open SVG file with the browser +Open `flamegraph.svg` file with the browser -### CPU profiling +### CPU profiling with XCode Instruments [Video: how to CPU profile DataFusion with XCode Instruments](https://youtu.be/P3dXH61Kr5U)