Skip to content

Commit

Permalink
[feature] #4083: Add section about profiling into CONTRIBUTING.md
Browse files Browse the repository at this point in the history
Signed-off-by: Shanin Roman <[email protected]>
  • Loading branch information
Erigara committed Jan 23, 2024
1 parent 1254c19 commit ee6728e
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,44 @@ tokio-console http://127.0.0.1:5555

</details>

### Profiling

<details> <summary> Expand to learn ho to profile iroha. </summary> </details>

To optimize performance it's useful to profile iroha.

To do that you should compile iroha with `profiling` profile and with `wasm_profiling` compilation flag:

```bash
RUSTFLAGS="-C force-frame-pointers=on --cfg wasm_profiling"cargo build --profile profiling
```

Then start iroha and attach profiler of your choice to the iroha pid.

Alternatively it's possible to build iroha inside docker with profiler support and profile iroha this way.

```bash
docker build -f Dockerfile.glibc --build-arg="PROFILE=profiling" --build-arg='RUSTFLAGS=-C force-frame-pointers=on --cfg wasm_profiling' -t iroha2:profiling .
```

E.g. using perf (available only on linux):

```bash
# to capture profile
sudo perf record -g -p <PID>
# to analyze profile
sudo perf report
```

It's also possible to profile iroha's wasm executor to do then unstriped version should be provided.

```bash
# compile executor without optimizations
cargo run --bin iroha_wasm_builder_cli -- build ./peth/to/executor --outfile executor.wasm
```

</details>

## Style Guides

Please follow these guidelines when you make code contributions to our project:
Expand Down

0 comments on commit ee6728e

Please sign in to comment.