System: Allow host to set async worker count
For regtest.
This commit is contained in:
parent
e41f179108
commit
08d2586a86
|
@ -115,8 +115,6 @@ SystemBootParameters::~SystemBootParameters() = default;
|
|||
|
||||
namespace System {
|
||||
|
||||
static constexpr u32 NUM_ASYNC_WORKER_THREADS = 2;
|
||||
|
||||
static constexpr float PRE_FRAME_SLEEP_UPDATE_INTERVAL = 1.0f;
|
||||
static constexpr const char FALLBACK_EXE_NAME[] = "PSX.EXE";
|
||||
static constexpr u32 MAX_SKIPPED_DUPLICATE_FRAME_COUNT = 2; // 20fps minimum
|
||||
|
@ -497,7 +495,7 @@ void System::ProcessShutdown()
|
|||
CPU::CodeCache::ProcessShutdown();
|
||||
}
|
||||
|
||||
bool System::CPUThreadInitialize(Error* error)
|
||||
bool System::CPUThreadInitialize(Error* error, u32 async_worker_thread_count)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
// On Win32, we have a bunch of things which use COM (e.g. SDL, Cubeb, etc).
|
||||
|
@ -516,7 +514,7 @@ bool System::CPUThreadInitialize(Error* error)
|
|||
|
||||
LogStartupInformation();
|
||||
|
||||
s_state.async_task_queue.SetWorkerCount(NUM_ASYNC_WORKER_THREADS);
|
||||
s_state.async_task_queue.SetWorkerCount(async_worker_thread_count);
|
||||
|
||||
GPUThread::Internal::ProcessStartup();
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ bool ProcessStartup(Error* error);
|
|||
void ProcessShutdown();
|
||||
|
||||
/// Called on CPU thread initialization.
|
||||
bool CPUThreadInitialize(Error* error);
|
||||
bool CPUThreadInitialize(Error* error, u32 async_worker_thread_count);
|
||||
|
||||
/// Called on CPU thread shutdown.
|
||||
void CPUThreadShutdown();
|
||||
|
|
|
@ -77,6 +77,9 @@ LOG_CHANNEL(Host);
|
|||
static constexpr u32 SETTINGS_VERSION = 3;
|
||||
static constexpr u32 SETTINGS_SAVE_DELAY = 1000;
|
||||
|
||||
/// Use two async worker threads, should be enough for most tasks.
|
||||
static constexpr u32 NUM_ASYNC_WORKER_THREADS = 2;
|
||||
|
||||
/// Interval at which the controllers are polled when the system is not active.
|
||||
static constexpr u32 BACKGROUND_CONTROLLER_POLLING_INTERVAL = 100;
|
||||
|
||||
|
@ -1844,7 +1847,7 @@ void EmuThread::run()
|
|||
// input source setup must happen on emu thread
|
||||
{
|
||||
Error startup_error;
|
||||
if (!System::CPUThreadInitialize(&startup_error))
|
||||
if (!System::CPUThreadInitialize(&startup_error, NUM_ASYNC_WORKER_THREADS))
|
||||
{
|
||||
moveToThread(m_ui_thread);
|
||||
Host::ReportFatalError("Fatal Startup Error", startup_error.GetDescription());
|
||||
|
|
|
@ -813,7 +813,8 @@ int main(int argc, char* argv[])
|
|||
if (!RegTestHost::SetNewDataRoot(autoboot->filename))
|
||||
return EXIT_FAILURE;
|
||||
|
||||
if (!System::CPUThreadInitialize(&startup_error))
|
||||
// Only one async worker.
|
||||
if (!System::CPUThreadInitialize(&startup_error, 1))
|
||||
{
|
||||
ERROR_LOG("CPUThreadInitialize() failed: {}", startup_error.GetDescription());
|
||||
return EXIT_FAILURE;
|
||||
|
|
Loading…
Reference in New Issue