diff --git a/cli/src/host_perf_check.rs b/cli/src/host_perf_check.rs index 23190e94712b..722deab7450b 100644 --- a/cli/src/host_perf_check.rs +++ b/cli/src/host_perf_check.rs @@ -23,6 +23,8 @@ use polkadot_performance_test::{ use std::time::Duration; pub fn host_perf_check() -> Result<(), PerfCheckError> { + let pvf_prepare_time_limit = time_limit_from_baseline(PVF_PREPARE_TIME_LIMIT); + let erasure_coding_time_limit = time_limit_from_baseline(ERASURE_CODING_TIME_LIMIT); let wasm_code = polkadot_performance_test::WASM_BINARY.ok_or(PerfCheckError::WasmBinaryMissing)?; @@ -32,19 +34,25 @@ pub fn host_perf_check() -> Result<(), PerfCheckError> { info!("Running the performance checks..."); - perf_check("PVF-prepare", PVF_PREPARE_TIME_LIMIT, || measure_pvf_prepare(code.as_ref()))?; + perf_check("PVF-prepare", pvf_prepare_time_limit, || measure_pvf_prepare(code.as_ref()))?; - perf_check("Erasure-coding", ERASURE_CODING_TIME_LIMIT, || { + perf_check("Erasure-coding", erasure_coding_time_limit, || { measure_erasure_coding(ERASURE_CODING_N_VALIDATORS, code.as_ref()) })?; Ok(()) } +/// Returns a no-warning threshold for the given time limit. fn green_threshold(duration: Duration) -> Duration { duration * 4 / 5 } +/// Returns an extended time limit to be used for the actual check. +fn time_limit_from_baseline(duration: Duration) -> Duration { + duration * 3 / 2 +} + fn perf_check( test_name: &str, time_limit: Duration,