pub struct BenchmarkReceipt {
pub timestamp: DateTime<Utc>,
pub commit_hash: String,
pub machine_fingerprint: MachineFingerprint,
pub results: Vec<BenchmarkResult>,
pub note: Option<String>,
}Expand description
A benchmark receipt captures the results and context of a single benchmark run.
Receipts are keyed to:
- A commit hash (git SHA)
- A machine fingerprint
- A timestamp (UTC)
This enables reproducible diffs between runs across different machines.
Fields§
§timestamp: DateTime<Utc>Timestamp of the benchmark run (UTC)
commit_hash: StringGit commit SHA of the code being benchmarked
machine_fingerprint: MachineFingerprintMachine fingerprint (hostname + username + arch + OS + cpu count + machine-id)
results: Vec<BenchmarkResult>Benchmark results indexed by name
note: Option<String>Optional note about the run environment
Implementations§
Source§impl BenchmarkReceipt
impl BenchmarkReceipt
Sourcepub fn new(commit_hash: String, machine_fingerprint: MachineFingerprint) -> Self
pub fn new(commit_hash: String, machine_fingerprint: MachineFingerprint) -> Self
Create a new receipt with the current timestamp.
Sourcepub fn add_result(&mut self, result: BenchmarkResult)
pub fn add_result(&mut self, result: BenchmarkResult)
Add a benchmark result to this receipt.
Sourcepub fn receipt_hash(&self) -> String
pub fn receipt_hash(&self) -> String
Compute a short hash of this receipt for quick comparison.
Uses only the commit hash, machine fingerprint, and result names/values. Timestamp is excluded to allow comparing logically equivalent runs.
Sourcepub fn from_json(bytes: &[u8]) -> Result<Self, BenchError>
pub fn from_json(bytes: &[u8]) -> Result<Self, BenchError>
Deserialize a receipt from JSON bytes.
Trait Implementations§
Source§impl Clone for BenchmarkReceipt
impl Clone for BenchmarkReceipt
Source§fn clone(&self) -> BenchmarkReceipt
fn clone(&self) -> BenchmarkReceipt
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BenchmarkReceipt
impl Debug for BenchmarkReceipt
Source§impl<'de> Deserialize<'de> for BenchmarkReceipt
impl<'de> Deserialize<'de> for BenchmarkReceipt
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for BenchmarkReceipt
impl RefUnwindSafe for BenchmarkReceipt
impl Send for BenchmarkReceipt
impl Sync for BenchmarkReceipt
impl Unpin for BenchmarkReceipt
impl UnsafeUnpin for BenchmarkReceipt
impl UnwindSafe for BenchmarkReceipt
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more