[PERF] Host Debug Overlay Isolation
This commit is contained in:
@@ -2,8 +2,8 @@
|
||||
use crate::memory_banks::{GlyphBankPoolInstaller, SoundBankPoolInstaller};
|
||||
use prometeu_hal::AssetBridge;
|
||||
use prometeu_hal::asset::{
|
||||
AssetCodec, AssetEntry, AssetId, AssetLoadError, AssetOpStatus, BankStats, BankType, HandleId,
|
||||
LoadStatus, PreloadEntry, SlotRef, SlotStats,
|
||||
AssetCodec, AssetEntry, AssetId, AssetLoadError, AssetOpStatus, BankTelemetry, BankType,
|
||||
HandleId, LoadStatus, PreloadEntry, SlotRef, SlotStats,
|
||||
};
|
||||
use prometeu_hal::cartridge::AssetsPayloadSource;
|
||||
use prometeu_hal::color::Color;
|
||||
@@ -161,11 +161,6 @@ pub struct AssetManager {
|
||||
/// Residency policy for sound banks.
|
||||
sound_policy: BankPolicy<SoundBank>,
|
||||
|
||||
/// Count of occupied slots for GFX.
|
||||
gfx_slots_occupied: AtomicUsize,
|
||||
/// Count of occupied slots for sounds.
|
||||
sound_slots_occupied: AtomicUsize,
|
||||
|
||||
// Commits that are ready to be applied at the next frame boundary.
|
||||
pending_commits: Mutex<Vec<HandleId>>,
|
||||
}
|
||||
@@ -206,8 +201,8 @@ impl AssetBridge for AssetManager {
|
||||
fn apply_commits(&self) {
|
||||
self.apply_commits()
|
||||
}
|
||||
fn bank_info(&self, kind: BankType) -> BankStats {
|
||||
self.bank_info(kind)
|
||||
fn bank_telemetry(&self) -> Vec<BankTelemetry> {
|
||||
self.bank_telemetry()
|
||||
}
|
||||
fn slot_info(&self, slot: SlotRef) -> SlotStats {
|
||||
self.slot_info(slot)
|
||||
@@ -302,8 +297,6 @@ impl AssetManager {
|
||||
sound_slots: Arc::new(RwLock::new(std::array::from_fn(|_| None))),
|
||||
gfx_policy: BankPolicy::new(),
|
||||
sound_policy: BankPolicy::new(),
|
||||
gfx_slots_occupied: AtomicUsize::new(0),
|
||||
sound_slots_occupied: AtomicUsize::new(0),
|
||||
handles: Arc::new(RwLock::new(HashMap::new())),
|
||||
next_handle_id: Mutex::new(1),
|
||||
assets_data: Arc::new(RwLock::new(assets_data)),
|
||||
@@ -732,9 +725,6 @@ impl AssetManager {
|
||||
self.gfx_installer.install_glyph_bank(h.slot.index, bank);
|
||||
let mut slots = self.gfx_slots.write().unwrap();
|
||||
if h.slot.index < slots.len() {
|
||||
if slots[h.slot.index].is_none() {
|
||||
self.gfx_slots_occupied.fetch_add(1, Ordering::Relaxed);
|
||||
}
|
||||
slots[h.slot.index] = Some(h._asset_id);
|
||||
}
|
||||
h.status = LoadStatus::COMMITTED;
|
||||
@@ -745,9 +735,6 @@ impl AssetManager {
|
||||
self.sound_installer.install_sound_bank(h.slot.index, bank);
|
||||
let mut slots = self.sound_slots.write().unwrap();
|
||||
if h.slot.index < slots.len() {
|
||||
if slots[h.slot.index].is_none() {
|
||||
self.sound_slots_occupied.fetch_add(1, Ordering::Relaxed);
|
||||
}
|
||||
slots[h.slot.index] = Some(h._asset_id);
|
||||
}
|
||||
h.status = LoadStatus::COMMITTED;
|
||||
@@ -759,37 +746,21 @@ impl AssetManager {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn bank_info(&self, kind: BankType) -> BankStats {
|
||||
match kind {
|
||||
BankType::GLYPH => {
|
||||
let used_bytes = self.gfx_policy.used_bytes.load(Ordering::Relaxed);
|
||||
let inflight_bytes = self.gfx_policy.inflight_bytes.load(Ordering::Relaxed);
|
||||
let slots_occupied = self.gfx_slots_occupied.load(Ordering::Relaxed);
|
||||
pub fn bank_telemetry(&self) -> Vec<BankTelemetry> {
|
||||
vec![self.bank_telemetry_for(BankType::GLYPH), self.bank_telemetry_for(BankType::SOUNDS)]
|
||||
}
|
||||
|
||||
BankStats {
|
||||
total_bytes: 16 * 1024 * 1024,
|
||||
used_bytes,
|
||||
free_bytes: (16usize * 1024 * 1024).saturating_sub(used_bytes),
|
||||
inflight_bytes,
|
||||
slot_count: 16,
|
||||
slots_occupied,
|
||||
}
|
||||
fn bank_telemetry_for(&self, kind: BankType) -> BankTelemetry {
|
||||
let used_slots = match kind {
|
||||
BankType::GLYPH => {
|
||||
self.gfx_slots.read().unwrap().iter().filter(|slot| slot.is_some()).count()
|
||||
}
|
||||
BankType::SOUNDS => {
|
||||
let used_bytes = self.sound_policy.used_bytes.load(Ordering::Relaxed);
|
||||
let inflight_bytes = self.sound_policy.inflight_bytes.load(Ordering::Relaxed);
|
||||
let slots_occupied = self.sound_slots_occupied.load(Ordering::Relaxed);
|
||||
|
||||
BankStats {
|
||||
total_bytes: 32 * 1024 * 1024,
|
||||
used_bytes,
|
||||
free_bytes: (32usize * 1024 * 1024).saturating_sub(used_bytes),
|
||||
inflight_bytes,
|
||||
slot_count: 16,
|
||||
slots_occupied,
|
||||
}
|
||||
self.sound_slots.read().unwrap().iter().filter(|slot| slot.is_some()).count()
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
BankTelemetry { bank_type: kind, used_slots, total_slots: 16 }
|
||||
}
|
||||
|
||||
pub fn slot_info(&self, slot: SlotRef) -> SlotStats {
|
||||
@@ -842,8 +813,6 @@ impl AssetManager {
|
||||
pub fn shutdown(&self) {
|
||||
self.gfx_policy.clear();
|
||||
self.sound_policy.clear();
|
||||
self.gfx_slots_occupied.store(0, Ordering::Relaxed);
|
||||
self.sound_slots_occupied.store(0, Ordering::Relaxed);
|
||||
self.handles.write().unwrap().clear();
|
||||
self.pending_commits.lock().unwrap().clear();
|
||||
self.gfx_slots.write().unwrap().fill(None);
|
||||
@@ -1196,7 +1165,6 @@ mod tests {
|
||||
|
||||
let width = 16;
|
||||
let height = 16;
|
||||
let decoded_bytes = expected_glyph_decoded_size(width, height);
|
||||
let data = test_glyph_asset_data();
|
||||
|
||||
let am = AssetManager::new(
|
||||
@@ -1207,10 +1175,10 @@ mod tests {
|
||||
);
|
||||
|
||||
// Initially zero
|
||||
let info = am.bank_info(BankType::GLYPH);
|
||||
assert_eq!(info.used_bytes, 0);
|
||||
assert_eq!(info.inflight_bytes, 0);
|
||||
assert_eq!(info.slots_occupied, 0);
|
||||
let info = am.bank_telemetry();
|
||||
assert_eq!(info[0].bank_type, BankType::GLYPH);
|
||||
assert_eq!(info[0].used_slots, 0);
|
||||
assert_eq!(info[0].total_slots, 16);
|
||||
|
||||
// Loading
|
||||
let handle = am.load(0, 0).expect("load must allocate handle");
|
||||
@@ -1221,26 +1189,21 @@ mod tests {
|
||||
thread::sleep(std::time::Duration::from_millis(10));
|
||||
}
|
||||
|
||||
let info = am.bank_info(BankType::GLYPH);
|
||||
// Note: put_resident happens in worker thread, then stage happens.
|
||||
assert_eq!(info.used_bytes, decoded_bytes);
|
||||
assert_eq!(info.inflight_bytes, decoded_bytes);
|
||||
assert_eq!(info.slots_occupied, 0);
|
||||
let info = am.bank_telemetry();
|
||||
assert_eq!(info[0].used_slots, 0);
|
||||
|
||||
// Commit
|
||||
am.commit(handle);
|
||||
am.apply_commits();
|
||||
|
||||
let info = am.bank_info(BankType::GLYPH);
|
||||
assert_eq!(info.used_bytes, decoded_bytes);
|
||||
assert_eq!(info.inflight_bytes, 0);
|
||||
assert_eq!(info.slots_occupied, 1);
|
||||
let info = am.bank_telemetry();
|
||||
assert_eq!(info[0].used_slots, 1);
|
||||
assert_eq!(info[1].bank_type, BankType::SOUNDS);
|
||||
assert_eq!(info[1].used_slots, 0);
|
||||
|
||||
// Shutdown resets
|
||||
am.shutdown();
|
||||
let info = am.bank_info(BankType::GLYPH);
|
||||
assert_eq!(info.used_bytes, 0);
|
||||
assert_eq!(info.inflight_bytes, 0);
|
||||
assert_eq!(info.slots_occupied, 0);
|
||||
let info = am.bank_telemetry();
|
||||
assert_eq!(info[0].used_slots, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,13 +105,10 @@ pub enum AssetOpStatus {
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct BankStats {
|
||||
pub total_bytes: usize,
|
||||
pub used_bytes: usize,
|
||||
pub free_bytes: usize,
|
||||
pub inflight_bytes: usize,
|
||||
pub slot_count: usize,
|
||||
pub slots_occupied: usize,
|
||||
pub struct BankTelemetry {
|
||||
pub bank_type: BankType,
|
||||
pub used_slots: usize,
|
||||
pub total_slots: usize,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use crate::asset::{
|
||||
AssetEntry, AssetId, AssetLoadError, AssetOpStatus, BankStats, BankType, HandleId, LoadStatus,
|
||||
AssetEntry, AssetId, AssetLoadError, AssetOpStatus, BankTelemetry, HandleId, LoadStatus,
|
||||
PreloadEntry, SlotRef, SlotStats,
|
||||
};
|
||||
use crate::cartridge::AssetsPayloadSource;
|
||||
@@ -16,7 +16,7 @@ pub trait AssetBridge {
|
||||
fn commit(&self, handle: HandleId) -> AssetOpStatus;
|
||||
fn cancel(&self, handle: HandleId) -> AssetOpStatus;
|
||||
fn apply_commits(&self);
|
||||
fn bank_info(&self, kind: BankType) -> BankStats;
|
||||
fn bank_telemetry(&self) -> Vec<BankTelemetry>;
|
||||
fn slot_info(&self, slot: SlotRef) -> SlotStats;
|
||||
fn shutdown(&self);
|
||||
}
|
||||
|
||||
@@ -64,12 +64,10 @@ pub enum DebugEvent {
|
||||
cycles_budget: u64,
|
||||
host_cpu_time_us: u64,
|
||||
violations: u32,
|
||||
gfx_used_bytes: usize,
|
||||
gfx_inflight_bytes: usize,
|
||||
gfx_slots_occupied: u32,
|
||||
audio_used_bytes: usize,
|
||||
audio_inflight_bytes: usize,
|
||||
audio_slots_occupied: u32,
|
||||
glyph_slots_used: u32,
|
||||
glyph_slots_total: u32,
|
||||
sound_slots_used: u32,
|
||||
sound_slots_total: u32,
|
||||
},
|
||||
#[serde(rename = "fault")]
|
||||
Fault {
|
||||
@@ -97,12 +95,10 @@ mod tests {
|
||||
cycles_budget: 10000,
|
||||
host_cpu_time_us: 1200,
|
||||
violations: 0,
|
||||
gfx_used_bytes: 1024,
|
||||
gfx_inflight_bytes: 0,
|
||||
gfx_slots_occupied: 1,
|
||||
audio_used_bytes: 2048,
|
||||
audio_inflight_bytes: 0,
|
||||
audio_slots_occupied: 2,
|
||||
glyph_slots_used: 1,
|
||||
glyph_slots_total: 16,
|
||||
sound_slots_used: 2,
|
||||
sound_slots_total: 16,
|
||||
};
|
||||
|
||||
let json = serde_json::to_string(&event).unwrap();
|
||||
|
||||
@@ -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]
|
||||
|
||||
@@ -486,8 +486,17 @@ impl NativeInterface for VirtualMachineRuntime {
|
||||
1 => BankType::SOUNDS,
|
||||
_ => return Err(VmFault::Trap(TRAP_TYPE, "Invalid asset type".to_string())),
|
||||
};
|
||||
let json =
|
||||
serde_json::to_string(&hw.assets().bank_info(asset_type)).unwrap_or_default();
|
||||
let telemetry = hw
|
||||
.assets()
|
||||
.bank_telemetry()
|
||||
.into_iter()
|
||||
.find(|entry| entry.bank_type == asset_type)
|
||||
.unwrap_or(prometeu_hal::asset::BankTelemetry {
|
||||
bank_type: asset_type,
|
||||
used_slots: 0,
|
||||
total_slots: 0,
|
||||
});
|
||||
let json = serde_json::to_string(&telemetry).unwrap_or_default();
|
||||
ret.push_string(json);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -1,12 +1,26 @@
|
||||
use super::*;
|
||||
use crate::CrashReport;
|
||||
use prometeu_hal::asset::BankType;
|
||||
use prometeu_hal::asset::{BankTelemetry, BankType};
|
||||
use prometeu_hal::log::{LogLevel, LogSource};
|
||||
use prometeu_hal::{HardwareBridge, HostContext, InputSignals};
|
||||
use prometeu_vm::LogicalFrameEndingReason;
|
||||
use std::sync::atomic::Ordering;
|
||||
|
||||
impl VirtualMachineRuntime {
|
||||
fn bank_telemetry_summary(hw: &dyn HardwareBridge) -> (BankTelemetry, BankTelemetry) {
|
||||
let telemetry = hw.assets().bank_telemetry();
|
||||
let glyph =
|
||||
telemetry.iter().find(|entry| entry.bank_type == BankType::GLYPH).cloned().unwrap_or(
|
||||
BankTelemetry { bank_type: BankType::GLYPH, used_slots: 0, total_slots: 0 },
|
||||
);
|
||||
let sounds =
|
||||
telemetry.iter().find(|entry| entry.bank_type == BankType::SOUNDS).cloned().unwrap_or(
|
||||
BankTelemetry { bank_type: BankType::SOUNDS, used_slots: 0, total_slots: 0 },
|
||||
);
|
||||
|
||||
(glyph, sounds)
|
||||
}
|
||||
|
||||
pub fn debug_step_instruction(
|
||||
&mut self,
|
||||
vm: &mut VirtualMachine,
|
||||
@@ -134,27 +148,19 @@ impl VirtualMachineRuntime {
|
||||
hw.gfx_mut().render_all();
|
||||
|
||||
// 1. Snapshot full telemetry at logical frame end
|
||||
let gfx_stats = hw.assets().bank_info(BankType::GLYPH);
|
||||
let (glyph_bank, sound_bank) = Self::bank_telemetry_summary(hw);
|
||||
self.atomic_telemetry
|
||||
.gfx_used_bytes
|
||||
.store(gfx_stats.used_bytes, Ordering::Relaxed);
|
||||
.glyph_slots_used
|
||||
.store(glyph_bank.used_slots as u32, Ordering::Relaxed);
|
||||
self.atomic_telemetry
|
||||
.gfx_inflight_bytes
|
||||
.store(gfx_stats.inflight_bytes, Ordering::Relaxed);
|
||||
.glyph_slots_total
|
||||
.store(glyph_bank.total_slots as u32, Ordering::Relaxed);
|
||||
self.atomic_telemetry
|
||||
.gfx_slots_occupied
|
||||
.store(gfx_stats.slots_occupied as u32, Ordering::Relaxed);
|
||||
|
||||
let audio_stats = hw.assets().bank_info(BankType::SOUNDS);
|
||||
.sound_slots_used
|
||||
.store(sound_bank.used_slots as u32, Ordering::Relaxed);
|
||||
self.atomic_telemetry
|
||||
.audio_used_bytes
|
||||
.store(audio_stats.used_bytes, Ordering::Relaxed);
|
||||
self.atomic_telemetry
|
||||
.audio_inflight_bytes
|
||||
.store(audio_stats.inflight_bytes, Ordering::Relaxed);
|
||||
self.atomic_telemetry
|
||||
.audio_slots_occupied
|
||||
.store(audio_stats.slots_occupied as u32, Ordering::Relaxed);
|
||||
.sound_slots_total
|
||||
.store(sound_bank.total_slots as u32, Ordering::Relaxed);
|
||||
|
||||
self.atomic_telemetry
|
||||
.heap_used_bytes
|
||||
@@ -165,7 +171,9 @@ impl VirtualMachineRuntime {
|
||||
|
||||
let current_frame_logs =
|
||||
self.atomic_telemetry.current_logs_count.load(Ordering::Relaxed);
|
||||
self.atomic_telemetry.logs_count.store(current_frame_logs, Ordering::Relaxed);
|
||||
self.atomic_telemetry
|
||||
.logs_count
|
||||
.store(current_frame_logs, Ordering::Relaxed);
|
||||
|
||||
let ts_ms = self.boot_time.elapsed().as_millis() as u64;
|
||||
let telemetry_snapshot = self.atomic_telemetry.snapshot();
|
||||
@@ -210,23 +218,19 @@ impl VirtualMachineRuntime {
|
||||
|
||||
// 2. High-frequency telemetry update (only if inspection is active)
|
||||
if self.inspection_active {
|
||||
let gfx_stats = hw.assets().bank_info(BankType::GLYPH);
|
||||
self.atomic_telemetry.gfx_used_bytes.store(gfx_stats.used_bytes, Ordering::Relaxed);
|
||||
let (glyph_bank, sound_bank) = Self::bank_telemetry_summary(hw);
|
||||
self.atomic_telemetry
|
||||
.gfx_inflight_bytes
|
||||
.store(gfx_stats.inflight_bytes, Ordering::Relaxed);
|
||||
.glyph_slots_used
|
||||
.store(glyph_bank.used_slots as u32, Ordering::Relaxed);
|
||||
self.atomic_telemetry
|
||||
.gfx_slots_occupied
|
||||
.store(gfx_stats.slots_occupied as u32, Ordering::Relaxed);
|
||||
|
||||
let audio_stats = hw.assets().bank_info(BankType::SOUNDS);
|
||||
self.atomic_telemetry.audio_used_bytes.store(audio_stats.used_bytes, Ordering::Relaxed);
|
||||
.glyph_slots_total
|
||||
.store(glyph_bank.total_slots as u32, Ordering::Relaxed);
|
||||
self.atomic_telemetry
|
||||
.audio_inflight_bytes
|
||||
.store(audio_stats.inflight_bytes, Ordering::Relaxed);
|
||||
.sound_slots_used
|
||||
.store(sound_bank.used_slots as u32, Ordering::Relaxed);
|
||||
self.atomic_telemetry
|
||||
.audio_slots_occupied
|
||||
.store(audio_stats.slots_occupied as u32, Ordering::Relaxed);
|
||||
.sound_slots_total
|
||||
.store(sound_bank.total_slots as u32, Ordering::Relaxed);
|
||||
|
||||
self.atomic_telemetry
|
||||
.heap_used_bytes
|
||||
|
||||
Reference in New Issue
Block a user