mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-08-01 13:37:48 +00:00
Add samply to sampling options
Add samply to the sampling options for `rm` benchmarking.
This commit is contained in:
parent
76eea583b4
commit
181261beef
1 changed files with 18 additions and 10 deletions
|
@ -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.
|
- 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`
|
- 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`:
|
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]
|
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
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue