[PERF] Host Debug Overlay Isolation
This commit is contained in:
@@ -27,7 +27,7 @@ pub struct TelemetryFrame {
|
||||
pub heap_used_bytes: usize,
|
||||
pub heap_max_bytes: usize,
|
||||
|
||||
// Log Pressure
|
||||
// Log Pressure from the last completed logical frame
|
||||
pub logs_count: u32,
|
||||
}
|
||||
|
||||
@@ -58,13 +58,15 @@ pub struct AtomicTelemetry {
|
||||
pub heap_used_bytes: AtomicUsize,
|
||||
pub heap_max_bytes: AtomicUsize,
|
||||
|
||||
// Log Pressure
|
||||
pub logs_count: Arc<AtomicU32>,
|
||||
// Transient in-flight log counter for the current logical frame
|
||||
pub current_logs_count: Arc<AtomicU32>,
|
||||
// Persisted log count from the last completed logical frame
|
||||
pub logs_count: AtomicU32,
|
||||
}
|
||||
|
||||
impl AtomicTelemetry {
|
||||
pub fn new(logs_count: Arc<AtomicU32>) -> Self {
|
||||
Self { logs_count, ..Default::default() }
|
||||
pub fn new(current_logs_count: Arc<AtomicU32>) -> Self {
|
||||
Self { current_logs_count, ..Default::default() }
|
||||
}
|
||||
|
||||
/// Snapshots the current atomic state into a TelemetryFrame.
|
||||
@@ -105,6 +107,8 @@ impl AtomicTelemetry {
|
||||
self.audio_slots_occupied.store(0, Ordering::Relaxed);
|
||||
self.heap_used_bytes.store(0, Ordering::Relaxed);
|
||||
self.vm_steps.store(0, Ordering::Relaxed);
|
||||
self.logs_count.store(0, Ordering::Relaxed);
|
||||
self.current_logs_count.store(0, Ordering::Relaxed);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -301,4 +305,16 @@ mod tests {
|
||||
assert!(logs[1].msg.contains("syscalls"));
|
||||
assert!(logs[2].msg.contains("GFX bank"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn snapshot_uses_persisted_last_frame_logs() {
|
||||
let current = Arc::new(AtomicU32::new(7));
|
||||
let tel = AtomicTelemetry::new(Arc::clone(¤t));
|
||||
tel.logs_count.store(3, Ordering::Relaxed);
|
||||
|
||||
let snapshot = tel.snapshot();
|
||||
|
||||
assert_eq!(snapshot.logs_count, 3);
|
||||
assert_eq!(current.load(Ordering::Relaxed), 7);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user