Commit 061b467f authored by Jan Beich's avatar Jan Beich
Browse files

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

--HG--
extra : rebase_source : 77613cbb99c14f19217592080bfd51ea2194422b
parent b4b1cd38
Loading
Loading
Loading
Loading
+2 −10
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@
#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
@@ -156,15 +156,7 @@ 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