sysinfo.cpp: Relax TSC calibration constraints

This commit is contained in:
Elad 2025-12-21 17:49:57 +02:00
parent 6647c5a2bd
commit 60c9705a7d
2 changed files with 12 additions and 6 deletions

View File

@ -4142,12 +4142,9 @@ extern void ppu_precompile(std::vector<std::string>& dir_queue, std::vector<ppu_
continue; continue;
} }
//std::unique_lock lock(g_fxo->get<jit_core_allocator>().sem);
if (auto prx = ppu_load_prx(obj, true, path, offset)) if (auto prx = ppu_load_prx(obj, true, path, offset))
{ {
obj.clear(), src.close(); // Clear decrypted file and elf object memory obj.clear(), src.close(); // Clear decrypted file and elf object memory
//.unlock();
ppu_initialize(*prx, false, file_size); ppu_initialize(*prx, false, file_size);
ppu_finalize(*prx, true); ppu_finalize(*prx, true);
continue; continue;

View File

@ -928,13 +928,22 @@ static const bool s_tsc_freq_evaluated = []() -> bool
} }
#ifdef _WIN32 #ifdef _WIN32
LARGE_INTEGER freq; LARGE_INTEGER freq{};
if (!QueryPerformanceFrequency(&freq)) if (!QueryPerformanceFrequency(&freq))
{ {
return 0; return 0;
} }
if (freq.QuadPart <= 9'999'999) if (!freq.QuadPart)
{
return 0;
}
// Theoretical constraint for the function itself to operate properly
// Unlikely to be unmet
constexpr LONGLONG min_supported_QPC_frequency = 50'000;
if (freq.QuadPart <= min_supported_QPC_frequency)
{ {
return 0; return 0;
} }
@ -1006,7 +1015,7 @@ static const bool s_tsc_freq_evaluated = []() -> bool
const ullong sec_base = ts0.tv_sec; const ullong sec_base = ts0.tv_sec;
#endif #endif
constexpr usz sleep_time_ms = 40; const usz sleep_time_ms = timer_freq <= 300'000 ? (300'000 * 50) / timer_freq : 50;
for (usz sample = 0; sample < sample_count; sample++) for (usz sample = 0; sample < sample_count; sample++)
{ {