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:
@@ -10,6 +10,8 @@
|
|||||||
static const bigtime_t kWorkerTimeout = 1000000;
|
static const bigtime_t kWorkerTimeout = 1000000;
|
||||||
// One second until a worker thread quits without a job
|
// One second until a worker thread quits without a job
|
||||||
|
|
||||||
|
static const int32 kWorkerCountPerCPU = 3;
|
||||||
|
|
||||||
static int32 sWorkerCount;
|
static int32 sWorkerCount;
|
||||||
|
|
||||||
|
|
||||||
@@ -91,12 +93,13 @@ Worker::_Process(void* _self)
|
|||||||
|
|
||||||
MainWorker::MainWorker(JobQueue& queue)
|
MainWorker::MainWorker(JobQueue& queue)
|
||||||
:
|
:
|
||||||
Worker(queue)
|
Worker(queue),
|
||||||
|
fMaxWorkerCount(kWorkerCountPerCPU)
|
||||||
{
|
{
|
||||||
// TODO: keep track of workers, and quit them on destruction
|
// TODO: keep track of workers, and quit them on destruction
|
||||||
system_info info;
|
system_info info;
|
||||||
if (get_system_info(&info) == B_OK)
|
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)
|
if (jobCount > INT_MAX)
|
||||||
jobCount = INT_MAX;
|
jobCount = INT_MAX;
|
||||||
|
|
||||||
if ((int32)jobCount > count && count < fCPUCount) {
|
if ((int32)jobCount > count && count < fMaxWorkerCount) {
|
||||||
Worker* worker = new Worker(fJobQueue);
|
Worker* worker = new Worker(fJobQueue);
|
||||||
worker->Init();
|
worker->Init();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ protected:
|
|||||||
virtual status_t Run(BJob* job);
|
virtual status_t Run(BJob* job);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int32 fCPUCount;
|
int32 fMaxWorkerCount;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user