comphead commented on code in PR #13299: URL: https://github.com/apache/datafusion/pull/13299#discussion_r1833597399
########## docs/source/library-user-guide/profiling.md: ########## @@ -34,31 +32,47 @@ in images such as this:  -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 Review Comment: oh we renamed that -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org