From 4f40aaa7b20c3f58d962ffbc868c63f25894485f Mon Sep 17 00:00:00 2001 From: shokre Date: Fri, 19 Nov 2021 20:29:25 +0100 Subject: [PATCH] feat(timer): show start/end address of profiled region --- orao/timer.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/orao/timer.py b/orao/timer.py index 4f3a604..abef45b 100644 --- a/orao/timer.py +++ b/orao/timer.py @@ -1,11 +1,14 @@ timer = {} +timer_pos = {} def mem_listener(addr, val, cpu): if addr >= 0xa000 and addr <= 0xa0ff: timer_ix = addr & 0xff if timer_ix in timer: - print('timer(%s):duration %d cy' % (timer_ix, cpu.cycles - timer[timer_ix] - 4)) + print('timer(%3d:%04x-%04x):duration %d cy' % (timer_ix, timer_pos[timer_ix], cpu.pc-1, cpu.cycles - timer[timer_ix] - 4)) del timer[timer_ix] + del timer_pos[timer_ix] else: timer[timer_ix] = cpu.cycles + timer_pos[timer_ix] = cpu.pc+2