Added stats

This commit is contained in:
transistor 2024-03-08 23:38:51 -08:00
parent 8b274f72cc
commit ec74b64984
3 changed files with 30 additions and 2 deletions

View File

@ -37,6 +37,7 @@ pub enum Used {
#[derive(Clone, Debug)]
pub struct M68kCycle {
pub decoder: M68kDecoder,
pub timing: M68kInstructionTiming,
pub memory: M68kBusPort,
@ -67,6 +68,14 @@ impl M68kCycle {
#[inline]
pub fn begin<'a>(mut self, cpu: &'a mut M68k) -> M68kCycleExecutor<'a, bus::BusAdapter<M68kAddress, u64, Instant, &'a mut BusPort>> {
cpu.stats.cycle_number += 1;
if cpu.stats.cycle_number > cpu.stats.last_update {
cpu.stats.last_update = cpu.stats.last_update + 1_000_000;
let now = std::time::SystemTime::now();
log::warn!("{} per million", now.duration_since(cpu.stats.last_time).unwrap().as_micros());
cpu.stats.last_time = now;
}
let adapter = bus::BusAdapter {
bus: &mut cpu.port,
translate: translate_address,

View File

@ -196,12 +196,30 @@ pub enum M68kError<BusError> {
Other(String),
}
#[derive(Clone)]
pub struct M68kStatistics {
pub cycle_number: usize,
pub last_update: usize,
pub last_time: std::time::SystemTime,
}
impl Default for M68kStatistics {
fn default() -> Self {
Self {
cycle_number: 0,
last_update: 0,
last_time: std::time::SystemTime::now(),
}
}
}
#[derive(Clone)]
pub struct M68k {
pub info: CpuInfo,
pub state: M68kState,
pub debugger: M68kDebugger,
pub port: BusPort,
pub stats: M68kStatistics,
pub cycle: Option<M68kCycle>,
}
@ -231,6 +249,7 @@ impl M68k {
state: M68kState::default(),
debugger: M68kDebugger::default(),
port,
stats: Default::default(),
cycle: None,
}
}

View File

@ -1,4 +1,4 @@
Last run on 2024-03-08 at commit b4a35641e4d52349f1d392f749da2e4af561a5e0
Last run on 2024-03-08 at commit 8b274f72ccf6f143e527cb95552f80deedc2fc64
ABCD.json.gz completed: 7993 passed, 72 FAILED
ADD.b.json.gz completed, all passed!
@ -126,4 +126,4 @@ TST.w.json.gz completed, all passed!
UNLINK.json.gz completed, all passed!
passed: 966037, failed: 34023, total 97%
completed in 14m 25s
completed in 13m 59s