Bug 1455694 - Record the number of CPU cores in the profile. r=mstange

MozReview-Commit-ID: 3S6KV4apUwG

--HG--
extra : rebase_source : bcd2f83024dfb7af7c833a5cbbd5fd1b6f082e65
This commit is contained in:
Panos Astithas 2018-05-30 22:15:30 -07:00
Родитель fc2ed6e92a
Коммит 15b7539570
1 изменённых файлов: 15 добавлений и 0 удалений

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

@ -55,6 +55,7 @@
#include "ThreadInfo.h"
#include "nsIHttpProtocolHandler.h"
#include "nsIObserverService.h"
#include "nsIPropertyBag2.h"
#include "nsIXULAppInfo.h"
#include "nsIXULRuntime.h"
#include "nsDirectoryServiceUtils.h"
@ -1663,6 +1664,20 @@ StreamMetaJSCustomObject(PSLockRef aLock, SpliceableJSONWriter& aWriter,
aWriter.StringProperty("sourceURL", string.Data());
}
nsCOMPtr<nsIPropertyBag2> systemInfo =
do_GetService("@mozilla.org/system-info;1");
if (systemInfo) {
int32_t cpus;
res = systemInfo->GetPropertyAsInt32(NS_LITERAL_STRING("cpucores"), &cpus);
if (!NS_FAILED(res)) {
aWriter.IntProperty("physicalCPUs", cpus);
}
res = systemInfo->GetPropertyAsInt32(NS_LITERAL_STRING("cpucount"), &cpus);
if (!NS_FAILED(res)) {
aWriter.IntProperty("logicalCPUs", cpus);
}
}
// We should avoid collecting extension metadata for profiler while XPCOM is
// shutting down since it cannot create a new ExtensionPolicyService.
if (!gXPCOMShuttingDown) {