mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 12:11:02 +00:00
[subsystem-benchmarks] Save results to json (#3829)
Here we add the ability to save subsystem benchmark results in JSON format to display them as graphs To draw graphs, CI team will use [github-action-benchmark](https://github.com/benchmark-action/github-action-benchmark). Since we are using custom benchmarks, we need to prepare [a specific data type](https://github.com/benchmark-action/github-action-benchmark?tab=readme-ov-file#examples): ``` [ { "name": "CPU Load", "unit": "Percent", "value": 50 } ] ``` Then we'll get graphs like this:  [A live page with graphs](https://benchmark-action.github.io/github-action-benchmark/dev/bench/) --------- Co-authored-by: ordian <write@reusable.software>
This commit is contained in:
+7
@@ -28,6 +28,7 @@ use polkadot_subsystem_bench::{
|
||||
},
|
||||
configuration::TestConfiguration,
|
||||
usage::BenchmarkUsage,
|
||||
utils::save_to_file,
|
||||
};
|
||||
use std::io::Write;
|
||||
|
||||
@@ -58,7 +59,13 @@ fn main() -> Result<(), String> {
|
||||
})
|
||||
.collect();
|
||||
println!("\rDone!{}", " ".repeat(BENCH_COUNT));
|
||||
|
||||
let average_usage = BenchmarkUsage::average(&usages);
|
||||
save_to_file(
|
||||
"charts/availability-recovery-regression-bench.json",
|
||||
average_usage.to_chart_json().map_err(|e| e.to_string())?,
|
||||
)
|
||||
.map_err(|e| e.to_string())?;
|
||||
println!("{}", average_usage);
|
||||
|
||||
// We expect no variance for received and sent
|
||||
|
||||
Reference in New Issue
Block a user