feat(timer): show start/end address of profiled region
This commit is contained in:
parent
0d3c3c28a0
commit
4f40aaa7b2
1 changed files with 4 additions and 1 deletions
|
@ -1,11 +1,14 @@
|
||||||
|
|
||||||
timer = {}
|
timer = {}
|
||||||
|
timer_pos = {}
|
||||||
|
|
||||||
def mem_listener(addr, val, cpu):
|
def mem_listener(addr, val, cpu):
|
||||||
if addr >= 0xa000 and addr <= 0xa0ff:
|
if addr >= 0xa000 and addr <= 0xa0ff:
|
||||||
timer_ix = addr & 0xff
|
timer_ix = addr & 0xff
|
||||||
if timer_ix in timer:
|
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[timer_ix]
|
||||||
|
del timer_pos[timer_ix]
|
||||||
else:
|
else:
|
||||||
timer[timer_ix] = cpu.cycles
|
timer[timer_ix] = cpu.cycles
|
||||||
|
timer_pos[timer_ix] = cpu.pc+2
|
||||||
|
|
Loading…
Reference in a new issue