Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set response time percentile precision to 3 decimal places #29

Merged
merged 1 commit into from
Jan 6, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/report.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ where
/// Unit of measurement
pub unit: String,
/// 1 means the more of the quantity the better, -1 means the more of it the worse, 0 is neutral
pub goodness: i8,
pub orientation: i8,
/// First object to measure
pub v1: V,
/// Second object to measure
Expand All @@ -274,11 +274,11 @@ where
V: Copy,
F: Fn(V) -> M,
{
fn new(label: String, unit: String, goodness: i8, v1: V, v2: Option<V>, f: F) -> Self {
fn new(label: String, unit: String, orientation: i8, v1: V, v2: Option<V>, f: F) -> Self {
Line {
label,
unit,
goodness,
orientation,
v1,
v2,
significance: None,
Expand All @@ -290,8 +290,8 @@ where
Box::new(self)
}

fn with_orientation(mut self, goodness: i8) -> Self {
self.goodness = goodness;
fn with_orientation(mut self, orientation: i8) -> Self {
self.orientation = orientation;
self
}

Expand Down Expand Up @@ -365,7 +365,7 @@ where
unit = style(self.fmt_unit()).yellow(),
m1 = pad_str(m1.as_str(), 30, Alignment::Left, None),
m2 = pad_str(m2.as_str(), 30, Alignment::Left, None),
cmp = self.fmt_relative_change(self.goodness, is_significant),
cmp = self.fmt_relative_change(self.orientation, is_significant),
signif = match &self.significance {
Some(s) => format!("{}", s),
None => "".to_owned(),
Expand Down Expand Up @@ -668,7 +668,7 @@ impl<'a> Display for BenchmarkCmp<'a> {
.resp_time_ms
.as_ref()
.map(|rt| rt.percentiles[*p as usize]);
Quantity::from(rt)
Quantity::from(rt).with_precision(3)
})
.with_orientation(-1)
.with_significance(self.cmp_resp_time_percentile(*p));
Expand Down