summaryrefslogtreecommitdiff
path: root/src/result.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/result.rs')
-rw-r--r--src/result.rs16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/result.rs b/src/result.rs
index cce5d2d..f72c2f4 100644
--- a/src/result.rs
+++ b/src/result.rs
@@ -12,6 +12,7 @@ git_testament!(TESTAMENT);
pub struct SuiteMeasurements {
measurements: Vec<OpMeasurements>,
obnam_version: String,
+ obnam_commit: Option<String>,
obnam_benchmark_version: String,
benchmark_started: String,
hostname: String,
@@ -66,7 +67,10 @@ pub enum SuiteMeasurementsError {
}
impl SuiteMeasurements {
- pub fn new(obnam_version: String) -> Result<Self, SuiteMeasurementsError> {
+ pub fn new(
+ obnam_version: String,
+ obnam_commit: Option<String>,
+ ) -> Result<Self, SuiteMeasurementsError> {
let cpu = procfs::CpuInfo::new().map_err(SuiteMeasurementsError::CpuInfo)?;
let mem = procfs::Meminfo::new().map_err(SuiteMeasurementsError::MemInfo)?;
let mut buf = [0u8; 1024];
@@ -76,6 +80,7 @@ impl SuiteMeasurements {
Ok(Self {
measurements: vec![],
obnam_version,
+ obnam_commit,
obnam_benchmark_version: render_testament!(TESTAMENT),
benchmark_started: Utc::now().format("%Y-%m-%dT%H%M%S").to_string(),
hostname: hostname.to_string(),
@@ -109,10 +114,11 @@ impl SuiteMeasurements {
}
pub fn obnam_version(&self) -> &str {
- self.obnam_version
- .strip_prefix("obnam-backup ")
- .or(Some(""))
- .unwrap()
+ &self.obnam_version
+ }
+
+ pub fn obnam_commit(&self) -> Option<&str> {
+ self.obnam_commit.as_deref()
}
pub fn push(&mut self, m: OpMeasurements) {