Include inline functions when profiling
This commit is contained in:
+17
-2
@@ -6,7 +6,9 @@ use std::{
|
||||
use anyhow::Result;
|
||||
use tokio::{select, sync::mpsc};
|
||||
|
||||
use crate::emulator::{EmulatorClient, EmulatorCommand, GameInfo, ProfileEvent, SimEvent, SimId};
|
||||
use crate::emulator::{
|
||||
EmulatorClient, EmulatorCommand, GameInfo, InlineStack, ProfileEvent, SimEvent, SimId,
|
||||
};
|
||||
use recording::Recording;
|
||||
use state::ProgramState;
|
||||
|
||||
@@ -131,11 +133,18 @@ async fn run_profile(
|
||||
async fn handle_event(event: ProfileEvent, session: &mut ProfilerSession) -> Result<()> {
|
||||
match event {
|
||||
ProfileEvent::Start { info } => session.start_profiling(info).await,
|
||||
ProfileEvent::Update { cycles, event } => {
|
||||
ProfileEvent::Update {
|
||||
cycles,
|
||||
event,
|
||||
inline_stack,
|
||||
} => {
|
||||
session.track_elapsed_cycles(cycles);
|
||||
if let Some(event) = event {
|
||||
session.track_event(event)?;
|
||||
}
|
||||
if let Some(stack) = inline_stack {
|
||||
session.track_inline_stack(stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
@@ -233,6 +242,12 @@ impl ProfilerSession {
|
||||
}
|
||||
}
|
||||
|
||||
fn track_inline_stack(&mut self, inline_stack: InlineStack) {
|
||||
if let Some(program) = &mut self.program {
|
||||
program.track_inline_stack(inline_stack);
|
||||
}
|
||||
}
|
||||
|
||||
fn start_recording(&mut self) {
|
||||
if let Some(program) = &self.program {
|
||||
self.recording = Some(Recording::new(program));
|
||||
|
||||
Reference in New Issue
Block a user