Include inline functions when profiling

This commit is contained in:
2025-08-31 23:01:50 -04:00
parent 04c92c1454
commit 841ded3bee
9 changed files with 342 additions and 52 deletions
+16 -9
View File
@@ -18,17 +18,20 @@ use tracing::{error, warn};
use crate::{
audio::Audio,
emulator::cart::Cart,
graphics::TextureSink,
memory::{MemoryRange, MemoryRegion},
};
use cart::Cart;
pub use game_info::GameInfo;
pub use inline_stack_map::InlineStack;
use inline_stack_map::InlineStackMap;
use shrooms_vb_core::{EXPECTED_FRAME_SIZE, Sim, StopReason};
pub use shrooms_vb_core::{SimEvent, VBKey, VBRegister, VBWatchpointType};
mod address_set;
mod cart;
mod game_info;
mod inline_stack_map;
mod shrooms_vb_core;
#[derive(PartialEq, Eq, Hash, Clone, Copy, Debug)]
@@ -231,11 +234,11 @@ impl Emulator {
})
.is_ok()
{
sim.monitor_events(true);
sim.monitor_events(true, cart.info.inline_stack_map().clone());
profiling = true;
}
if !profiling {
sim.monitor_events(false);
sim.monitor_events(false, InlineStackMap::empty());
}
if self.sim_state[index].load(Ordering::Acquire) == SimState::Ready {
@@ -476,15 +479,18 @@ impl Emulator {
if !running {
continue;
}
if let Some(p) = profiler
&& p.send(ProfileEvent::Update {
if let Some(p) = profiler {
let (event, inline_stack) = sim.take_profiler_updates();
if p.send(ProfileEvent::Update {
cycles,
event: sim.take_sim_event(),
event,
inline_stack,
})
.is_err()
{
sim.monitor_events(false);
*profiler = None;
{
sim.monitor_events(false, InlineStackMap::empty());
*profiler = None;
}
}
}
@@ -842,6 +848,7 @@ pub enum ProfileEvent {
Update {
cycles: u32,
event: Option<SimEvent>,
inline_stack: Option<InlineStack>,
},
}