This commit is contained in:
David Peter authored and David Peter committed 2026-10-05 15:59:10 +02:00
1 parent 9ec7a9c920
commit 641451aea6
15 files changed
+459 -443

No files matched your search

+5 -5
View File
@@ -8,7 +8,7 @@ use std::process::{Child, ExitStatus};
use anyhow::Result;
use crate::benchmark::quantity::{Byte, Second};
use crate::benchmark::quantity::{Information, InformationQuantity, Time, TimeQuantity};
#[derive(Debug, Copy, Clone)]
struct ResourceUsage {
@@ -68,13 +68,13 @@ impl CPUTimer {
Self {}
}
pub fn stop(&self, child: Child) -> Result<(ExitStatus, Second, Second, Byte)> {
pub fn stop(&self, child: Child) -> Result<(ExitStatus, Time, Time, Information)> {
let (status, usage) = wait4(child)?;
Ok((
status,
Second::new(usage.user_usec),
Second::new(usage.system_usec),
Byte::new(u64::try_from(usage.memory_usage_byte).unwrap_or(0)),
Time::from_seconds(usage.user_usec),
Time::from_seconds(usage.system_usec),
Information::from_bytes(u64::try_from(usage.memory_usage_byte).unwrap_or(0)),
))
}
}
+4 -3
View File
@@ -1,6 +1,6 @@
use std::time::Instant;
use crate::benchmark::quantity::Second;
use crate::benchmark::quantity::{Time, TimeQuantity};
pub struct WallClockTimer {
start: Instant,
@@ -15,7 +15,8 @@ impl WallClockTimer {
pub fn stop(&self) -> Time {
let duration = self.start.elapsed();
// TODO
Second::new(duration.as_secs() as f64 + f64::from(duration.subsec_nanos()) * 1e-9)
Time::from_seconds(duration.as_secs() as f64)
+ Time::from_nanoseconds(duration.subsec_nanos() as f64)
}
}