OLD | NEW |
(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 |
OLD | NEW |