summaryrefslogtreecommitdiff
path: root/cli/tools/bench
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tools/bench')
-rw-r--r--cli/tools/bench/mod.rs3
-rw-r--r--cli/tools/bench/reporters.rs4
2 files changed, 7 insertions, 0 deletions
diff --git a/cli/tools/bench/mod.rs b/cli/tools/bench/mod.rs
index 247422f71..d876c2504 100644
--- a/cli/tools/bench/mod.rs
+++ b/cli/tools/bench/mod.rs
@@ -106,6 +106,7 @@ pub struct BenchDescription {
}
#[derive(Debug, Clone, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
pub struct BenchStats {
pub n: u64,
pub min: f64,
@@ -115,6 +116,8 @@ pub struct BenchStats {
pub p99: f64,
pub p995: f64,
pub p999: f64,
+ pub high_precision: bool,
+ pub used_explicit_timers: bool,
}
impl BenchReport {
diff --git a/cli/tools/bench/reporters.rs b/cli/tools/bench/reporters.rs
index 6b1e885a9..68788bc96 100644
--- a/cli/tools/bench/reporters.rs
+++ b/cli/tools/bench/reporters.rs
@@ -236,6 +236,10 @@ impl BenchReporter for ConsoleReporter {
)
);
+ if !stats.high_precision && stats.used_explicit_timers {
+ println!("{}", colors::yellow(format!("Warning: start() and end() calls in \"{}\" are ignored because it averages less\nthan 0.01s per iteration. Remove them for better results.", &desc.name)));
+ }
+
self.group_measurements.push((desc, stats.clone()));
}