Backed out changesets 73f3ce609c23 and 990a21978a2d (bug 951431) because they were not intended for uplift. a=backout
authorRyan VanderMeulen <ryanvm@gmail.com>
Thu, 16 Jan 2014 11:23:07 -0500
changeset 175812 6332a66fff7284c7370a78713a39df805055b680
parent 175811 b936a1b706ee52630e291e16a8f6a5362981d8c9
child 175813 0ef32c69e80cdfe05b98223cb9f3ee683f5abbb6
push id445
push userffxbld
push dateMon, 10 Mar 2014 22:05:19 +0000
treeherdermozilla-release@dc38b741b04e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs951431
milestone28.0a2
backs out73f3ce609c233a063b355d949a3fa02658df7c9b
990a21978a2dfc03bca8af57fe1843c0fe674518
Backed out changesets 73f3ce609c23 and 990a21978a2d (bug 951431) because they were not intended for uplift. a=backout
xpcom/build/nsXPComInit.cpp
xpcom/threads/BackgroundHangMonitor.cpp
xpcom/threads/HangMonitor.cpp
--- a/xpcom/build/nsXPComInit.cpp
+++ b/xpcom/build/nsXPComInit.cpp
@@ -140,17 +140,16 @@ using mozilla::eventtracer::VisualEventT
 #endif
 
 namespace {
 
 static AtExitManager* sExitManager;
 static MessageLoop* sMessageLoop;
 static bool sCommandLineWasInitialized;
 static BrowserProcessSubThread* sIOThread;
-static BackgroundHangMonitor* sMainHangMonitor;
 
 } /* anonymous namespace */
 
 // Registry Factory creation function defined in nsRegistry.cpp
 // We hook into this function locally to create and register the registry
 // Since noone outside xpcom needs to know about this and nsRegistry.cpp
 // does not have a local include file, we are putting this definition
 // here rather than in nsIRegistry.h
