This is an automated email from the ASF dual-hosted git repository.

comphead pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion.git


The following commit(s) were added to refs/heads/main by this push:
     new f190fc6de6 feat: Updating flamegraph docs (#13299)
f190fc6de6 is described below

commit f190fc6de6a6171c1cd6aa99233bc647ed8b1377
Author: Jonathan Chen <[email protected]>
AuthorDate: Thu Nov 7 20:55:13 2024 -0500

    feat: Updating flamegraph docs (#13299)
    
    * Updating flamegraph
---
 docs/source/library-user-guide/profiling.md | 34 ++++++++++++++++++++---------
 1 file changed, 24 insertions(+), 10 deletions(-)

diff --git a/docs/source/library-user-guide/profiling.md 
b/docs/source/library-user-guide/profiling.md
index 179c852de3..02f6958d17 100644
--- a/docs/source/library-user-guide/profiling.md
+++ b/docs/source/library-user-guide/profiling.md
@@ -21,8 +21,6 @@
 
 The section contains examples how to perform CPU profiling for Apache 
DataFusion on different operating systems.
 
-## MacOS
-
 ### Building a flamegraph
 
 [Video: how to CPU profile DataFusion with a 
Flamegraph](https://youtu.be/2z11xtYw_xs)
@@ -34,31 +32,47 @@ in images such as this:
 
 ![Flamegraph](../_static/images/flamegraph.svg)
 
-To create a flamegraph, you need to install the `flamegraph` tool:
+## MacOS
+
+#### Step 1: Install the flamegraph Tool
+
+To install flamegraph, run:
 
 ```shell
 cargo install flamegraph
 ```
 
-Then you can run the flamegraph tool with the `--` separator to pass arguments
-to the binary you want to profile.
+#### Step 2: Prepare Your Environment
+
+Ensure that you're in the directory containing the necessary data files for 
your DataFusion query. The flamegraph tool will profile the execution of your 
query against this data.
+
+#### Step 3: Running the Flamegraph Tool
+
+To generate a flamegraph, you'll need to use the -- separator to pass 
arguments to the binary you're profiling. For datafusion-cli, you need to make 
sure to run the command with sudo permissions (especially on macOS, where 
DTrace requires elevated privileges).
+
+Here is a general example:
+
+```shell
+sudo flamegraph -- datafusion-cli -f <path_to_sql_file/sql_file.sql>
+```
+
+#### Example: Generating a Flamegraph for a Specific Query
 
-Example: Flamegraph for `datafusion-cli` executing `q28.sql`. Note this
-must be run as root on Mac OSx to access DTrace.
+Here is an example using `28.sql`:
 
 ```shell
-sudo flamegraph -- datafusion-cli -f q28.sql
+sudo flamegraph -- datafusion-cli -f 28.sql
 ```
 
 You can also invoke the flamegraph tool with `cargo` to profile a specific 
test or benchmark.
 
-Example: Flamegraph for a specific test:
+#### Example: Flamegraph for a specific test:
 
 ```bash
 CARGO_PROFILE_RELEASE_DEBUG=true cargo flamegraph --root --unit-test 
datafusion  -- dataframe::tests::test_array_agg
 ```
 
-Example: Flamegraph for a benchmark
+#### Example: Flamegraph for a benchmark
 
 ```bash
 CARGO_PROFILE_RELEASE_DEBUG=true cargo flamegraph --root --bench sql_planner 
-- --bench


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to