From abfbfe85e1876e3839ddf4f257d63b20ddd2e45e Mon Sep 17 00:00:00 2001 From: Andy Grove Date: Thu, 16 May 2024 16:05:35 -0600 Subject: [PATCH] add sample output --- .../profiling_native_code.md | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/docs/source/contributor-guide/profiling_native_code.md b/docs/source/contributor-guide/profiling_native_code.md index 9cd6d5fa0..ec3349b2e 100644 --- a/docs/source/contributor-guide/profiling_native_code.md +++ b/docs/source/contributor-guide/profiling_native_code.md @@ -19,14 +19,14 @@ under the License. # Profiling Native Code -We use `cargo bench` to run benchmarks to measure the performance of individual operators and expressions +We use `cargo bench` to run benchmarks to measure the performance of individual operators and expressions and [cargo-flamegraph](https://github.com/flamegraph-rs/flamegraph) for profiling. ## Running micro benchmarks with cargo bench When implementing a new operator or expression, it is good practice to add a new microbenchmark under `core/benches`. -It is often easiest to copy an existing benchmark and modify it for the new operator or expression. It is also +It is often easiest to copy an existing benchmark and modify it for the new operator or expression. It is also necessary to add a new section to the `Cargo.toml` file, such as: ```toml @@ -35,7 +35,7 @@ name = "shuffle_writer" harness = false ``` -These benchmarks are useful when for comparing performance between releases or between feature branches and the +These benchmarks are useful when for comparing performance between releases or between feature branches and the main branch to help prevent regressions in performance when adding new features or fixing bugs. Individual benchmarks can be run by name with the following command. @@ -44,6 +44,18 @@ Individual benchmarks can be run by name with the following command. cargo bench shuffle_writer ``` +Here is some sample output from running this command. + +``` + Running benches/shuffle_writer.rs (target/release/deps/shuffle_writer-e37b59e37879cce7) +Gnuplot not found, using plotters backend +shuffle_writer/shuffle_writer + time: [2.0880 ms 2.0989 ms 2.1118 ms] +Found 9 outliers among 100 measurements (9.00%) + 3 (3.00%) high mild + 6 (6.00%) high severe +``` + ## Profiling with cargo-flamegraph Install cargo-flamegraph: @@ -52,7 +64,8 @@ Install cargo-flamegraph: cargo install flamegraph ``` -Follow the instructions in https://github.com/flamegraph-rs/flamegraph for your platform for running flamegraph. +Follow the instructions in [cargo-flamegraph](https://github.com/flamegraph-rs/flamegraph) for your platform for +running flamegraph. Here is a sample command for running `cargo-flamegraph` on MacOS. @@ -78,4 +91,4 @@ The generated flamegraph can now be opened in a browser that supports svg format Here is the flamegraph for this example: -![flamegraph](../_static/images/flamegraph.png) \ No newline at end of file +![flamegraph](../_static/images/flamegraph.png)