You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "alamb (via GitHub)" <gi...@apache.org> on 2024/03/20 17:14:21 UTC

Re: [PR] doc: Add DataFusion profiling documentation for MacOS [arrow-datafusion]

alamb commented on code in PR #9711:
URL: https://github.com/apache/arrow-datafusion/pull/9711#discussion_r1532494684


##########
docs/source/library-user-guide/profiling.md:
##########
@@ -0,0 +1,62 @@
+<!---
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+
+<!---
+This file was generated by the dev/update_config_docs.sh script.
+Do not edit it manually as changes will be overwritten.
+Instead, edit dev/update_config_docs.sh or the docstrings in datafusion/core/src/config.rs.
+-->
+
+# Profiling
+
+The section contains examples how to perform CPU profiling for Apache Arrow DataFusion on different operating systems.
+
+## MacOS
+
+### Building a flamegraph
+
+- [cargo-flamegraph](https://github.com/flamegraph-rs/flamegraph)
+  Example:
+
+```bash
+CARGO_PROFILE_RELEASE_DEBUG=true cargo flamegraph --root --unit-test datafusion  -- dataframe::tests::test_xxx

Review Comment:
   I wonder if this example could be made more realistic (like can we have to run `cargo bench --bench sql_planner`)?



##########
docs/source/library-user-guide/profiling.md:
##########
@@ -0,0 +1,62 @@
+<!---
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+
+<!---
+This file was generated by the dev/update_config_docs.sh script.
+Do not edit it manually as changes will be overwritten.
+Instead, edit dev/update_config_docs.sh or the docstrings in datafusion/core/src/config.rs.
+-->
+
+# Profiling
+
+The section contains examples how to perform CPU profiling for Apache Arrow DataFusion on different operating systems.
+
+## MacOS
+
+### Building a flamegraph
+
+- [cargo-flamegraph](https://github.com/flamegraph-rs/flamegraph)
+  Example:
+
+```bash
+CARGO_PROFILE_RELEASE_DEBUG=true cargo flamegraph --root --unit-test datafusion  -- dataframe::tests::test_xxx
+```
+
+Open SVG file with the browser
+
+- dtrace with DataFusion CLI
+
+```bash
+git clone https://github.com/brendangregg/FlameGraph.git /tmp/fg

Review Comment:
   This is quite neat -- I did not know how to do this



##########
docs/source/library-user-guide/profiling.md:
##########
@@ -0,0 +1,62 @@
+<!---
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+
+<!---
+This file was generated by the dev/update_config_docs.sh script.
+Do not edit it manually as changes will be overwritten.
+Instead, edit dev/update_config_docs.sh or the docstrings in datafusion/core/src/config.rs.
+-->
+
+# Profiling
+
+The section contains examples how to perform CPU profiling for Apache Arrow DataFusion on different operating systems.
+
+## MacOS
+
+### Building a flamegraph
+
+- [cargo-flamegraph](https://github.com/flamegraph-rs/flamegraph)
+  Example:
+
+```bash
+CARGO_PROFILE_RELEASE_DEBUG=true cargo flamegraph --root --unit-test datafusion  -- dataframe::tests::test_xxx
+```
+
+Open SVG file with the browser
+
+- dtrace with DataFusion CLI
+
+```bash
+git clone https://github.com/brendangregg/FlameGraph.git /tmp/fg
+cd datafusion-cli
+CARGO_PROFILE_RELEASE_DEBUG=true cargo build --release
+echo "select * from table;" >> test.sql
+sudo dtrace -c './target/debug/datafusion-cli -f test.sql' -o out.stacks -n 'profile-997 /execname == "datafusion-cli"/ { @[ustack(100)] = count(); }'
+/tmp/fg/FlameGraph/stackcollapse.pl out.stacks | /tmp/fg/FlameGraph/flamegraph.pl > flamegraph.svg
+```
+
+Open SVG file with the browser
+
+### CPU profiling

Review Comment:
   ```suggestion
   ### CPU profiling with Instruments / XCode
   ```



##########
docs/source/library-user-guide/profiling.md:
##########
@@ -0,0 +1,62 @@
+<!---
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+
+<!---
+This file was generated by the dev/update_config_docs.sh script.

Review Comment:
   this comment seems like it may be left over / a copy paste error



##########
docs/source/library-user-guide/profiling.md:
##########
@@ -0,0 +1,62 @@
+<!---
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+
+<!---
+This file was generated by the dev/update_config_docs.sh script.
+Do not edit it manually as changes will be overwritten.
+Instead, edit dev/update_config_docs.sh or the docstrings in datafusion/core/src/config.rs.
+-->
+
+# Profiling

Review Comment:
   ```suggestion
   # Profiling Cookbook
   ```



-- 
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-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org