feat(flamegraphs): Introduce Flamegraphs (#138)

* 🔥 flamegraphs

* 📝 flamegraph blog post :chain:

* client get_fee_history

* node get_fee_history

* errors: InvalidBaseGaseFee

* execution get_fee_history

* http rpc get_fee_history

* moc rpc get_fee_history and json file

* module add get_fee_history

* update exec

* test feehistory

* update execution with logging + better logic

* fee history config loader

* rust fmt client

* rustfmt node

* rustfmt error

* rustfmt execution

* rustfmt http and moc rpc

* rustfmt mod.rs

* fee history formating

* correct typos

* use env var

* InvalidGasUsedRatio error

* check gas used ratio

* remove logging

* Update execution/src/errors.rs

Co-authored-by: refcell.eth <abigger87@gmail.com>

* Update execution/src/execution.rs

Co-authored-by: refcell.eth <abigger87@gmail.com>

* adding block and payload errors

* using error

* handle error in test

* fix: evm panic on slot not found (#208)

* fixes, but test fails

* fix: cleanup and example (#210)

* clean up fee history

* bump time dep in chrono, thx dependabot

* add benches to pr

* sleep

* fmt 

* place benching behind a man flag

* cleanup flamegraphs

* cleanup

---------

Co-authored-by: SFYLL <santiagoflood@hotmail.fr>
Co-authored-by: SFYLL <39958632+SFYLL@users.noreply.github.com>
This commit is contained in:
refcell.eth 2023-03-13 18:12:44 -04:00 committed by GitHub
parent 5a32f30686
commit 3afa312776
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 518 additions and 0 deletions

View File

@ -3,6 +3,9 @@ name = "helios"
version = "0.2.0" version = "0.2.0"
edition = "2021" edition = "2021"
autobenches = false autobenches = false
exclude = [
"benches"
]
[workspace] [workspace]
members = [ members = [
@ -15,6 +18,9 @@ members = [
"helios-ts", "helios-ts",
] ]
[profile.bench]
debug = true
[dependencies] [dependencies]
client = { path = "./client" } client = { path = "./client" }
config = { path = "./config" } config = { path = "./config" }

View File

@ -191,6 +191,9 @@ Benchmarks are defined in the [benches](./benches/) subdirectory. They are built
To run all benchmarks, you can use `cargo bench`. To run a specific benchmark, you can use `cargo bench --bench <name>`, where `<name>` is one of the benchmarks defined in the [Cargo.toml](./Cargo.toml) file under a `[[bench]]` section. To run all benchmarks, you can use `cargo bench`. To run a specific benchmark, you can use `cargo bench --bench <name>`, where `<name>` is one of the benchmarks defined in the [Cargo.toml](./Cargo.toml) file under a `[[bench]]` section.
To learn more about [helios](https://github.com/a16z/helios) benchmarking and to view benchmark flamegraphs, view the [benchmark readme](./benches/README.md).
## Contributing ## Contributing
All contributions to Helios are welcome. Before opening a PR, please submit an issue detailing the bug or feature. When opening a PR, please ensure that your contribution builds on the nightly rust toolchain, has been linted with `cargo fmt`, and contains tests when applicable. All contributions to Helios are welcome. Before opening a PR, please submit an issue detailing the bug or feature. When opening a PR, please ensure that your contribution builds on the nightly rust toolchain, has been linted with `cargo fmt`, and contains tests when applicable.

18
benches/README.md Normal file
View File

@ -0,0 +1,18 @@
# Helios Benchmarking
Helios performance is measured using [criterion](https://github.com/bheisler/criterion.rs) for comprehensive statistics-driven benchmarking.
Benchmarks are defined in the [benches](./) subdirectory and can be run using the cargo `bench` subcommand (eg `cargo bench`). To run a specific benchmark, you can use `cargo bench --bench <name>`, where `<name>` is one of the benchmarks defined in the [Cargo.toml](./Cargo.toml) file under a `[[bench]]` section.
#### Flamegraphs
[Flamegraph](https://github.com/brendangregg/FlameGraph) is a powerful rust crate for generating profile visualizations, that is graphing the time a program spends in each function. Functions called during execution are displayed as horizontal rectangles with the width proportional to the time spent in that function. As the call stack grows (think nested function invocations), the rectangles are stacked vertically. This provides a powerful visualization for quickly understanding which parts of a codebase take up disproportionate amounts of time.
Check out Brendan Gregg's [Flame Graphs](http://www.brendangregg.com/flamegraphs.html) blog post if you're interested in learning more about flamegraphs and performance visualizations in general.
To generate a flamegraph for helios, you can use the `cargo flamegraph` subcommand. For example, to generate a flamegraph for the [`client`](./examples/client.rs) example, you can run:
```bash
cargo flamegraph --example client -o ./flamegraphs/client.svg
```

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 27 KiB