Bug 1465924 - Add profile.threads[i].processName which contains "Main Process", or the content process's name like "WebExtensions" - r=gregtatum

This field is in addition to the existing process type fields we already have:
- profile.threads[i].processType contains the string for the GeckoProcessType.
- profile.threads[i].name contains the ThreadInfo name.

Differential Revision: https://phabricator.services.mozilla.com/D10549

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Gerald Squelart 2018-11-02 21:52:32 +00:00
Родитель f991551c31
Коммит 2ce555aca7
1 изменённых файлов: 14 добавлений и 0 удалений

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

@ -6,6 +6,8 @@
#include "ProfiledThreadData.h"
#include "mozilla/dom/ContentChild.h"
#if defined(GP_OS_darwin)
#include <pthread.h>
#endif
@ -124,6 +126,18 @@ StreamSamplesAndMarkers(const char* aName,
XRE_ChildProcessTypeToString(XRE_GetProcessType()));
aWriter.StringProperty("name", aName);
if (XRE_IsParentProcess()) {
aWriter.StringProperty("processName", "Parent Process");
} else if (dom::ContentChild* cc = dom::ContentChild::GetSingleton()) {
// Try to get the process name from ContentChild.
nsAutoCString processName;
cc->GetProcessName(processName);
if (!processName.IsEmpty()) {
aWriter.StringProperty("processName", processName.Data());
}
}
aWriter.IntProperty("tid", static_cast<int64_t>(aThreadId));
aWriter.IntProperty("pid", static_cast<int64_t>(getpid()));