コード例 #1
0
ファイル: emu.c プロジェクト: alberthdev/CEmu
void throttle_interval_event(int index) {
    event_repeat(index, 27000000 / 60);

    gui_do_stuff();

    throttle_timer_wait();
}
コード例 #2
0
ファイル: emu.cpp プロジェクト: nspire-emus/firebird
void throttle_interval_event(int index)
{
    event_repeat(index, 27000000 / 100);

    /* Throttle interval (defined arbitrarily as 100Hz) - used for
     * keeping the emulator speed down, and other miscellaneous stuff
     * that needs to be done periodically */
    static int intervals = 0, prev_intervals = 0;
    intervals += 1;

    usblink_timer();

    usblink_queue_do();

    int c = gui_getchar();
    if(c != -1)
        serial_byte_in((char) c);

    gdbstub_recv();

    rdebug_recv();

    // Calculate speed
    auto interval_end = std::chrono::high_resolution_clock::now();
    static auto prev = interval_end;
    static double speed = 1.0;
    auto time = std::chrono::duration_cast<std::chrono::microseconds>(interval_end - prev).count();
    if (time >= 500000) {
        speed = (double)10000 * (intervals - prev_intervals) / time;
        gui_show_speed(speed);
        prev_intervals = intervals;
        prev = interval_end;
    }

    gui_do_stuff(true);

    if (!turbo_mode)
        throttle_timer_wait();
}
コード例 #3
0
ファイル: emu.cpp プロジェクト: Vogtinator/CEmu
void throttle_interval_event(int index) {
    event_repeat(index, 27000000 / 60);

    static int intervals = 0, prev_intervals = 0;
    intervals += 1;

    // Calculate speed
    auto interval_end = std::chrono::high_resolution_clock::now();
    static auto prev = interval_end;
    static double speed = 1.0;
    auto time = std::chrono::duration_cast<std::chrono::microseconds>(interval_end - prev).count();
    if (time >= 500000) {
        speed = (double)10000 * (intervals - prev_intervals) / time;
        prev_intervals = intervals;
        prev = interval_end;
    }

    gui_do_stuff(true);

    if (speed > 0.7) {
        throttle_timer_wait();
    }
}