Skip to content

Commit

Permalink
ui: Macro out some variables only used for debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
mborgerson committed Dec 30, 2024
1 parent feee2f1 commit 67053d1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ui/xemu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1225,8 +1225,10 @@ void sdl2_gl_refresh(DisplayChangeListener *dcl)
static int64_t last_update = 0;
int64_t deadline = last_update + 16666666;

#ifdef DEBUG_XEMU_C
int64_t sleep_acc = 0;
int64_t spin_acc = 0;
#endif

#ifndef _WIN32
const int64_t sleep_threshold = 2000000;
Expand All @@ -1241,12 +1243,16 @@ void sdl2_gl_refresh(DisplayChangeListener *dcl)
if (time_remaining > sleep_threshold) {
// Try to sleep until the until reaching the sleep threshold.
sleep_ns(time_remaining - sleep_threshold);
#ifdef DEBUG_XEMU_C
sleep_acc += qemu_clock_get_ns(QEMU_CLOCK_REALTIME)-now;
#endif
} else {
// Simply spin to avoid extra delays incurred with swapping to
// another process and back in the event of being within
// threshold to desired event.
#ifdef DEBUG_XEMU_C
spin_acc++;
#endif
}
} else {
DPRINTF("zzZz %g %ld\n", (double)sleep_acc/1000000.0, spin_acc);
Expand Down

0 comments on commit 67053d1

Please sign in to comment.