mirror of
https://github.com/sharkdp/hyperfine.git
synced 2026-11-03 01:21:25 +00:00
Include raw commands in JSON exports when names differ
This commit is contained in:
1 parent
1b3ec922fa
commit
c5d3a81fc5
7 files changed
+79
-2
No files matched your search
@@ -15,9 +15,13 @@ pub struct Parameter {
|
||||
/// Meta data and performance metrics for a single benchmark
|
||||
#[derive(Debug, Default, Clone, Serialize, PartialEq)]
|
||||
pub struct BenchmarkResult {
|
||||
/// The full command line of the program that is being benchmarked
|
||||
/// The display name of the command being benchmarked
|
||||
pub command: String,
|
||||
|
||||
/// The expanded command line, when it differs from the display name
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub command_raw: Option<String>,
|
||||
|
||||
/// Performance metric measurements and exit codes for each run
|
||||
#[serde(flatten)]
|
||||
pub measurements: Measurements,
|
||||
|
||||
@@ -475,8 +475,13 @@ impl<'a> Benchmark<'a> {
|
||||
|
||||
self.run_cleanup_command(self.command.get_parameters().iter().cloned(), output_policy)?;
|
||||
|
||||
let command = self.command.get_name();
|
||||
let command_raw = self.command.get_command_line();
|
||||
let command_raw = (command_raw != command).then_some(command_raw);
|
||||
|
||||
Ok(BenchmarkResult {
|
||||
command: self.command.get_name(),
|
||||
command,
|
||||
command_raw,
|
||||
measurements,
|
||||
parameters: self
|
||||
.command
|
||||
|
||||
@@ -158,6 +158,7 @@ fn create_result(name: &str, mean: f64) -> BenchmarkResult {
|
||||
|
||||
BenchmarkResult {
|
||||
command: name.into(),
|
||||
command_raw: None,
|
||||
measurements: Measurements {
|
||||
measurements: vec![Measurement {
|
||||
time_wall_clock: Time::new::<second>(mean),
|
||||
|
||||
Reference in new issue
Block a user