Classes | |
| struct | PerformanceResults |
| A set of performance metrics in the shared results schema. More... | |
Functions | |
| pub struct PerformanceResults | new () -> Self |
| An empty result set. | |
| pub fn | higher_is_better (mut self, metric:&str, value:f64) -> Self |
| Add a metric where a higher value is a better result. | |
| pub fn | lower_is_better (mut self, metric:&str, value:f64) -> Self |
| Add a metric where a lower value is a better result. | |
| pub fn is_empty self | Argument (arguments:Arguments) -> Option< PathBuf > where Arguments:IntoIterator< Item=Argument >, Argument:AsRef< str >, |
| fn | serialises_both_sections_in_the_shared_schema () |
| fn | omits_an_empty_section () |
| fn | an_empty_result_set_is_reported_as_empty () |
| fn | reads_the_json_output_flag_in_both_spellings () |
| fn | writes_the_file_and_creates_its_parent_directory () |
Variables | |
| pub const | JSON_OUTPUT_FLAG |
| The command-line flag the performance examples take the results path from. | |
| higher_is_better | __pad0__ |
| Metrics where a higher value is a better result, such as a throughput. | |
| higher_is_better | f64 |
| higher_is_better | lower_is_better |
| Metrics where a lower value is a better result, such as a per-item cost. | |
| pub fn is_empty self | bool |
| Whether any metric has been added. | |
| mod | tests |
Function Documentation
◆ an_empty_result_set_is_reported_as_empty()
| fn an_empty_result_set_is_reported_as_empty | ( | ) |
◆ Argument()
◆ higher_is_better()
| pub fn higher_is_better | ( | mut | self, |
| metric:& | str, | ||
| value:f64 | ) -> Self |
Add a metric where a higher value is a better result.
◆ lower_is_better()
| pub fn lower_is_better | ( | mut | self, |
| metric:& | str, | ||
| value:f64 | ) -> Self |
Add a metric where a lower value is a better result.
◆ new()
| pub struct PerformanceResults new | ( | ) | -> Self |
An empty result set.
◆ omits_an_empty_section()
| fn omits_an_empty_section | ( | ) |
◆ reads_the_json_output_flag_in_both_spellings()
| fn reads_the_json_output_flag_in_both_spellings | ( | ) |
◆ serialises_both_sections_in_the_shared_schema()
| fn serialises_both_sections_in_the_shared_schema | ( | ) |
◆ writes_the_file_and_creates_its_parent_directory()
| fn writes_the_file_and_creates_its_parent_directory | ( | ) |
Variable Documentation
◆ __pad0__
| higher_is_better __pad0__ |
Metrics where a higher value is a better result, such as a throughput.
◆ bool
| pub fn is_empty self bool |
Initial value:
{
self.higher_is_better.is_empty() && self.lower_is_better.is_empty()
}
pub fn to_json(&self) -> String {
serde_json::to_string_pretty(self).expect("performance results are always serialisable")
}
pub fn write_to(&self, path: &Path) -> io::Result<()> {
if let Some(parent) = path.parent() {
if !parent.as_os_str().is_empty() {
std::fs::create_dir_all(parent)?;
}
}
std::fs::write(path, format!("{}\n", self.to_json()))
}
}
pub fn json_output_path<Arguments
if let Some(published)
pub struct ProfileArguments Arguments
Read the arguments that follow the program name into [ProfileArguments].
Whether any metric has been added.
A results file with no metrics carries no figure, so callers can treat this as an error rather than write one.
◆ f64
| higher_is_better f64 |
◆ JSON_OUTPUT_FLAG
| pub const JSON_OUTPUT_FLAG |
The command-line flag the performance examples take the results path from.
◆ lower_is_better
| higher_is_better lower_is_better |
Metrics where a lower value is a better result, such as a per-item cost.
◆ tests
| mod tests |
Initial value:
{
use super::*
