Skip to content

Commit

Permalink
doc: add instructions for coz in README
Browse files Browse the repository at this point in the history
  • Loading branch information
alxiong committed Jun 15, 2023
1 parent c53ae91 commit 6810e0e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Cargo.lock
.pre-commit-config.yaml
.vscode
**/*flamegraph*
**/*.coz

# Test coverage (grcov)
default.profraw
Expand Down
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,3 +151,21 @@ cargo flamegraph --root -o path/to/wasm-flamegraph.svg --bench=plonk-benches --n
# profile a specific test
cargo flamegraph --root --unit-test -p jf-primitives -- pcs::univariate_kzg::tests::end_to_end_test
```

You can also perform _causal profiling_ using [coz](https://github.com/plasma-umass/coz) only on Linux systems.

``` bash
# build the bench or example or binary that you want to profile
cargo build --bench reed-solomon-coz --features profiling --release

# you can find the binary inside ./target/<mode>/deps/<name>-<hash>
coz run --- ./target/release/deps/reed_solomon_coz-db5107103a0e378c

# plot your result
coz plot

# alternatively, view your profile.coz on https://plasma-umass.org/coz/
```

As an example, you can view `./primitives/src/reed_solomon_code/mod.rs::read_solomon_erasure_decode()` for some sample usages of `coz` annotation for latency profiling; view `./primitives/benches/reed_solomon_coz.rs` for the benchmark code.
You could also conduct throughput profiling, read more [here](https://github.com/plasma-umass/coz/tree/master/rust).
2 changes: 1 addition & 1 deletion primitives/benches/reed_solomon_coz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const N: usize = 2048;
const N_HALF: usize = 1024;
// run it many times so coz will be triggered enough times
// see: <https://github.com/plasma-umass/coz/issues/158#issuecomment-708507510>
const ITERATIONS: usize = 2_000_000_000;
const ITERATIONS: usize = 100;

fn main() {
coz::thread_init();
Expand Down

0 comments on commit 6810e0e

Please sign in to comment.