@@ -414,20 +413,16 @@ NS_InitXPCOM2(nsIServiceManager* *result
     NS_ASSERTION(!sExitManager && !sMessageLoop, "Bad logic!");
 
     if (!AtExitManager::AlreadyRegistered()) {
         sExitManager = new AtExitManager();
     }
 
     if (!MessageLoop::current()) {
         sMessageLoop = new MessageLoopForUI(MessageLoop::TYPE_MOZILLA_UI);
-        sMessageLoop->set_thread_name("Gecko");
-        // Set experimental values for main thread hangs:
-        // 512ms for transient hangs and 8192ms for permanent hangs
-        sMessageLoop->set_hang_timeouts(512, 8192);
     }
 
     if (XRE_GetProcessType() == GeckoProcessType_Default &&
         !BrowserProcessSubThread::GetMessageLoop(BrowserProcessSubThread::IO)) {
         scoped_ptr<BrowserProcessSubThread> ioThread(
             new BrowserProcessSubThread(BrowserProcessSubThread::IO));
 
         base::Thread::Options options;
@@ -590,22 +585,16 @@ NS_InitXPCOM2(nsIServiceManager* *result
     // ICU's memory usage.
     RegisterStrongMemoryReporter(new ICUReporter());
 
     mozilla::Telemetry::Init();
 
     mozilla::HangMonitor::Startup();
     mozilla::BackgroundHangMonitor::Startup();
 
-    const MessageLoop* const loop = MessageLoop::current();
-    sMainHangMonitor = new mozilla::BackgroundHangMonitor(
-        loop->thread_name().c_str(),
-        loop->transient_hang_timeout(),
-        loop->permanent_hang_timeout());
-
 #ifdef MOZ_VISUAL_EVENT_TRACER
     mozilla::eventtracer::Init();
 #endif
 
     return NS_OK;
 }
 
 
@@ -840,21 +829,16 @@ ShutdownXPCOM(nsIServiceManager* servMgr
     if (sExitManager) {
         delete sExitManager;
         sExitManager = nullptr;
     }
 
     Omnijar::CleanUp();
 
     HangMonitor::Shutdown();
-
-    if (sMainHangMonitor) {
-        delete sMainHangMonitor;
-        sMainHangMonitor = nullptr;
-    }
     BackgroundHangMonitor::Shutdown();
 
 #ifdef MOZ_VISUAL_EVENT_TRACER
     eventtracer::Shutdown();
 #endif
 
     profiler_shutdown();
 
--- a/xpcom/threads/BackgroundHangMonitor.cpp
+++ b/xpcom/threads/BackgroundHangMonitor.cpp
@@ -142,17 +142,17 @@ public:
   BackgroundHangThread(const char* aName,
                        uint32_t aTimeoutMs,
                        uint32_t aMaxTimeoutMs);
   ~BackgroundHangThread();
 
   // Report a hang; aManager->mLock IS locked
   void ReportHang(PRIntervalTime aHangTime);
   // Report a permanent hang; aManager->mLock IS locked
-  void ReportPermaHang();
+  void ReportPermaHang() const;
   // Called by BackgroundHangMonitor::NotifyActivity
   void NotifyActivity();
   // Called by BackgroundHangMonitor::NotifyWait
   void NotifyWait()
   {
     NotifyActivity();
     mWaiting = true;
   }
@@ -260,17 +260,16 @@ BackgroundHangManager::RunMonitorThread(
         continue;
       }
       PRIntervalTime interval = currentThread->mInterval;
       PRIntervalTime hangTime = intervalNow - interval;
       if (MOZ_UNLIKELY(hangTime >= currentThread->mMaxTimeout)) {
         // A permahang started
         // Skip subsequent iterations and tolerate a race on mWaiting here
         currentThread->mWaiting = true;
-        currentThread->mHanging = false;
         currentThread->ReportPermaHang();
         continue;
       }
 
       if (MOZ_LIKELY(!currentThread->mHanging)) {
         if (MOZ_UNLIKELY(hangTime >= currentThread->mTimeout)) {
           // A hang started
           currentThread->mStackHelper.GetStack(currentThread->mHangStack);
@@ -372,23 +371,22 @@ BackgroundHangThread::ReportHang(PRInter
     }
   }
   // Add new histogram
   newHistogram.Add(aHangTime);
   mStats.mHangs.append(Move(newHistogram));
 }
 
 void
-BackgroundHangThread::ReportPermaHang()
+BackgroundHangThread::ReportPermaHang() const
 {
   // Permanently hanged; called on the monitor thread
   // mManager->mLock IS locked
 
-  // TODO: Add more detailed analysis for perma-hangs
-  ReportHang(mMaxTimeout);
+  // TODO: Add telemetry reporting for perma-hangs
 }
 
 MOZ_ALWAYS_INLINE void
 BackgroundHangThread::NotifyActivity()
 {
   PRIntervalTime intervalNow = mManager->mIntervalNow;
   if (mWaiting) {
     mInterval = intervalNow;
--- a/xpcom/threads/HangMonitor.cpp
+++ b/xpcom/threads/HangMonitor.cpp
@@ -1,15 +1,14 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/HangMonitor.h"
-#include "mozilla/BackgroundHangMonitor.h"
 #include "mozilla/Monitor.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/Telemetry.h"
 #include "mozilla/ProcessedStack.h"
 #include "mozilla/Atomics.h"
 #include "nsXULAppAPI.h"
 #include "nsThreadUtils.h"
 #include "nsStackWalk.h"
@@ -342,29 +341,21 @@ NotifyActivity(ActivityType activityType
     // Mozilla's UI responsiveness goal is 50ms
     static const uint32_t kUIResponsivenessThresholdMS = 50;
     if (cumulativeUILagMS > kUIResponsivenessThresholdMS) {
       mozilla::Telemetry::Accumulate(mozilla::Telemetry::EVENTLOOP_UI_LAG_EXP_MS,
                                      cumulativeUILagMS);
     }
     cumulativeUILagMS = 0;
   }
-
-  if (gThread && !gShutdown) {
-    mozilla::BackgroundHangMonitor().NotifyActivity();
-  }
 }
 
 void
 Suspend()
 {
   MOZ_ASSERT(NS_IsMainThread(),
              "HangMonitor::Suspend called from off the main thread.");
 
   // Because gTimestamp changes this resets the wait count.
   gTimestamp = PR_INTERVAL_NO_WAIT;
-
-  if (gThread && !gShutdown) {
-    mozilla::BackgroundHangMonitor().NotifyWait();
-  }
 }
 
 } } // namespace mozilla::HangMonitor