From a6371199e8f41ebb867889552ae7bd5cdf6cadd6 Mon Sep 17 00:00:00 2001 From: David Rajchenbach-Teller Date: Thu, 14 Jan 2016 23:03:11 +0100 Subject: [PATCH] Bug 1224374 - Profiler labels for the 25 top chrome hangs;r=BenWa,MarcoZ Experience shows that we do not have enough profiler labels to make BHR hang reports meaningful. This patch adds enough labels to let us exploit hang reports matching the 25 topmost chrome hangs. --- accessible/base/NotificationController.cpp | 1 + dom/base/nsFrameLoader.cpp | 1 + dom/base/nsJSEnvironment.cpp | 2 ++ dom/base/nsObjectLoadingContent.cpp | 1 + dom/ipc/ContentParent.cpp | 6 ++++++ dom/plugins/base/nsPluginHost.cpp | 1 + dom/plugins/ipc/PluginModuleParent.cpp | 1 + gfx/layers/client/TextureClient.cpp | 1 + js/xpconnect/wrappers/AddonWrapper.cpp | 4 ++++ layout/generic/nsSubDocumentFrame.cpp | 1 + 10 files changed, 19 insertions(+) diff --git a/accessible/base/NotificationController.cpp b/accessible/base/NotificationController.cpp index b566dd43d3328..1c078a16e08ea 100644 --- a/accessible/base/NotificationController.cpp +++ b/accessible/base/NotificationController.cpp @@ -141,6 +141,7 @@ NotificationController::IsUpdatePending() void NotificationController::WillRefresh(mozilla::TimeStamp aTime) { + PROFILER_LABEL_FUNC(js::ProfileEntry::Category::OTHER); Telemetry::AutoTimer updateTimer; // If the document accessible that notification collector was created for is diff --git a/dom/base/nsFrameLoader.cpp b/dom/base/nsFrameLoader.cpp index c4477afd18ad7..2261c2f01143e 100644 --- a/dom/base/nsFrameLoader.cpp +++ b/dom/base/nsFrameLoader.cpp @@ -781,6 +781,7 @@ bool nsFrameLoader::ShowRemoteFrame(const ScreenIntSize& size, nsSubDocumentFrame *aFrame) { + PROFILER_LABEL_FUNC(js::ProfileEntry::Category::GRAPHICS); NS_ASSERTION(IsRemoteFrame(), "ShowRemote only makes sense on remote frames."); if (!mRemoteBrowser && !TryRemoteBrowser()) { diff --git a/dom/base/nsJSEnvironment.cpp b/dom/base/nsJSEnvironment.cpp index 08c8e6af565d9..3cda5200b4726 100644 --- a/dom/base/nsJSEnvironment.cpp +++ b/dom/base/nsJSEnvironment.cpp @@ -1335,6 +1335,8 @@ nsJSContext::ShrinkGCBuffersNow() static void FinishAnyIncrementalGC() { + PROFILER_LABEL_FUNC(js::ProfileEntry::Category::GC); + if (sCCLockedOut) { // We're in the middle of an incremental GC, so finish it. JS::PrepareForIncrementalGC(sRuntime); diff --git a/dom/base/nsObjectLoadingContent.cpp b/dom/base/nsObjectLoadingContent.cpp index 035a019883e0f..fa8eb49f65abd 100644 --- a/dom/base/nsObjectLoadingContent.cpp +++ b/dom/base/nsObjectLoadingContent.cpp @@ -3102,6 +3102,7 @@ nsObjectLoadingContent::DoStopPlugin(nsPluginInstanceOwner* aInstanceOwner, NS_IMETHODIMP nsObjectLoadingContent::StopPluginInstance() { + PROFILER_LABEL_FUNC(js::ProfileEntry::Category::OTHER); // Clear any pending events mPendingInstantiateEvent = nullptr; mPendingCheckPluginStopEvent = nullptr; diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index f9ff4f409a760..0a68b209e3110 100644 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -1237,6 +1237,8 @@ ContentParent::CreateBrowserOrApp(const TabContext& aContext, Element* aFrameElement, ContentParent* aOpenerContentParent) { + PROFILER_LABEL_FUNC(js::ProfileEntry::Category::OTHER); + if (!sCanLaunchSubprocesses) { return nullptr; } @@ -2386,6 +2388,8 @@ ContentParent::InitializeMembers() bool ContentParent::LaunchSubprocess(ProcessPriority aInitialPriority /* = PROCESS_PRIORITY_FOREGROUND */) { + PROFILER_LABEL_FUNC(js::ProfileEntry::Category::OTHER); + std::vector extraArgs; if (mIsNuwaProcess) { extraArgs.push_back("-nuwa"); @@ -3642,6 +3646,8 @@ ContentParent::ForceKillTimerCallback(nsITimer* aTimer, void* aClosure) void ContentParent::KillHard(const char* aReason) { + PROFILER_LABEL_FUNC(js::ProfileEntry::Category::OTHER); + // On Windows, calling KillHard multiple times causes problems - the // process handle becomes invalid on the first call, causing a second call // to crash our process - more details in bug 890840. diff --git a/dom/plugins/base/nsPluginHost.cpp b/dom/plugins/base/nsPluginHost.cpp index b132753d90af6..171ee97b5c6cf 100644 --- a/dom/plugins/base/nsPluginHost.cpp +++ b/dom/plugins/base/nsPluginHost.cpp @@ -1366,6 +1366,7 @@ nsresult nsPluginHost::EnsurePluginLoaded(nsPluginTag* aPluginTag) nsresult nsPluginHost::GetPluginForContentProcess(uint32_t aPluginId, nsNPAPIPlugin** aPlugin) { + PROFILER_LABEL_FUNC(js::ProfileEntry::Category::OTHER); MOZ_ASSERT(XRE_IsParentProcess()); // If plugins haven't been scanned yet, do so now diff --git a/dom/plugins/ipc/PluginModuleParent.cpp b/dom/plugins/ipc/PluginModuleParent.cpp index 485a12e824d7e..4ee3198bc4f17 100755 --- a/dom/plugins/ipc/PluginModuleParent.cpp +++ b/dom/plugins/ipc/PluginModuleParent.cpp @@ -110,6 +110,7 @@ mozilla::plugins::SetupBridge(uint32_t aPluginId, nsresult* rv, uint32_t* runID) { + PROFILER_LABEL_FUNC(js::ProfileEntry::Category::OTHER); if (NS_WARN_IF(!rv) || NS_WARN_IF(!runID)) { return false; } diff --git a/gfx/layers/client/TextureClient.cpp b/gfx/layers/client/TextureClient.cpp index fb64b5657fdc9..0922ea2d319e6 100644 --- a/gfx/layers/client/TextureClient.cpp +++ b/gfx/layers/client/TextureClient.cpp @@ -206,6 +206,7 @@ static void DestroyTextureData(TextureData* aTextureData, ISurfaceAllocator* aAl void TextureChild::ActorDestroy(ActorDestroyReason why) { + PROFILER_LABEL_FUNC(js::ProfileEntry::Category::GRAPHICS); mWaitForRecycle = nullptr; if (mTextureData) { diff --git a/js/xpconnect/wrappers/AddonWrapper.cpp b/js/xpconnect/wrappers/AddonWrapper.cpp index bfc3e2e5937e6..46645b2c4bb7b 100644 --- a/js/xpconnect/wrappers/AddonWrapper.cpp +++ b/js/xpconnect/wrappers/AddonWrapper.cpp @@ -14,6 +14,8 @@ #include "mozilla/dom/BindingUtils.h" #include "nsGlobalWindow.h" +#include "GeckoProfiler.h" + #include "nsID.h" using namespace js; @@ -172,6 +174,8 @@ bool AddonWrapper::get(JSContext* cx, JS::Handle wrapper, JS::Handle receiver, JS::Handle id, JS::MutableHandle vp) const { + PROFILER_LABEL_FUNC(js::ProfileEntry::Category::OTHER); + Rooted desc(cx); if (!InterposeProperty(cx, wrapper, nullptr, id, &desc)) return false; diff --git a/layout/generic/nsSubDocumentFrame.cpp b/layout/generic/nsSubDocumentFrame.cpp index ebb6f787cd90d..9f4703b7295d7 100644 --- a/layout/generic/nsSubDocumentFrame.cpp +++ b/layout/generic/nsSubDocumentFrame.cpp @@ -82,6 +82,7 @@ class AsyncFrameInit : public nsRunnable explicit AsyncFrameInit(nsIFrame* aFrame) : mFrame(aFrame) {} NS_IMETHOD Run() { + PROFILER_LABEL("mozilla", "AsyncFrameInit::Run", js::ProfileEntry::Category::OTHER); if (mFrame.IsAlive()) { static_cast(mFrame.GetFrame())->ShowViewer(); }