From 7f7a64a1d6ef791d3b111245301d73902e9e4875 Mon Sep 17 00:00:00 2001 From: Waley Chen Date: Thu, 25 Feb 2016 18:09:15 -0500 Subject: SERVER-22398 Add SystemInfo::numAvailableCores --- src/mongo/util/processinfo.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/mongo/util/processinfo.h') diff --git a/src/mongo/util/processinfo.h b/src/mongo/util/processinfo.h index 86305a9babe..7d48fe31aea 100644 --- a/src/mongo/util/processinfo.h +++ b/src/mongo/util/processinfo.h @@ -29,6 +29,7 @@ #pragma once +#include #include #include @@ -88,6 +89,12 @@ public: return sysInfo().memSize / (1024 * 1024); } + /** + * Get the number of available CPUs. Depending on the OS, the number can be the + * number of available CPUs to the current process or scheduler. + */ + boost::optional getNumAvailableCores(); + /** * Get the number of CPUs */ -- cgit v1.2.1