Bug 1473732 - Base default number of OMTP workers on the number of logical CPU cores. r=rhunt
☠☠ backed out by 1161111168cf ☠ ☠
authorJan Beich <jbeich@FreeBSD.org>
Sat, 30 Jun 2018 22:41:59 +0000
changeset 429268 7742f4ea046bee56dd0141e7038ea8a1fefe6139
parent 429267 3354b6d032f3a436e6b2d11987b1c315ecf44c5c
child 429269 5459f3286f111c1366d20ec4fc9891acd827c61e
push id67094
push userccoroiu@mozilla.com
push dateMon, 30 Jul 2018 22:02:32 +0000
treeherderautoland@397b4d841690 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrhunt
bugs1473732
milestone63.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1473732 - Base default number of OMTP workers on the number of logical CPU cores. r=rhunt system-info is a stub on Tier3 platforms while physical vs. logical difference only matters for hyper-threading. As hyper-threading is usually available on CPUs with more than 2 physical cores this change has no impact there as the default is clamped to [1, 4]. However, on Intel i3-* CPUs with 2 physical and 4 logical cores this bumps the default from 1 to 3. MozReview-Commit-ID: 1Yh8rJL2JcN
gfx/layers/PaintThread.cpp
--- a/gfx/layers/PaintThread.cpp
+++ b/gfx/layers/PaintThread.cpp
@@ -17,17 +17,17 @@
 #include "mozilla/layers/ShadowLayers.h"
 #include "mozilla/layers/SyncObject.h"
 #include "mozilla/gfx/2D.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/SharedThreadPool.h"
 #include "mozilla/SyncRunnable.h"
 #include "nsIPropertyBag2.h"
 #include "nsServiceManagerUtils.h"
-#include "nsSystemInfo.h"
+#include "prsystem.h"
 
 // Uncomment the following line to dispatch sync runnables when
 // painting so that rasterization happens synchronously from
 // the perspective of the main thread
 // #define OMTP_FORCE_SYNC
 
 namespace mozilla {
 namespace layers {
@@ -151,25 +151,17 @@ PaintThread::Release()
 void
 PaintThread::AddRef()
 {
 }
 
 /* static */ int32_t
 PaintThread::CalculatePaintWorkerCount()
 {
-  int32_t cpuCores = 1;
-  nsCOMPtr<nsIPropertyBag2> systemInfo = do_GetService(NS_SYSTEMINFO_CONTRACTID);
-  if (systemInfo) {
-    nsresult rv = systemInfo->GetPropertyAsInt32(NS_LITERAL_STRING("cpucores"), &cpuCores);
-    if (NS_FAILED(rv)) {
-      cpuCores = 1;
-    }
-  }
-
+  int32_t cpuCores = PR_GetNumberOfProcessors();
   int32_t workerCount = gfxPrefs::LayersOMTPPaintWorkers();
 
   // If not manually specified, default to (cpuCores * 3) / 4, and clamp
   // between 1 and 4. If a user wants more, they can manually specify it
   if (workerCount < 1) {
     workerCount = std::min(std::max((cpuCores * 3) / 4, 1), 4);
   }