Reduce amount of read_processor_time() calls.

This commit is contained in:
Toni Wilen 2024-09-15 18:07:14 +03:00
parent 8c1f651632
commit c10655ea60
2 changed files with 17 additions and 2 deletions

View File

@ -12196,8 +12196,9 @@ static bool framewait(void)
}
}
}
idletime += read_processor_time() - start;
curr_time = read_processor_time();
evt_t tnow = read_processor_time();
idletime += tnow - start;
curr_time = tnow;
vsyncmintime = curr_time;
vsyncmaxtime = vsyncwaittime = curr_time + vstb;
if (frame_rendered) {

View File

@ -25,6 +25,7 @@ static const int pissoff_nojit_value = 256 * CYCLE_UNIT;
evt_t event_cycles, nextevent, currcycle;
int is_syncline;
static int syncline_cnt;
frame_time_t is_syncline_end;
int cycles_to_next_event;
int max_cycles_to_next_event;
@ -266,6 +267,19 @@ void do_cycles_slow(int cycles_to_add)
#endif
#endif
if (syncline_cnt > 0) {
syncline_cnt--;
return;
}
if (is_syncline) {
// runs CPU emulation with chipset stopped
// when there is free time to do so
if (event_check_vsync()) {
syncline_cnt = 16;
return;
}
}
if (!currprefs.cpu_thread) {
if ((pissoff -= cycles_to_add) >= 0)
return;