cli: avoid some overhead with DISPLAY_FPS defined
Avoid a call to SDL_GetTicks() which in turn call the gettimeofday() syscall when DISPLAY_FPS() is defined.
This commit is contained in:
parent
18349689c8
commit
3713c1ba7f
|
@ -494,7 +494,6 @@ int main(int argc, char ** argv) {
|
||||||
u32 fps_timing = 0;
|
u32 fps_timing = 0;
|
||||||
u32 fps_frame_counter = 0;
|
u32 fps_frame_counter = 0;
|
||||||
u32 fps_previous_time = 0;
|
u32 fps_previous_time = 0;
|
||||||
u32 fps_temp_time;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef INCLUDE_OPENGL_2D
|
#ifdef INCLUDE_OPENGL_2D
|
||||||
|
@ -730,8 +729,13 @@ int main(int argc, char ** argv) {
|
||||||
desmume_cycle(&ctrls_cfg);
|
desmume_cycle(&ctrls_cfg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !my_config.disable_limiter && !ctrls_cfg.boost) {
|
#ifdef DISPLAY_FPS
|
||||||
int now = SDL_GetTicks();
|
int now = SDL_GetTicks();
|
||||||
|
#endif
|
||||||
|
if ( !my_config.disable_limiter && !ctrls_cfg.boost) {
|
||||||
|
#ifndef DISPLAY_FPS
|
||||||
|
int now = SDL_GetTicks();
|
||||||
|
#endif
|
||||||
int delay = (limiter_tick0 + limiter_frame_counter*1000/FPS_LIMITER_FPS) - now;
|
int delay = (limiter_tick0 + limiter_frame_counter*1000/FPS_LIMITER_FPS) - now;
|
||||||
if (delay > 0) {
|
if (delay > 0) {
|
||||||
SDL_Delay(delay);
|
SDL_Delay(delay);
|
||||||
|
@ -745,9 +749,8 @@ int main(int argc, char ** argv) {
|
||||||
|
|
||||||
#ifdef DISPLAY_FPS
|
#ifdef DISPLAY_FPS
|
||||||
fps_frame_counter += 1;
|
fps_frame_counter += 1;
|
||||||
fps_temp_time = SDL_GetTicks();
|
fps_timing += now - fps_previous_time;
|
||||||
fps_timing += fps_temp_time - fps_previous_time;
|
fps_previous_time = now;
|
||||||
fps_previous_time = fps_temp_time;
|
|
||||||
|
|
||||||
if ( fps_frame_counter == NUM_FRAMES_TO_TIME) {
|
if ( fps_frame_counter == NUM_FRAMES_TO_TIME) {
|
||||||
char win_title[20];
|
char win_title[20];
|
||||||
|
|
Loading…
Reference in New Issue