Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(38)

Side by Side Diff: base/task_scheduler/initialization_util.cc

Issue 2501203002: Move function to compute the max number of threads in a TaskScheduler pool to base/. (Closed)
Patch Set: do no build on nacl Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "base/task_scheduler/initialization_util.h"
6
7 #include <algorithm>
8
9 #include "base/sys_info.h"
10
11 namespace base {
12
13 int RecommendedMaxNumberOfThreadsInPool(int min,
14 int max,
15 double cores_multiplier,
16 int offset) {
17 const int num_of_cores = SysInfo::NumberOfProcessors();
18 const int threads = std::ceil<int>(num_of_cores * cores_multiplier) + offset;
19 return std::min(max, std::max(min, threads));
20 }
21
22 } // namespace base
OLDNEW
« no previous file with comments | « base/task_scheduler/initialization_util.h ('k') | components/task_scheduler_util/initialization_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698