ext/pf2/src/profile.rs in pf2-0.5.2 vs ext/pf2/src/profile.rs in pf2-0.6.0
- old
+ new
@@ -1,6 +1,6 @@
-use std::time::Instant;
+use std::time::{Instant, SystemTime};
use std::{collections::HashSet, ptr::null_mut};
use rb_sys::*;
use backtrace_sys2::backtrace_create_state;
@@ -13,11 +13,13 @@
// 16 threads * 20 samples per second * 1 second = 320
const DEFAULT_RINGBUFFER_CAPACITY: usize = 320;
#[derive(Debug)]
pub struct Profile {
- pub start_timestamp: Instant,
+ pub start_timestamp: SystemTime,
+ pub start_instant: Instant,
+ pub end_instant: Option<Instant>,
pub samples: Vec<Sample>,
pub temporary_sample_buffer: Ringbuffer,
pub backtrace_state: BacktraceState,
known_values: HashSet<VALUE>,
}
@@ -33,10 +35,12 @@
);
BacktraceState::new(ptr)
};
Self {
- start_timestamp: Instant::now(),
+ start_timestamp: SystemTime::now(),
+ start_instant: Instant::now(),
+ end_instant: None,
samples: vec![],
temporary_sample_buffer: Ringbuffer::new(DEFAULT_RINGBUFFER_CAPACITY),
backtrace_state,
known_values: HashSet::new(),
}