From 2ce555aca7ede5c4e8f1bcaec332d65a15962abe Mon Sep 17 00:00:00 2001 From: Gerald Squelart Date: Fri, 2 Nov 2018 21:52:32 +0000 Subject: [PATCH] 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 --- tools/profiler/core/ProfiledThreadData.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tools/profiler/core/ProfiledThreadData.cpp b/tools/profiler/core/ProfiledThreadData.cpp index 47abf1efcd83..67980b9603cb 100644 --- a/tools/profiler/core/ProfiledThreadData.cpp +++ b/tools/profiler/core/ProfiledThreadData.cpp @@ -6,6 +6,8 @@ #include "ProfiledThreadData.h" +#include "mozilla/dom/ContentChild.h" + #if defined(GP_OS_darwin) #include #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(aThreadId)); aWriter.IntProperty("pid", static_cast(getpid()));