Bug 1224374 - Profiler labels for the 25 top chrome hangs;r?benwa draft
authorDavid Rajchenbach-Teller <dteller@mozilla.com>
Thu, 14 Jan 2016 23:03:11 +0100
changeset 321856 e60a7f39573440c08447251c525227ef9c43b921
parent 320463 5acc2a44834ce0614f98466475e674517daf0041
child 321986 7cee65485b7e1c78411e1146f4aa2b79c48f03a5
child 323195 10bc3d2a07f9ecbd5159059f6a86e10dea7c4e40
child 323628 1cfc278991c3b4147da0f736a36f54884cb751f2
push id9468
push userdteller@mozilla.com
push dateThu, 14 Jan 2016 22:05:19 +0000
reviewersbenwa
bugs1224374
milestone46.0a1
Bug 1224374 - Profiler labels for the 25 top chrome hangs;r?benwa 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
dom/base/nsFrameLoader.cpp
dom/base/nsJSEnvironment.cpp
dom/base/nsObjectLoadingContent.cpp
dom/ipc/ContentParent.cpp
dom/plugins/base/nsPluginHost.cpp
dom/plugins/ipc/PluginModuleParent.cpp
gfx/layers/client/TextureClient.cpp
js/xpconnect/wrappers/AddonWrapper.cpp
layout/generic/nsSubDocumentFrame.cpp
--- a/accessible/base/NotificationController.cpp
+++ b/accessible/base/NotificationController.cpp
@@ -136,16 +136,17 @@ NotificationController::IsUpdatePending(
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // NotificationCollector: private
 
 void
 NotificationController::WillRefresh(mozilla::TimeStamp aTime)
 {
+  PROFILER_LABEL_FUNC(js::ProfileEntry::Category::OTHER);
   Telemetry::AutoTimer<Telemetry::A11Y_UPDATE_TIME> updateTimer;
 
   // If the document accessible that notification collector was created for is
   // now shut down, don't process notifications anymore.
   NS_ASSERTION(mDocument,
                "The document was shut down while refresh observer is attached!");
   if (!mDocument)
     return;
--- a/dom/base/nsFrameLoader.cpp
+++ b/dom/base/nsFrameLoader.cpp
@@ -776,16 +776,17 @@ nsFrameLoader::MarginsChanged(uint32_t a
   if (presContext)
     presContext->RebuildAllStyleData(nsChangeHint(0), eRestyle_Subtree);
 }
 
 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()) {
     NS_ERROR("Couldn't create child process.");
     return false;
   }
 
   // FIXME/bug 589337: Show()/Hide() is pretty expensive for
--- a/dom/base/nsJSEnvironment.cpp
+++ b/dom/base/nsJSEnvironment.cpp
@@ -1330,16 +1330,18 @@ nsJSContext::ShrinkGCBuffersNow()
   KillShrinkGCBuffersTimer();
 
   JS::ShrinkGCBuffers(sRuntime);
 }
 
 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);
     JS::FinishIncrementalGC(sRuntime, JS::gcreason::CC_FORCED);
   }
 }
 
 static void
