mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-25 22:10:59 +00:00
Never sleep between frames with timedemo
This commit is contained in:
parent
012862b58d
commit
fa1f5c2c84
1 changed files with 22 additions and 19 deletions
|
@ -142,33 +142,36 @@ Qcommon_Mainloop(void)
|
|||
while (1)
|
||||
{
|
||||
#ifndef DEDICATED_ONLY
|
||||
// Throttle the game a little bit.
|
||||
if (busywait->value)
|
||||
if (!cl_timedemo->value)
|
||||
{
|
||||
long long spintime = Sys_Microseconds();
|
||||
|
||||
while (1)
|
||||
// Throttle the game a little bit.
|
||||
if (busywait->value)
|
||||
{
|
||||
/* Give the CPU a hint that this is a very tight
|
||||
spinloop. One PAUSE instruction each loop is
|
||||
enough to reduce power consumption and head
|
||||
dispersion a lot, it's 95°C against 67°C on
|
||||
a Kaby Lake laptop. */
|
||||
long long spintime = Sys_Microseconds();
|
||||
|
||||
while (1)
|
||||
{
|
||||
/* Give the CPU a hint that this is a very tight
|
||||
spinloop. One PAUSE instruction each loop is
|
||||
enough to reduce power consumption and head
|
||||
dispersion a lot, it's 95°C against 67°C on
|
||||
a Kaby Lake laptop. */
|
||||
#if defined (__GNUC__) && (__i386 || __x86_64__)
|
||||
asm("pause");
|
||||
asm("pause");
|
||||
#elif defined(__aarch64__) || (defined(__ARM_ARCH) && __ARM_ARCH >= 7) || defined(__ARM_ARCH_6K__)
|
||||
asm("yield");
|
||||
asm("yield");
|
||||
#endif
|
||||
|
||||
if (Sys_Microseconds() - spintime >= 5)
|
||||
{
|
||||
break;
|
||||
if (Sys_Microseconds() - spintime >= 5)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Sys_Nanosleep(5000);
|
||||
else
|
||||
{
|
||||
Sys_Nanosleep(5000);
|
||||
}
|
||||
}
|
||||
#else
|
||||
Sys_Nanosleep(850000);
|
||||
|
|
Loading…
Reference in a new issue