Files
vt1200/harness/mame/timing.lua
T

38 lines
1.2 KiB
Lua

-- How much *emulated* time have we run? Real hardware reaches the font table in
-- ~12 s, so this answers "is the emulator slow, or is the firmware stuck?"
--
-- TIM_FRAMES=1500 <mame> vt1200 ... -autoboot_script harness/mame/timing.lua
--
-- Also reports the screen's frame period, which sets the whole emulated timebase.
local machine = manager.machine
local dbg = machine.debugger
local maxframes = tonumber(os.getenv("TIM_FRAMES") or "1500")
local every = tonumber(os.getenv("TIM_EVERY") or "250")
local n = 0
local t0 = nil
local scr = nil
for _, s in pairs(machine.screens) do scr = s end
if scr then
print(string.format("screen: %dx%d refresh=%.4f Hz frame_period=%.6f s",
scr.width, scr.height, scr.refresh, scr.refresh > 0 and (1.0 / scr.refresh) or 0))
end
emu.register_frame_done(function()
n = n + 1
if t0 == nil then t0 = machine.time:as_double() end
if n % every == 0 then
print(string.format("frame %5d emulated_time=%8.2fs", n, machine.time:as_double()))
end
if n >= maxframes then
local dt = machine.time:as_double() - t0
print(string.format("TOTAL: %d frames = %.2f s emulated (%.4f s/frame)",
maxframes, dt, dt / maxframes))
machine:exit()
end
end, "vt1200-timing")
dbg.execution_state = 'run'