mirror of
https://github.com/sharkdp/hyperfine.git
synced 2026-11-01 08:50:19 +00:00
Add new --sort option
This adds a new `--sort` option to choose the way in which the results in the speed comparison and the markup exports are ordered. closes #614 closes #601
This commit is contained in:
1 parent
2393de0c36
commit
ac617c8714
12 files changed
+285
-89
No files matched your search
+7
-1
@@ -3,6 +3,7 @@ use serde_json::to_vec_pretty;
|
||||
|
||||
use super::Exporter;
|
||||
use crate::benchmark::benchmark_result::BenchmarkResult;
|
||||
use crate::options::SortOrder;
|
||||
use crate::util::units::Unit;
|
||||
|
||||
use anyhow::Result;
|
||||
@@ -16,7 +17,12 @@ struct HyperfineSummary<'a> {
|
||||
pub struct JsonExporter {}
|
||||
|
||||
impl Exporter for JsonExporter {
|
||||
fn serialize(&self, results: &[BenchmarkResult], _unit: Option<Unit>) -> Result<Vec<u8>> {
|
||||
fn serialize(
|
||||
&self,
|
||||
results: &[BenchmarkResult],
|
||||
_unit: Option<Unit>,
|
||||
_sort_order: SortOrder,
|
||||
) -> Result<Vec<u8>> {
|
||||
let mut output = to_vec_pretty(&HyperfineSummary { results });
|
||||
if let Ok(ref mut content) = output {
|
||||
content.push(b'\n');
|
||||
|
||||
Reference in new issue
Block a user