Skip to content
Snippets Groups Projects
Verified Commit 0da5c767 authored by João Magalhães's avatar João Magalhães :rocket:
Browse files

chore: better printing of info

parent 17dc77fb
Branches
Tags
1 merge request!36Support for Python
Pipeline #3604 passed
...@@ -3,12 +3,12 @@ from boytacean import GameBoy, CPU_FREQ ...@@ -3,12 +3,12 @@ from boytacean import GameBoy, CPU_FREQ
CLOCK_COUNT = 100000000 CLOCK_COUNT = 100000000
gb = GameBoy(ppu_enabled=False, apu_enabled=False, serial_enabled=False) gb = GameBoy(apu_enabled=False, serial_enabled=False)
gb.load() gb.load()
gb.load_rom("../../res/roms/demo/pocket.gb") gb.load_rom("../../res/roms/demo/pocket.gb")
start = time() start = time()
cycles = gb.clocks(CLOCK_COUNT) cycles = gb.clocks(CLOCK_COUNT)
total = time() - start total = time() - start
print(f"Time taken: {total} seconds") print(f"Time taken: {total:.2f} seconds")
print(f"Speedup: {cycles / (CPU_FREQ * total)}x") print(f"Speedup: {cycles / (CPU_FREQ * total):.2f}x")
gb.save_image("pocket.png") gb.save_image("pocket.png")
...@@ -10,6 +10,6 @@ start = time() ...@@ -10,6 +10,6 @@ start = time()
for _ in range(FRAME_COUNT): for _ in range(FRAME_COUNT):
gb.next_frame() gb.next_frame()
total = time() - start total = time() - start
print(f"Time taken: {total} seconds") print(f"Time taken: {total:.2f} seconds")
print(f"Speedup: {FRAME_COUNT / total / 60}x") print(f"Speedup: {FRAME_COUNT / total / 60:.2f}x")
gb.save_image("pocket.png") gb.save_image("pocket.png")
...@@ -10,6 +10,6 @@ with PyBoy("../../res/roms/demo/pocket.gb", disable_renderer=True) as pyboy: ...@@ -10,6 +10,6 @@ with PyBoy("../../res/roms/demo/pocket.gb", disable_renderer=True) as pyboy:
for _ in range(FRAME_COUNT): for _ in range(FRAME_COUNT):
pyboy.tick() pyboy.tick()
total = time() - start total = time() - start
print(f"Time taken: {total} seconds") print(f"Time taken: {total:.2f} seconds")
print(f"Speedup: {FRAME_COUNT / total / 60}x") print(f"Speedup: {FRAME_COUNT / total / 60:.2f}x")
pyboy.screen_image().save("pocket_pyboy.png") pyboy.screen_image().save("pocket_pyboy.png")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment