launch_daemon: Increased the number of worker threads.

* Since we're disk bound, and not CPU bound, it doesn't make much sense
  to restrict the number of threads on the number of CPUs.
* It's still not completely independent of the number of CPUs now,
  though: we'll have 3 * CPU count worker threads.
This commit is contained in:
Axel Dörfler
2015-10-18 13:11:26 +02:00
parent 4ae4b3ff57
commit a1406a012e
2 changed files with 7 additions and 4 deletions
+6 -3
View File
@@ -10,6 +10,8 @@
static const bigtime_t kWorkerTimeout = 1000000;
// One second until a worker thread quits without a job
static const int32 kWorkerCountPerCPU = 3;
static int32 sWorkerCount;
@@ -91,12 +93,13 @@ Worker::_Process(void* _self)
MainWorker::MainWorker(JobQueue& queue)
:
Worker(queue)
Worker(queue),
fMaxWorkerCount(kWorkerCountPerCPU)
{
// TODO: keep track of workers, and quit them on destruction
system_info info;
if (get_system_info(&info) == B_OK)
fCPUCount = info.cpu_count;
fMaxWorkerCount = info.cpu_count * kWorkerCountPerCPU;
}
@@ -116,7 +119,7 @@ MainWorker::Run(BJob* job)
if (jobCount > INT_MAX)
jobCount = INT_MAX;
if ((int32)jobCount > count && count < fCPUCount) {
if ((int32)jobCount > count && count < fMaxWorkerCount) {
Worker* worker = new Worker(fJobQueue);
worker->Init();
}
+1 -1
View File
@@ -44,7 +44,7 @@ protected:
virtual status_t Run(BJob* job);
private:
int32 fCPUCount;
int32 fMaxWorkerCount;
};