mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-10 17:01:24 +12:00
lv2: sys_timer_usleep improvements for linux
-The minimum quantum on linux appears to be 50 microseconds by default, not 100 -Do not wait for the last quantum to avoid sleeping too long
This commit is contained in:
parent
9ce7b8a401
commit
31afd046b0
1 changed files with 8 additions and 2 deletions
|
@ -294,7 +294,8 @@ error_code sys_timer_usleep(ppu_thread& ppu, u64 sleep_time)
|
||||||
if (sleep_time)
|
if (sleep_time)
|
||||||
{
|
{
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
constexpr u32 host_min_quantum = 100;
|
// TODO: Confirm whether Apple or any BSD can benefit from this as well
|
||||||
|
constexpr u32 host_min_quantum = 50;
|
||||||
#else
|
#else
|
||||||
// Host scheduler quantum for windows (worst case)
|
// Host scheduler quantum for windows (worst case)
|
||||||
// NOTE: On ps3 this function has very high accuracy
|
// NOTE: On ps3 this function has very high accuracy
|
||||||
|
@ -317,8 +318,13 @@ error_code sys_timer_usleep(ppu_thread& ppu, u64 sleep_time)
|
||||||
|
|
||||||
if (remaining > host_min_quantum)
|
if (remaining > host_min_quantum)
|
||||||
{
|
{
|
||||||
// Wait on multiple of min quantum for large durations
|
#ifdef __linux__
|
||||||
|
// Do not wait for the last quantum to avoid loss of accuracy
|
||||||
|
thread_ctrl::wait_for(remaining - ((remaining % host_min_quantum) + host_min_quantum));
|
||||||
|
#else
|
||||||
|
// Wait on multiple of min quantum for large durations to avoid overloading low thread cpus
|
||||||
thread_ctrl::wait_for(remaining - (remaining % host_min_quantum));
|
thread_ctrl::wait_for(remaining - (remaining % host_min_quantum));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue