mirror of
https://github.com/sharkdp/hyperfine.git
synced 2024-11-22 11:43:03 +03:00
[update patch]
wchargin-branch: param-list-matrix wchargin-source: f866f0df2eae5f4bac2022c0db48edb0e8e6361e
This commit is contained in:
parent
a8a75a3b76
commit
89737785f8
@ -50,11 +50,11 @@ def extract_parameters(results):
|
||||
"benchmarks must all have the same parameter name, but found: %s"
|
||||
% sorted(names)
|
||||
)
|
||||
return (next(iter(names)), values)
|
||||
return (next(iter(names)), list(values))
|
||||
|
||||
|
||||
def unique_parameter(benchmark):
|
||||
"""Return the unique parameter `(name: str, value: float)`, or dies."""
|
||||
"""Return the unique parameter `(name: str, value: float)`, or die."""
|
||||
params_dict = benchmark.get("parameters", {})
|
||||
if not params_dict:
|
||||
die("benchmarks must have exactly one parameter, but found none")
|
||||
@ -63,7 +63,8 @@ def unique_parameter(benchmark):
|
||||
"benchmarks must have exactly one parameter, but found multiple: %s"
|
||||
% sorted(params_dict)
|
||||
)
|
||||
return next(iter(params_dict.items()))
|
||||
[(name, value)] = params_dict.items()
|
||||
return (name, float(value))
|
||||
|
||||
|
||||
parameter_name = None
|
||||
@ -80,7 +81,6 @@ for filename in args.file:
|
||||
)
|
||||
parameter_name = this_parameter_name
|
||||
|
||||
parameter_values = [float(pv) for pv in parameter_values]
|
||||
times_mean = [b["mean"] for b in results]
|
||||
times_stddev = [b["stddev"] for b in results]
|
||||
|
||||
|
@ -16,16 +16,16 @@ impl Exporter for CsvExporter {
|
||||
let mut writer = WriterBuilder::new().from_writer(vec![]);
|
||||
|
||||
{
|
||||
let mut headers: Vec<String> = [
|
||||
let mut headers: Vec<Cow<[u8]>> = [
|
||||
// The list of times cannot be exported to the CSV file - omit it.
|
||||
"command", "mean", "stddev", "median", "user", "system", "min", "max",
|
||||
]
|
||||
.iter()
|
||||
.map(|x| (*x).to_string())
|
||||
.map(|x| Cow::Borrowed(x.as_bytes()))
|
||||
.collect();
|
||||
if let Some(res) = results.first() {
|
||||
for param_name in res.parameters.keys() {
|
||||
headers.push(format!("parameter_{}", param_name));
|
||||
headers.push(Cow::Owned(format!("parameter_{}", param_name).into_bytes()));
|
||||
}
|
||||
}
|
||||
writer.write_record(headers)?;
|
||||
|
Loading…
Reference in New Issue
Block a user