let the CPU sleep for 1 ms if there is no tic to proceed

This brings CPU usage down from 100% to ~18% on my system - just like
Chocolate Doom.
This commit is contained in:
Fabian Greffrath 2019-12-23 13:12:29 +01:00
parent 7af1150cb1
commit 15131a1cc2
3 changed files with 7 additions and 0 deletions

View File

@ -758,6 +758,7 @@ void TryRunTics (void)
M_Ticker ();
return;
}
I_Sleep(1);
}
// run the count * ticdup dics

View File

@ -59,6 +59,11 @@ void I_WaitVBL(int count)
SDL_Delay((count*500)/TICRATE);
}
void I_Sleep(int ms)
{
SDL_Delay(ms);
}
// Most of the following has been rewritten by Lee Killough
//
// I_GetTime

View File

@ -47,6 +47,7 @@ void I_FinishUpdate (void);
// Wait for vertical retrace or pause a bit.
void I_WaitVBL(int count);
void I_Sleep(int ms);
void I_ReadScreen (byte* scr);