mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-29 14:57:56 +00:00
Add DB Read/Write Tracking to Benchmarking Pipeline (#6386)
* initial mockup * add and wipe * track writes * start to add to pipeline * return all reads/writes * Log reads and writes from bench db * causes panic * Allow multiple commits * commit before ending benchmark * doesn't work??? * fix * Update lib.rs * switch to struct for `BenchmarkResults` * add to output * fix test * line width * @kianenigma review * Add Whitelist to DB Tracking in Benchmarks Pipeline (#6405) * hardcoded whitelist * Add whitelist to pipeline * Remove whitelist pipeline from CLI, add to runtime * clean-up unused db initialized whitelist * Add regression analysis to DB Tracking (#6475) * Add selector * add tests * debug formatter for easy formula * Update client/db/src/bench.rs Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> Co-authored-by: arkpar <arkady.paronyan@gmail.com> Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
This commit is contained in:
@@ -44,7 +44,16 @@ pub struct BenchmarkBatch {
|
||||
/// Results from running benchmarks on a FRAME pallet.
|
||||
/// Contains duration of the function call in nanoseconds along with the benchmark parameters
|
||||
/// used for that benchmark result.
|
||||
pub type BenchmarkResults = (Vec<(BenchmarkParameter, u32)>, u128, u128);
|
||||
#[derive(Encode, Decode, Default, Clone, PartialEq, Debug)]
|
||||
pub struct BenchmarkResults {
|
||||
pub components: Vec<(BenchmarkParameter, u32)>,
|
||||
pub extrinsic_time: u128,
|
||||
pub storage_root_time: u128,
|
||||
pub reads: u32,
|
||||
pub repeat_reads: u32,
|
||||
pub writes: u32,
|
||||
pub repeat_writes: u32,
|
||||
}
|
||||
|
||||
sp_api::decl_runtime_apis! {
|
||||
/// Runtime api for benchmarking a FRAME runtime.
|
||||
@@ -83,6 +92,20 @@ pub trait Benchmarking {
|
||||
fn commit_db(&mut self) {
|
||||
self.commit()
|
||||
}
|
||||
|
||||
/// Get the read/write count
|
||||
fn read_write_count(&self) -> (u32, u32, u32, u32) {
|
||||
self.read_write_count()
|
||||
}
|
||||
|
||||
/// Reset the read/write count
|
||||
fn reset_read_write_count(&mut self) {
|
||||
self.reset_read_write_count()
|
||||
}
|
||||
|
||||
fn set_whitelist(&mut self, new: Vec<Vec<u8>>) {
|
||||
self.set_whitelist(new)
|
||||
}
|
||||
}
|
||||
|
||||
/// The pallet benchmarking trait.
|
||||
@@ -106,6 +129,7 @@ pub trait Benchmarking<T> {
|
||||
highest_range_values: &[u32],
|
||||
steps: &[u32],
|
||||
repeat: u32,
|
||||
whitelist: &[Vec<u8>]
|
||||
) -> Result<Vec<T>, &'static str>;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user