Closed branlwyd closed 11 years ago
This may not be such a good idea now that the debugger is in & depends on the cyclesElapsed()
call. If cyclesElapsed()
was called only once every n steps, stepping the debugger would actually skip n instructions!
The device step loop is a huge performance issue. But definietely don't do the original suggestion. Instead, experiment with the following change:
step()
(aka cyclesElapsed()
) on every device after every step.Cpu.schedStep(Device, cycles)
or the like.step()
on the device.Can use a simple priority queue-like structure. Most hardware doesn't refresh more than every 1/60 of a second = ~1666 cycles; on fast (no wakeups) path I am trading the loop over every device for a single addition.
Difficulty in handling keyboard, since it's hanging out on another thread and there's no pattern to when its interrupts occur. Can schedule a fast-ish timer when interrupts are enabled--no perf loss when they're disabled.
Switched to a scheduled-wakeup model in e204532db8c51824b576feaea4e2b907f2da37c9. Closing.
See comment below.
Currently, every call toCpu.step()
loops through the attached hardware and notifies each device that some cycles have elapsed. While this allows for accurate hardware simulation, this loop is slowing us down (I think).Determine if this is actually a performance issue.Add option to only occasionally callcyclesElapsed()
. Should this be per-number-of-instructions or per-number-of-cycles?