[PERF] Host Debug Overlay Isolation
This commit is contained in:
@@ -13,15 +13,11 @@ pub struct TelemetryFrame {
|
||||
pub completed_logical_frames: u32,
|
||||
pub violations: u32,
|
||||
|
||||
// GFX Banks
|
||||
pub gfx_used_bytes: usize,
|
||||
pub gfx_inflight_bytes: usize,
|
||||
pub gfx_slots_occupied: u32,
|
||||
|
||||
// Audio Banks
|
||||
pub audio_used_bytes: usize,
|
||||
pub audio_inflight_bytes: usize,
|
||||
pub audio_slots_occupied: u32,
|
||||
// Bank telemetry
|
||||
pub glyph_slots_used: u32,
|
||||
pub glyph_slots_total: u32,
|
||||
pub sound_slots_used: u32,
|
||||
pub sound_slots_total: u32,
|
||||
|
||||
// RAM (Heap)
|
||||
pub heap_used_bytes: usize,
|
||||
@@ -44,15 +40,11 @@ pub struct AtomicTelemetry {
|
||||
pub completed_logical_frames: AtomicU32,
|
||||
pub violations: AtomicU32,
|
||||
|
||||
// GFX Banks
|
||||
pub gfx_used_bytes: AtomicUsize,
|
||||
pub gfx_inflight_bytes: AtomicUsize,
|
||||
pub gfx_slots_occupied: AtomicU32,
|
||||
|
||||
// Audio Banks
|
||||
pub audio_used_bytes: AtomicUsize,
|
||||
pub audio_inflight_bytes: AtomicUsize,
|
||||
pub audio_slots_occupied: AtomicU32,
|
||||
// Bank telemetry
|
||||
pub glyph_slots_used: AtomicU32,
|
||||
pub glyph_slots_total: AtomicU32,
|
||||
pub sound_slots_used: AtomicU32,
|
||||
pub sound_slots_total: AtomicU32,
|
||||
|
||||
// RAM (Heap)
|
||||
pub heap_used_bytes: AtomicUsize,
|
||||
@@ -79,12 +71,10 @@ impl AtomicTelemetry {
|
||||
host_cpu_time_us: self.host_cpu_time_us.load(Ordering::Relaxed),
|
||||
completed_logical_frames: self.completed_logical_frames.load(Ordering::Relaxed),
|
||||
violations: self.violations.load(Ordering::Relaxed),
|
||||
gfx_used_bytes: self.gfx_used_bytes.load(Ordering::Relaxed),
|
||||
gfx_inflight_bytes: self.gfx_inflight_bytes.load(Ordering::Relaxed),
|
||||
gfx_slots_occupied: self.gfx_slots_occupied.load(Ordering::Relaxed),
|
||||
audio_used_bytes: self.audio_used_bytes.load(Ordering::Relaxed),
|
||||
audio_inflight_bytes: self.audio_inflight_bytes.load(Ordering::Relaxed),
|
||||
audio_slots_occupied: self.audio_slots_occupied.load(Ordering::Relaxed),
|
||||
glyph_slots_used: self.glyph_slots_used.load(Ordering::Relaxed),
|
||||
glyph_slots_total: self.glyph_slots_total.load(Ordering::Relaxed),
|
||||
sound_slots_used: self.sound_slots_used.load(Ordering::Relaxed),
|
||||
sound_slots_total: self.sound_slots_total.load(Ordering::Relaxed),
|
||||
heap_used_bytes: self.heap_used_bytes.load(Ordering::Relaxed),
|
||||
heap_max_bytes: self.heap_max_bytes.load(Ordering::Relaxed),
|
||||
logs_count: self.logs_count.load(Ordering::Relaxed),
|
||||
@@ -99,12 +89,10 @@ impl AtomicTelemetry {
|
||||
self.host_cpu_time_us.store(0, Ordering::Relaxed);
|
||||
self.completed_logical_frames.store(0, Ordering::Relaxed);
|
||||
self.violations.store(0, Ordering::Relaxed);
|
||||
self.gfx_used_bytes.store(0, Ordering::Relaxed);
|
||||
self.gfx_inflight_bytes.store(0, Ordering::Relaxed);
|
||||
self.gfx_slots_occupied.store(0, Ordering::Relaxed);
|
||||
self.audio_used_bytes.store(0, Ordering::Relaxed);
|
||||
self.audio_inflight_bytes.store(0, Ordering::Relaxed);
|
||||
self.audio_slots_occupied.store(0, Ordering::Relaxed);
|
||||
self.glyph_slots_used.store(0, Ordering::Relaxed);
|
||||
self.glyph_slots_total.store(0, Ordering::Relaxed);
|
||||
self.sound_slots_used.store(0, Ordering::Relaxed);
|
||||
self.sound_slots_total.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);
|
||||
@@ -118,8 +106,8 @@ pub struct CertificationConfig {
|
||||
pub cycles_budget_per_frame: Option<u64>,
|
||||
pub max_syscalls_per_frame: Option<u32>,
|
||||
pub max_host_cpu_us_per_frame: Option<u64>,
|
||||
pub max_gfx_bytes: Option<usize>,
|
||||
pub max_audio_bytes: Option<usize>,
|
||||
pub max_glyph_slots_used: Option<u32>,
|
||||
pub max_sound_slots_used: Option<u32>,
|
||||
pub max_heap_bytes: Option<usize>,
|
||||
pub max_logs_per_frame: Option<u32>,
|
||||
}
|
||||
@@ -199,9 +187,9 @@ impl Certifier {
|
||||
violations += 1;
|
||||
}
|
||||
|
||||
// 4. GFX Memory
|
||||
if let Some(limit) = self.config.max_gfx_bytes
|
||||
&& telemetry.gfx_used_bytes > limit
|
||||
// 4. GLYPH bank slots
|
||||
if let Some(limit) = self.config.max_glyph_slots_used
|
||||
&& telemetry.glyph_slots_used > limit
|
||||
{
|
||||
log_service.log(
|
||||
ts_ms,
|
||||
@@ -210,16 +198,16 @@ impl Certifier {
|
||||
LogSource::Pos,
|
||||
0xCA04,
|
||||
format!(
|
||||
"Cert: GFX bank exceeded memory limit ({} > {})",
|
||||
telemetry.gfx_used_bytes, limit
|
||||
"Cert: GLYPH bank exceeded slot limit ({} > {})",
|
||||
telemetry.glyph_slots_used, limit
|
||||
),
|
||||
);
|
||||
violations += 1;
|
||||
}
|
||||
|
||||
// 5. Audio Memory
|
||||
if let Some(limit) = self.config.max_audio_bytes
|
||||
&& telemetry.audio_used_bytes > limit
|
||||
// 5. SOUNDS bank slots
|
||||
if let Some(limit) = self.config.max_sound_slots_used
|
||||
&& telemetry.sound_slots_used > limit
|
||||
{
|
||||
log_service.log(
|
||||
ts_ms,
|
||||
@@ -228,8 +216,8 @@ impl Certifier {
|
||||
LogSource::Pos,
|
||||
0xCA05,
|
||||
format!(
|
||||
"Cert: Audio bank exceeded memory limit ({} > {})",
|
||||
telemetry.audio_used_bytes, limit
|
||||
"Cert: SOUNDS bank exceeded slot limit ({} > {})",
|
||||
telemetry.sound_slots_used, limit
|
||||
),
|
||||
);
|
||||
violations += 1;
|
||||
@@ -285,7 +273,7 @@ mod tests {
|
||||
cycles_budget_per_frame: Some(100),
|
||||
max_syscalls_per_frame: Some(5),
|
||||
max_host_cpu_us_per_frame: Some(1000),
|
||||
max_gfx_bytes: Some(1024),
|
||||
max_glyph_slots_used: Some(1),
|
||||
..Default::default()
|
||||
};
|
||||
let cert = Certifier::new(config);
|
||||
@@ -294,7 +282,7 @@ mod tests {
|
||||
tel.cycles_used = 150;
|
||||
tel.syscalls = 10;
|
||||
tel.host_cpu_time_us = 500;
|
||||
tel.gfx_used_bytes = 2048;
|
||||
tel.glyph_slots_used = 2;
|
||||
|
||||
let violations = cert.evaluate(&tel, &mut ls, 1000);
|
||||
assert_eq!(violations, 3);
|
||||
@@ -303,7 +291,7 @@ mod tests {
|
||||
assert_eq!(logs.len(), 3);
|
||||
assert!(logs[0].msg.contains("cycles_used"));
|
||||
assert!(logs[1].msg.contains("syscalls"));
|
||||
assert!(logs[2].msg.contains("GFX bank"));
|
||||
assert!(logs[2].msg.contains("GLYPH bank"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user