Skip to content

Commit

Permalink
remove profiler
Browse files Browse the repository at this point in the history
  • Loading branch information
corwinkuiper committed May 25, 2024
1 parent 0c61517 commit 96b03eb
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 29 deletions.
21 changes: 0 additions & 21 deletions agb/src/interrupt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -354,27 +354,6 @@ impl VBlank {
}
}

#[must_use]
/// The behaviour of this function is undefined in the sense that it will output
/// some information in some way that can be interpreted in a way to give some
/// profiling information. What it outputs, how it outputs it, and how to
/// interpret it are all subject to change at any time.
///
/// With that out of the way, the current version will, in mgba, output the
/// program counter at regular intervals. This can be used to see hot functions
/// using, for example, addr2line.
pub fn profiler(timer: &mut crate::timer::Timer, period: u16) -> InterruptHandler {
timer.set_interrupt(true);
timer.set_overflow_amount(period);
timer.set_enabled(true);

unsafe {
add_interrupt_handler(timer.interrupt(), |_key: CriticalSection| {
crate::println!("{:#010x}", crate::program_counter_before_interrupt());
})
}
}

#[cfg(test)]
mod tests {
use portable_atomic::{AtomicU32, AtomicU8};
Expand Down
8 changes: 0 additions & 8 deletions agb/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -423,14 +423,6 @@ pub mod test_runner {
}
}

#[inline(never)]
pub(crate) fn program_counter_before_interrupt() -> u32 {
extern "C" {
static mut agb_rs__program_counter: u32;
}
unsafe { agb_rs__program_counter }
}

#[cfg(test)]
mod test {
use core::ptr::addr_of_mut;
Expand Down

0 comments on commit 96b03eb

Please sign in to comment.