mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-08-02 05:57:46 +00:00
ls: document flamegraph
This commit is contained in:
parent
7dcc8c2960
commit
322478d9a2
1 changed files with 16 additions and 0 deletions
|
@ -32,3 +32,19 @@ This can also be used to compare with version of ls built before your changes to
|
||||||
|
|
||||||
- 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 ls -al -R tree`
|
- Example: `strace -c target/release/coreutils ls -al -R tree`
|
||||||
|
|
||||||
|
## Cargo Flamegraph
|
||||||
|
|
||||||
|
With Cargo Flamegraph you can easily make a flamegraph of `ls`:
|
||||||
|
```bash
|
||||||
|
cargo flamegraph --cmd coreutils -- ls [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.
|
||||||
|
```bash
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
cargo build --release --no-default-features --features ls
|
||||||
|
perf record target/release/coreutils ls "$@"
|
||||||
|
perf script | uniq | inferno-collapse-perf | inferno-flamegraph > flamegraph.svg
|
||||||
|
```
|
Loading…
Add table
Add a link
Reference in a new issue