mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Make use of hyperthreading for worker threads. Still cap to 16 workers.
This commit is contained in:
parent
62eadd2dac
commit
1d59560409
2 changed files with 5 additions and 3 deletions
|
@ -97,15 +97,17 @@ static void WorkerThreadFunc(GlobalThreadContext *global, ThreadContext *thread)
|
|||
}
|
||||
}
|
||||
|
||||
void ThreadManager::Init(int numRealCores, int numLogicalCores) {
|
||||
void ThreadManager::Init(int numRealCores, int numLogicalCoresPerCpu) {
|
||||
if (!global_->threads_.empty()) {
|
||||
Teardown();
|
||||
}
|
||||
|
||||
numComputeThreads_ = std::min(numRealCores, MAX_CORES_TO_USE);
|
||||
numComputeThreads_ = std::min(numRealCores * numLogicalCoresPerCpu, MAX_CORES_TO_USE);
|
||||
int numThreads = numComputeThreads_ + EXTRA_THREADS;
|
||||
numThreads_ = numThreads;
|
||||
|
||||
INFO_LOG(SYSTEM, "ThreadManager::Init(compute threads: %d, all: %d)", numComputeThreads_, numThreads_);
|
||||
|
||||
for (int i = 0; i < numThreads; i++) {
|
||||
ThreadContext *thread = new ThreadContext();
|
||||
thread->cancelled.store(false);
|
||||
|
|
|
@ -44,7 +44,7 @@ public:
|
|||
// The distinction here is to be able to take hyper-threading into account.
|
||||
// It gets even trickier when you think about mobile chips with BIG/LITTLE, but we'll
|
||||
// just ignore it and let the OS handle it.
|
||||
void Init(int numRealCores, int numLogicalCores);
|
||||
void Init(int numCores, int numLogicalCoresPerCpu);
|
||||
void EnqueueTask(Task *task, TaskType taskType);
|
||||
void EnqueueTaskOnThread(int threadNum, Task *task, TaskType taskType);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue