Implement PPU usleep control setting hack

This commit is contained in:
Eladash 2022-09-03 09:58:06 +03:00 committed by Elad Ashkenazi
parent 30a5d646ec
commit e27e6c0b2d
2 changed files with 13 additions and 0 deletions

View file

@ -447,6 +447,18 @@ error_code sys_timer_usleep(ppu_thread& ppu, u64 sleep_time)
if (sleep_time)
{
const s64 add_time = g_cfg.core.usleep_addend;
// Over/underflow checks
if (add_time >= 0)
{
sleep_time = utils::add_saturate<u64>(sleep_time, add_time);
}
else
{
sleep_time = std::max<u64>(1, utils::sub_saturate<u64>(sleep_time, -add_time));
}
lv2_obj::sleep(ppu, g_cfg.core.sleep_timers_accuracy < sleep_timers_accuracy_level::_usleep ? sleep_time : 0);
if (!lv2_obj::wait_timeout(sleep_time, &ppu, true, true))

View file

@ -99,6 +99,7 @@ struct cfg_root : cfg::node
#else
cfg::_enum<sleep_timers_accuracy_level> sleep_timers_accuracy{ this, "Sleep Timers Accuracy", sleep_timers_accuracy_level::_usleep, true };
#endif
cfg::_int<-1000, 1500> usleep_addend{ this, "Usleep Time Addend", 0, true };
cfg::uint64 perf_report_threshold{this, "Performance Report Threshold", 500, true}; // In µs, 0.5ms = default, 0 = everything
cfg::_bool perf_report{this, "Enable Performance Report", false, true}; // Show certain perf-related logs