1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-29 03:57:44 +00:00

Add samply to sampling options

Add samply to the sampling options for `rm` benchmarking.
This commit is contained in:
Ben Schofield 2023-08-22 07:56:24 -07:00
parent 76eea583b4
commit 181261beef

View file

@ -33,7 +33,24 @@ hyperfine --prepare "cp -r $test_dir tmp_d" "rm -rf tmp_d" "target/release/core
- Another thing to look at would be system calls count using strace (on linux) or equivalent on other operating systems.
- Example: `strace -c target/release/coreutils rm -rf tree`
## Cargo Flamegraph
## Flamegraphs
### Samply
Samply is one option for simply creating flamegraphs. It isues the Firefox profiler as a UI.
To install:
```bash
cargo install samply
```
To run:
```bash
samply record target/release/coreutils rm -rf ../linux
```
### Cargo Flamegraph
With Cargo Flamegraph you can easily make a flamegraph of `rm`:
@ -41,12 +58,3 @@ With Cargo Flamegraph you can easily make a flamegraph of `rm`:
cargo flamegraph --cmd coreutils -- rm [additional parameters]
```
However, if the `-r` option is given, the output becomes pretty much useless due to recursion. We can fix this by merging all the direct recursive calls with `uniq`, below is a `bash` script that does this.
```shell
#!/bin/bash
cargo build --release --no-default-features --features rm
perf record target/release/coreutils rm "$@"
perf script | uniq | inferno-collapse-perf | inferno-flamegraph > flamegraph.svg
```