mirror of
https://github.com/sharkdp/hyperfine.git
synced 2026-11-02 01:00:31 +00:00
More simplifications
This commit is contained in:
1 parent
f7e6d7286f
commit
8ba632c954
5 files changed
+39
-51
No files matched your search
+7
-7
@@ -44,13 +44,13 @@ impl Exporter for CsvExporter {
|
||||
for res in results {
|
||||
let mut fields = vec![Cow::Borrowed(res.command.as_bytes())];
|
||||
for f in &[
|
||||
res.mean(),
|
||||
res.stddev().unwrap_or(0.0),
|
||||
res.median(),
|
||||
res.user_mean(),
|
||||
res.system_mean(),
|
||||
res.min(),
|
||||
res.max(),
|
||||
res.mean_wall_clock_time(),
|
||||
res.runs.stddev().unwrap_or(0.0),
|
||||
res.runs.median(),
|
||||
res.runs.user_mean(),
|
||||
res.runs.system_mean(),
|
||||
res.runs.min(),
|
||||
res.runs.max(),
|
||||
] {
|
||||
fields.push(Cow::Owned(
|
||||
f.format_with_precision(CSV_UNIT, CSV_PRECISION)
|
||||
|
||||
+8
-10
@@ -48,25 +48,23 @@ pub trait MarkupExporter {
|
||||
table.push_str(&self.table_divider(&cells_alignment));
|
||||
|
||||
for entry in entries {
|
||||
let measurement = &entry.result;
|
||||
let result = &entry.result;
|
||||
// prepare data row strings
|
||||
let cmd_str = measurement
|
||||
.command_with_unused_parameters()
|
||||
.replace('|', "\\|");
|
||||
let mean_str = format_duration_value(measurement.mean(), Some(unit)).0;
|
||||
let stddev_str = if let Some(stddev) = measurement.stddev() {
|
||||
let cmd_str = result.command_with_unused_parameters().replace('|', "\\|");
|
||||
let mean_str = format_duration_value(result.mean_wall_clock_time(), Some(unit)).0;
|
||||
let stddev_str = if let Some(stddev) = result.runs.stddev() {
|
||||
format!(" ± {}", format_duration_value(stddev, Some(unit)).0)
|
||||
} else {
|
||||
"".into()
|
||||
};
|
||||
let min_str = measurement.measurements.min().format_value(unit);
|
||||
let max_str = measurement.measurements.max().format_value(unit);
|
||||
let min_str = result.measurements.min().format_value(unit);
|
||||
let max_str = result.measurements.max().format_value(unit);
|
||||
// The ratio of two zero times is undefined, even if they compare equal.
|
||||
let relative_unavailable = reference_pending
|
||||
|| (explicit_reference
|
||||
&& !entry.is_reference
|
||||
&& entry.relative_ordering == Ordering::Equal
|
||||
&& measurement.mean_wall_clock_time() == Time::zero());
|
||||
&& result.mean_wall_clock_time() == Time::zero());
|
||||
let relative = if relative_unavailable {
|
||||
"N/A".to_string()
|
||||
} else {
|
||||
@@ -116,7 +114,7 @@ pub trait MarkupExporter {
|
||||
fn determine_unit_from_results(results: &[BenchmarkResult]) -> TimeUnit {
|
||||
if let Some(first_result) = results.first() {
|
||||
// Use the first BenchmarkResult entry to determine the unit for all entries.
|
||||
format_duration_value(first_result.mean(), None).1
|
||||
format_duration_value(first_result.mean_wall_clock_time(), None).1
|
||||
} else {
|
||||
// Default to `Second`.
|
||||
TimeUnit::Second
|
||||
|
||||
Reference in new issue
Block a user