--- a/dom/base/nsObjectLoadingContent.cpp
+++ b/dom/base/nsObjectLoadingContent.cpp
@@ -3077,16 +3077,17 @@ nsObjectLoadingContent::DoStopPlugin(nsP
 
   TeardownProtoChain();
   mIsStopping = false;
 }
 
 NS_IMETHODIMP
 nsObjectLoadingContent::StopPluginInstance()
 {
+  PROFILER_LABEL_FUNC(js::ProfileEntry::Category::OTHER);
   // Clear any pending events
   mPendingInstantiateEvent = nullptr;
   mPendingCheckPluginStopEvent = nullptr;
 
   // If we're currently instantiating, clearing this will cause
   // InstantiatePluginInstance's re-entrance check to destroy the created plugin
   mInstantiating = false;
 
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -1232,16 +1232,18 @@ ContentParent::RecvFindPlugins(const uin
   return true;
 }
 
 /*static*/ TabParent*
 ContentParent::CreateBrowserOrApp(const TabContext& aContext,
                                   Element* aFrameElement,
                                   ContentParent* aOpenerContentParent)
 {
+  PROFILER_LABEL_FUNC(js::ProfileEntry::Category::OTHER);
+
   if (!sCanLaunchSubprocesses) {
     return nullptr;
   }
 
   if (TabParent* parent = TabParent::GetNextTabParent()) {
     parent->SetOwnerElement(aFrameElement);
     return parent;
   }
@@ -2381,16 +2383,18 @@ ContentParent::InitializeMembers()
   mShutdownPending = false;
   mIPCOpen = true;
   mHangMonitorActor = nullptr;
 }
 
 bool
 ContentParent::LaunchSubprocess(ProcessPriority aInitialPriority /* = PROCESS_PRIORITY_FOREGROUND */)
 {
+  PROFILER_LABEL_FUNC(js::ProfileEntry::Category::OTHER);
+
   std::vector<std::string> extraArgs;
   if (mIsNuwaProcess) {
     extraArgs.push_back("-nuwa");
   }
 
   if (!mSubprocess->LaunchAndWaitForProcessHandle(extraArgs)) {
     MarkAsDead();
     return false;
@@ -3637,16 +3641,18 @@ ContentParent::ForceKillTimerCallback(ns
 
   auto self = static_cast<ContentParent*>(aClosure);
   self->KillHard("ShutDownKill");
 }
 
 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.
   if (mCalledKillHard) {
     return;
   }
   mCalledKillHard = true;
   mForceKillTimer = nullptr;
--- a/dom/plugins/base/nsPluginHost.cpp
+++ b/dom/plugins/base/nsPluginHost.cpp
@@ -1361,16 +1361,17 @@ nsresult nsPluginHost::EnsurePluginLoade
     aPluginTag->mPlugin = plugin;
   }
   return NS_OK;
 }
 
 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
   LoadPlugins();
 
   nsPluginTag* pluginTag = PluginWithId(aPluginId);
   if (pluginTag) {
     // When setting up a bridge, double check with chrome to see if this plugin
--- a/dom/plugins/ipc/PluginModuleParent.cpp
+++ b/dom/plugins/ipc/PluginModuleParent.cpp
@@ -104,16 +104,17 @@ struct RunnableMethodTraits<mozilla::plu
 
 bool
 mozilla::plugins::SetupBridge(uint32_t aPluginId,
                               dom::ContentParent* aContentParent,
                               bool aForceBridgeNow,
                               nsresult* rv,
                               uint32_t* runID)
 {
+    PROFILER_LABEL_FUNC(js::ProfileEntry::Category::OTHER);
     if (NS_WARN_IF(!rv) || NS_WARN_IF(!runID)) {
         return false;
     }
 
     PluginModuleChromeParent::ClearInstantiationFlag();
     RefPtr<nsPluginHost> host = nsPluginHost::GetInst();
     RefPtr<nsNPAPIPlugin> plugin;
     *rv = host->GetPluginForContentProcess(aPluginId, getter_AddRefs(plugin));
--- a/gfx/layers/client/TextureClient.cpp
+++ b/gfx/layers/client/TextureClient.cpp
@@ -202,16 +202,17 @@ static void DestroyTextureData(TextureDa
     aTextureData->Forget(aAllocator);
   }
   delete aTextureData;
 }
 
 void
 TextureChild::ActorDestroy(ActorDestroyReason why)
 {
+  PROFILER_LABEL_FUNC(js::ProfileEntry::Category::GRAPHICS);
   mWaitForRecycle = nullptr;
 
   if (mTextureData) {
     DestroyTextureData(mTextureData, GetAllocator(), mOwnsTextureData, mMainThreadOnly);
     mTextureData = nullptr;
   }
 }
 
--- a/js/xpconnect/wrappers/AddonWrapper.cpp
+++ b/js/xpconnect/wrappers/AddonWrapper.cpp
@@ -9,16 +9,18 @@
 #include "XrayWrapper.h"
 #include "jsapi.h"
 #include "jsfriendapi.h"
 #include "nsIAddonInterposition.h"
 #include "xpcprivate.h"
 #include "mozilla/dom/BindingUtils.h"
 #include "nsGlobalWindow.h"
 
+#include "GeckoProfiler.h"
+
 #include "nsID.h"
 
 using namespace js;
 using namespace JS;
 
 namespace xpc {
 
 bool
@@ -167,16 +169,18 @@ AddonWrapper<Base>::getOwnPropertyDescri
     return Base::getOwnPropertyDescriptor(cx, wrapper, id, desc);
 }
 
 template<typename Base>
 bool
 AddonWrapper<Base>::get(JSContext* cx, JS::Handle<JSObject*> wrapper, JS::Handle<Value> receiver,
                         JS::Handle<jsid> id, JS::MutableHandle<JS::Value> vp) const
 {
+    PROFILER_LABEL_FUNC(js::ProfileEntry::Category::OTHER);
+
     Rooted<JSPropertyDescriptor> desc(cx);
     if (!InterposeProperty(cx, wrapper, nullptr, id, &desc))
         return false;
 
     if (!desc.object())
         return Base::get(cx, wrapper, receiver, id, vp);
 
     if (desc.getter()) {
--- a/layout/generic/nsSubDocumentFrame.cpp
+++ b/layout/generic/nsSubDocumentFrame.cpp
@@ -77,16 +77,17 @@ NS_QUERYFRAME_HEAD(nsSubDocumentFrame)
 NS_QUERYFRAME_TAIL_INHERITING(nsLeafFrame)
 
 class AsyncFrameInit : public nsRunnable
 {
 public:
   explicit AsyncFrameInit(nsIFrame* aFrame) : mFrame(aFrame) {}
   NS_IMETHOD Run()
   {
+    PROFILER_LABEL("mozilla", "AsyncFrameInit::Run", js::ProfileEntry::Category::OTHER);
     if (mFrame.IsAlive()) {
       static_cast<nsSubDocumentFrame*>(mFrame.GetFrame())->ShowViewer();
     }
     return NS_OK;
   }
 private:
   nsWeakFrame mFrame;
 };