mirror of
https://github.com/mattrberry/crab.git
synced 2024-11-16 19:49:30 +01:00
add cpu usage meter under experimental settings
This commit is contained in:
parent
51a9de443a
commit
b73bad6ae2
3 changed files with 6 additions and 0 deletions
|
@ -60,6 +60,8 @@ class GBAController < Controller
|
|||
ImGui.window("Experimental Settings", pointerof(@experimental_settings)) do
|
||||
ImGui.checkbox("Attempt waitloop detection", pointerof(@emu.cpu.attempt_waitloop_detection))
|
||||
ImGui.checkbox("Cache waitloop results", pointerof(@emu.cpu.cache_waitloop_results))
|
||||
progress = emu.cpu.count_cycles.to_f32 / 280896_f32
|
||||
ImGui.progress_bar(progress, ImGui::ImVec2.new(0, 0));
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -134,6 +134,8 @@ module GBA
|
|||
end
|
||||
end
|
||||
|
||||
property count_cycles = 0
|
||||
|
||||
def tick : Nil
|
||||
unless @halted
|
||||
instr = read_instr
|
||||
|
@ -144,6 +146,7 @@ module GBA
|
|||
arm_execute instr
|
||||
end
|
||||
cycles, @gba.bus.cycles = @gba.bus.cycles, 0
|
||||
@count_cycles += cycles
|
||||
if @entered_waitloop
|
||||
@gba.scheduler.fast_forward
|
||||
@entered_waitloop = false
|
||||
|
|
|
@ -49,6 +49,7 @@ module GBA
|
|||
end
|
||||
|
||||
def run_until_frame : Nil
|
||||
cpu.count_cycles = 0
|
||||
until ppu.frame
|
||||
cpu.tick
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue