Example #1
0
def test_profiling():
    pyboy = PyBoy(any_rom,
                  window_type="dummy",
                  bootrom_file=utils.boot_rom,
                  profiling=True)
    pyboy.tick()

    hitrate = pyboy._get_cpu_hitrate()
    CHECK_SUM = 7546
    assert sum(
        hitrate
    ) == CHECK_SUM, "The amount of instructions called in the first frame of the boot-ROM has changed"

    assert list(main.profiling_printer(hitrate)) == [
        ' 32       LD (HL-),A 2515',
        '17c          BIT 7,H 2514',
        ' 20         JR NZ,r8 2514',
        ' af            XOR A 1',
        ' 31        LD SP,d16 1',
        ' 21        LD HL,d16 1',
    ], "The output of the profiling formatter has changed. Either the output is wrong, or the formatter has changed."
    pyboy.stop(save=False)
Example #2
0
def test_profiling():
    pyboy = PyBoy(default_rom,
                  window_type="dummy",
                  bootrom_file=boot_rom,
                  profiling=True)
    pyboy.set_emulation_speed(0)
    pyboy.tick()

    hitrate = pyboy._cpu_hitrate()
    CHECK_SUM = 7524
    assert sum(
        hitrate
    ) == CHECK_SUM, "The amount of instructions called in the first frame of the boot-ROM has changed"

    assert list(main.profiling_printer(hitrate)) == [
        "17c          BIT 7,H 2507",
        " 32       LD (HL-),A 2507",
        " 20         JR NZ,r8 2507",
        " af            XOR A 1",
        " 31        LD SP,d16 1",
        " 21        LD HL,d16 1",
    ], "The output of the profiling formatter has changed. Either the output is wrong, or the formatter has changed."
    pyboy.stop(save=False)