author | Bobby Holley <bobbyholley@gmail.com> |
Fri, 14 Sep 2018 16:25:38 -0700 | |
changeset 492258 | 6807afe941076ed45ab20f06511ad83a1906a4bb |
parent 492257 | 5a423ac3eb2345b4a56a362b12dde2b256d37d79 |
child 492259 | 73a2f427e2fdd0511198a2e308c21f3b74ca7f7d |
push id | 9984 |
push user | ffxbld-merge |
push date | Mon, 15 Oct 2018 21:07:35 +0000 |
treeherder | mozilla-beta@183d27ea8570 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | mstange |
bugs | 1491478 |
milestone | 64.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/gfx/ipc/GPUParent.cpp +++ b/gfx/ipc/GPUParent.cpp @@ -8,16 +8,17 @@ #endif #include "GPUParent.h" #include "gfxConfig.h" #include "gfxCrashReporterUtils.h" #include "gfxPlatform.h" #include "gfxPrefs.h" #include "GLContextProvider.h" #include "GPUProcessHost.h" +#include "GPUProcessManager.h" #include "mozilla/Assertions.h" #include "mozilla/Telemetry.h" #include "mozilla/TimeStamp.h" #include "mozilla/dom/MemoryReportRequest.h" #include "mozilla/dom/VideoDecoderManagerChild.h" #include "mozilla/dom/VideoDecoderManagerParent.h" #include "mozilla/gfx/2D.h" #include "mozilla/gfx/gfxVars.h" @@ -455,23 +456,40 @@ GPUParent::RecvNotifyGpuObservers(const nsCOMPtr<nsIObserverService> obsSvc = mozilla::services::GetObserverService(); MOZ_ASSERT(obsSvc); if (obsSvc) { obsSvc->NotifyObservers(nullptr, aTopic.get(), nullptr); } return IPC_OK(); } +/* static */ void +GPUParent::GetGPUProcessName(nsACString& aStr) +{ + auto processType = XRE_GetProcessType(); + unsigned pid = 0; + if (processType == GeckoProcessType_GPU) { + pid = getpid(); + } else { + MOZ_DIAGNOSTIC_ASSERT(processType == GeckoProcessType_Default); + pid = GPUProcessManager::Get()->GPUProcessPid(); + } + + nsPrintfCString processName("GPU (pid %u)", pid); + aStr.Assign(processName); +} + mozilla::ipc::IPCResult GPUParent::RecvRequestMemoryReport(const uint32_t& aGeneration, const bool& aAnonymize, const bool& aMinimizeMemoryUsage, const MaybeFileDesc& aDMDFile) { - nsPrintfCString processName("GPU (pid %u)", (unsigned)getpid()); + nsAutoCString processName; + GetGPUProcessName(processName); mozilla::dom::MemoryReportRequestClient::Start( aGeneration, aAnonymize, aMinimizeMemoryUsage, aDMDFile, processName); return IPC_OK(); } mozilla::ipc::IPCResult GPUParent::RecvShutdownVR()
--- a/gfx/ipc/GPUParent.h +++ b/gfx/ipc/GPUParent.h @@ -21,16 +21,21 @@ class VsyncBridgeParent; class GPUParent final : public PGPUParent { public: GPUParent(); ~GPUParent(); static GPUParent* GetSingleton(); + // Gets the name of the GPU process, in the format expected by about:memory. + // There must be a GPU process active, and the caller must be either in that + // process or the parent process. + static void GetGPUProcessName(nsACString& aStr); + bool Init(base::ProcessId aParentPid, const char* aParentBuildID, MessageLoop* aIOLoop, IPC::Channel* aChannel); void NotifyDeviceReset(); PAPZInputBridgeParent* AllocPAPZInputBridgeParent(const LayersId& aLayersId) override; bool DeallocPAPZInputBridgeParent(PAPZInputBridgeParent* aActor) override;
--- a/gfx/thebes/gfxPlatform.cpp +++ b/gfx/thebes/gfxPlatform.cpp @@ -658,18 +658,28 @@ struct WebRenderMemoryReporterHelper { WebRenderMemoryReporterHelper(nsIHandleReportCallback* aCallback, nsISupports* aData) : mCallback(aCallback), mData(aData) {} nsCOMPtr<nsIHandleReportCallback> mCallback; nsCOMPtr<nsISupports> mData; void Report(size_t aBytes, const char* aName) const { + // Generally, memory reporters pass the empty string as the process name to + // indicate "current process". However, if we're using a GPU process, the + // measurements will actually take place in that process, and it's easier to + // just note that here rather than trying to invoke the memory reporter in + // the GPU process. + nsAutoCString processName; + if (gfxConfig::IsEnabled(Feature::GPU_PROCESS)) { + GPUParent::GetGPUProcessName(processName); + } + nsPrintfCString path("explicit/gfx/webrender/%s", aName); - mCallback->Callback(EmptyCString(), path, + mCallback->Callback(processName, path, nsIMemoryReporter::KIND_HEAP, nsIMemoryReporter::UNITS_BYTES, aBytes, EmptyCString(), mData); } }; static void FinishAsyncMemoryReport() {