Bug 1329861 - Disable async stack capturing while profiling using the Gecko Profiler; r=mstange
☠☠ backed out by 5c27bf4d948a ☠ ☠
authorEhsan Akhgari <ehsan@mozilla.com>
Tue, 10 Jan 2017 11:17:00 +0800
changeset 328702 e39a1f381b857108f1e412722e52c2ae054100c1
parent 328701 4a7dadb4e68dab40642d4cc763881c4e0efb8733
child 328703 5c27bf4d948a57f4cef3c34bb0b8225e2b65200a
push id31182
push usercbook@mozilla.com
push dateTue, 10 Jan 2017 11:14:56 +0000
treeherdermozilla-central@7011ed1427de [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmstange
bugs1329861
milestone53.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
Bug 1329861 - Disable async stack capturing while profiling using the Gecko Profiler; r=mstange
tools/profiler/gecko/nsProfiler.cpp
tools/profiler/gecko/nsProfiler.h
--- a/tools/profiler/gecko/nsProfiler.cpp
+++ b/tools/profiler/gecko/nsProfiler.cpp
@@ -14,26 +14,31 @@
 #include "nsIObserverService.h"
 #include "nsIInterfaceRequestor.h"
 #include "nsILoadContext.h"
 #include "nsIWebNavigation.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "shared-libraries.h"
 #include "js/Value.h"
 #include "mozilla/ErrorResult.h"
+#include "mozilla/Preferences.h"
 #include "mozilla/dom/Promise.h"
 
 using mozilla::ErrorResult;
+using mozilla::Preferences;
 using mozilla::dom::Promise;
 using std::string;
 
+static const char* kAsyncStacksPrefName = "javascript.options.asyncstack";
+
 NS_IMPL_ISUPPORTS(nsProfiler, nsIProfiler)
 
 nsProfiler::nsProfiler()
   : mLockedForPrivateBrowsing(false)
+  , mAsyncStacksWereEnabled(false)
 {
 }
 
 nsProfiler::~nsProfiler()
 {
   nsCOMPtr<nsIObserverService> observerService = mozilla::services::GetObserverService();
   if (observerService) {
     observerService->RemoveObserver(this, "chrome-document-global-created");
@@ -82,25 +87,32 @@ NS_IMETHODIMP
 nsProfiler::StartProfiler(uint32_t aEntries, double aInterval,
                           const char** aFeatures, uint32_t aFeatureCount,
                           const char** aThreadNameFilters, uint32_t aFilterCount)
 {
   if (mLockedForPrivateBrowsing) {
     return NS_ERROR_NOT_AVAILABLE;
   }
 
+  mAsyncStacksWereEnabled = Preferences::GetBool(kAsyncStacksPrefName);
+  if (mAsyncStacksWereEnabled) {
+    Preferences::SetBool(kAsyncStacksPrefName, false);
+  }
+
   profiler_start(aEntries, aInterval,
                  aFeatures, aFeatureCount,
                  aThreadNameFilters, aFilterCount);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsProfiler::StopProfiler()
 {
+  Preferences::SetBool(kAsyncStacksPrefName, mAsyncStacksWereEnabled);
+
   profiler_stop();
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsProfiler::IsPaused(bool *aIsPaused)
 {
   *aIsPaused = profiler_is_paused();
@@ -300,9 +312,9 @@ nsProfiler::GetProfileGatherer(nsISuppor
   if (!profiler_is_active()) {
     *aRetVal = nullptr;
   } else {
     nsCOMPtr<nsISupports> gatherer;
     profiler_get_gatherer(getter_AddRefs(gatherer));
     gatherer.forget(aRetVal);
   }
   return NS_OK;
-}
\ No newline at end of file
+}
--- a/tools/profiler/gecko/nsProfiler.h
+++ b/tools/profiler/gecko/nsProfiler.h
@@ -18,12 +18,13 @@ public:
     NS_DECL_ISUPPORTS
     NS_DECL_NSIOBSERVER
     NS_DECL_NSIPROFILER
 
     nsresult Init();
 private:
     ~nsProfiler();
     bool mLockedForPrivateBrowsing;
+    bool mAsyncStacksWereEnabled;
 };
 
 #endif /* _NSPROFILER_H_ */