mirror of
https://github.com/sharkdp/hyperfine.git
synced 2024-08-16 17:30:21 +03:00
formtating
This commit is contained in:
parent
c8bfd59d81
commit
539995aad1
@ -1,13 +1,13 @@
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
use serde::{Serialize, Deserialize};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::util::units::Second;
|
||||
|
||||
/// Set of values that will be exported.
|
||||
// NOTE: `serde` is used for JSON serialization, but not for CSV serialization due to the
|
||||
// `parameters` map. Update `src/hyperfine/export/csv.rs` with new fields, as appropriate.
|
||||
#[derive(Debug, Default, Clone, Serialize, Deserialize ,PartialEq)]
|
||||
#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
|
||||
pub struct BenchmarkResult {
|
||||
/// The full command line of the program that is being benchmarked
|
||||
pub command: String,
|
||||
|
@ -22,7 +22,7 @@ impl<'a> Scheduler<'a> {
|
||||
commands: &'a Commands,
|
||||
options: &'a Options,
|
||||
export_manager: &'a ExportManager,
|
||||
results: &'a Vec<BenchmarkResult>
|
||||
results: &'a Vec<BenchmarkResult>,
|
||||
) -> Self {
|
||||
Self {
|
||||
commands,
|
||||
@ -85,7 +85,6 @@ impl<'a> Scheduler<'a> {
|
||||
let fastest = annotated_results.iter().find(|r| r.is_fastest).unwrap();
|
||||
let others = annotated_results.iter().filter(|r| !r.is_fastest);
|
||||
|
||||
|
||||
println!(
|
||||
" {} ran",
|
||||
(get_command_from_result(&fastest.result)).cyan()
|
||||
|
@ -23,7 +23,9 @@ impl Exporter for JsonExporter {
|
||||
_unit: Option<Unit>,
|
||||
_sort_order: SortOrder,
|
||||
) -> Result<Vec<u8>> {
|
||||
let mut output = to_vec_pretty(&HyperfineSummary { results: results.to_vec() });
|
||||
let mut output = to_vec_pretty(&HyperfineSummary {
|
||||
results: results.to_vec(),
|
||||
});
|
||||
if let Ok(ref mut content) = output {
|
||||
content.push(b'\n');
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
use crate::{benchmark::benchmark_result::BenchmarkResult, export::json::HyperfineSummary};
|
||||
use clap::ArgMatches;
|
||||
use std::fs;
|
||||
use crate::{export::json::HyperfineSummary, benchmark::benchmark_result::BenchmarkResult};
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct Importer {}
|
||||
@ -19,8 +19,8 @@ fn read_summary_from_file(file_name: &str) -> Option<Vec<BenchmarkResult>> {
|
||||
Ok(content) => content,
|
||||
Err(_) => {
|
||||
eprintln!("Unable to load previous run from file {}", file_name);
|
||||
return None
|
||||
},
|
||||
return None;
|
||||
}
|
||||
};
|
||||
|
||||
let hyperfine_summary = serde_json::from_str::<HyperfineSummary>(&file_content);
|
||||
|
Loading…
Reference in New Issue
Block a user