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
This commit is contained in:
Jan Beich 2018-06-30 22:41:59 +00:00
Родитель b4b1cd3887
Коммит 061b467f45
1 изменённых файлов: 2 добавлений и 10 удалений

Просмотреть файл

@ -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