From ea7dd0842daa5765e1451b9d824284db5d85b661 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Thu, 24 May 2018 14:06:04 +0200 Subject: Remove SPS profiler. - Conditionals and code blocks. (MOZ_ENABLE_PROFILER_SPS) - Stub out several profiler-only functions. --- toolkit/components/telemetry/Telemetry.cpp | 136 ----------------------------- toolkit/components/telemetry/Telemetry.h | 19 ---- toolkit/modules/AppConstants.jsm | 7 -- toolkit/modules/Services.jsm | 3 - toolkit/moz.configure | 17 ---- 5 files changed, 182 deletions(-) (limited to 'toolkit') diff --git a/toolkit/components/telemetry/Telemetry.cpp b/toolkit/components/telemetry/Telemetry.cpp index 6dbd59bcf5..f0a1789d63 100644 --- a/toolkit/components/telemetry/Telemetry.cpp +++ b/toolkit/components/telemetry/Telemetry.cpp @@ -73,9 +73,6 @@ #include "mozilla/PoisonIOInterposer.h" #include "mozilla/StartupTimeline.h" #include "mozilla/HangMonitor.h" -#if defined(MOZ_ENABLE_PROFILER_SPS) -#include "shared-libraries.h" -#endif namespace { @@ -682,13 +679,6 @@ public: static void ShutdownTelemetry(); static void RecordSlowStatement(const nsACString &sql, const nsACString &dbName, uint32_t delay); -#if defined(MOZ_ENABLE_PROFILER_SPS) - static void RecordChromeHang(uint32_t aDuration, - Telemetry::ProcessedStack &aStack, - int32_t aSystemUptime, - int32_t aFirefoxUptime, - HangAnnotationsPtr aAnnotations); -#endif static void RecordThreadHangStats(Telemetry::ThreadHangStats& aStats); size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf); struct Stat { @@ -2224,31 +2214,6 @@ TelemetryImpl::RecordIceCandidates(const uint32_t iceCandidateBitmask, sTelemetry->mWebrtcTelemetry.RecordIceCandidateMask(iceCandidateBitmask, success); } -#if defined(MOZ_ENABLE_PROFILER_SPS) -void -TelemetryImpl::RecordChromeHang(uint32_t aDuration, - Telemetry::ProcessedStack &aStack, - int32_t aSystemUptime, - int32_t aFirefoxUptime, - HangAnnotationsPtr aAnnotations) -{ - if (!sTelemetry || !TelemetryHistogram::CanRecordExtended()) - return; - - HangAnnotationsPtr annotations; - // We only pass aAnnotations if it is not empty. - if (aAnnotations && !aAnnotations->IsEmpty()) { - annotations = Move(aAnnotations); - } - - MutexAutoLock hangReportMutex(sTelemetry->mHangReportsMutex); - - sTelemetry->mHangReports.AddHang(aStack, aDuration, - aSystemUptime, aFirefoxUptime, - Move(annotations)); -} -#endif - void TelemetryImpl::RecordThreadHangStats(Telemetry::ThreadHangStats& aStats) { @@ -2452,18 +2417,6 @@ struct StackFrame uint16_t mModIndex; // The index of module that has this program counter. }; -#ifdef MOZ_ENABLE_PROFILER_SPS -static bool CompareByPC(const StackFrame &a, const StackFrame &b) -{ - return a.mPC < b.mPC; -} - -static bool CompareByIndex(const StackFrame &a, const StackFrame &b) -{ - return a.mIndex < b.mIndex; -} -#endif - } // namespace @@ -2629,60 +2582,6 @@ GetStackAndModules(const std::vector& aPCs) rawStack.push_back(Frame); } -#ifdef MOZ_ENABLE_PROFILER_SPS - // Remove all modules not referenced by a PC on the stack - std::sort(rawStack.begin(), rawStack.end(), CompareByPC); - - size_t moduleIndex = 0; - size_t stackIndex = 0; - size_t stackSize = rawStack.size(); - - SharedLibraryInfo rawModules = SharedLibraryInfo::GetInfoForSelf(); - rawModules.SortByAddress(); - - while (moduleIndex < rawModules.GetSize()) { - const SharedLibrary& module = rawModules.GetEntry(moduleIndex); - uintptr_t moduleStart = module.GetStart(); - uintptr_t moduleEnd = module.GetEnd() - 1; - // the interval is [moduleStart, moduleEnd) - - bool moduleReferenced = false; - for (;stackIndex < stackSize; ++stackIndex) { - uintptr_t pc = rawStack[stackIndex].mPC; - if (pc >= moduleEnd) - break; - - if (pc >= moduleStart) { - // If the current PC is within the current module, mark - // module as used - moduleReferenced = true; - rawStack[stackIndex].mPC -= moduleStart; - rawStack[stackIndex].mModIndex = moduleIndex; - } else { - // PC does not belong to any module. It is probably from - // the JIT. Use a fixed mPC so that we don't get different - // stacks on different runs. - rawStack[stackIndex].mPC = - std::numeric_limits::max(); - } - } - - if (moduleReferenced) { - ++moduleIndex; - } else { - // Remove module if no PCs within its address range - rawModules.RemoveEntries(moduleIndex, moduleIndex + 1); - } - } - - for (;stackIndex < stackSize; ++stackIndex) { - // These PCs are past the last module. - rawStack[stackIndex].mPC = std::numeric_limits::max(); - } - - std::sort(rawStack.begin(), rawStack.end(), CompareByIndex); -#endif - // Copy the information to the return value. ProcessedStack Ret; for (std::vector::iterator i = rawStack.begin(), @@ -2692,28 +2591,6 @@ GetStackAndModules(const std::vector& aPCs) Ret.AddFrame(frame); } -#ifdef MOZ_ENABLE_PROFILER_SPS - for (unsigned i = 0, n = rawModules.GetSize(); i != n; ++i) { - const SharedLibrary &info = rawModules.GetEntry(i); - const std::string &name = info.GetName(); - std::string basename = name; -#ifdef XP_MACOSX - // FIXME: We want to use just the basename as the libname, but the - // current profiler addon needs the full path name, so we compute the - // basename in here. - size_t pos = name.rfind('/'); - if (pos != std::string::npos) { - basename = name.substr(pos + 1); - } -#endif - mozilla::Telemetry::ProcessedStack::Module module = { - basename, - info.GetBreakpadId() - }; - Ret.AddModule(module); - } -#endif - return Ret; } @@ -2910,19 +2787,6 @@ void Init() MOZ_ASSERT(telemetryService); } -#if defined(MOZ_ENABLE_PROFILER_SPS) -void RecordChromeHang(uint32_t duration, - ProcessedStack &aStack, - int32_t aSystemUptime, - int32_t aFirefoxUptime, - HangAnnotationsPtr aAnnotations) -{ - TelemetryImpl::RecordChromeHang(duration, aStack, - aSystemUptime, aFirefoxUptime, - Move(aAnnotations)); -} -#endif - void RecordThreadHangStats(ThreadHangStats& aStats) { TelemetryImpl::RecordThreadHangStats(aStats); diff --git a/toolkit/components/telemetry/Telemetry.h b/toolkit/components/telemetry/Telemetry.h index 64f50013ab..d868763761 100644 --- a/toolkit/components/telemetry/Telemetry.h +++ b/toolkit/components/telemetry/Telemetry.h @@ -311,25 +311,6 @@ const uint32_t kSlowSQLThresholdForMainThread = 50; const uint32_t kSlowSQLThresholdForHelperThreads = 100; class ProcessedStack; - -/** - * Record the main thread's call stack after it hangs. - * - * @param aDuration - Approximate duration of main thread hang, in seconds - * @param aStack - Array of PCs from the hung call stack - * @param aSystemUptime - System uptime at the time of the hang, in minutes - * @param aFirefoxUptime - Firefox uptime at the time of the hang, in minutes - * @param aAnnotations - Any annotations to be added to the report - */ -#if defined(MOZ_ENABLE_PROFILER_SPS) -void RecordChromeHang(uint32_t aDuration, - ProcessedStack &aStack, - int32_t aSystemUptime, - int32_t aFirefoxUptime, - mozilla::UniquePtr - aAnnotations); -#endif - class ThreadHangStats; /** diff --git a/toolkit/modules/AppConstants.jsm b/toolkit/modules/AppConstants.jsm index d22625d14c..7c8a046e9b 100644 --- a/toolkit/modules/AppConstants.jsm +++ b/toolkit/modules/AppConstants.jsm @@ -257,13 +257,6 @@ MOZ_SAFE_BROWSING: false, #endif - MOZ_ENABLE_PROFILER_SPS: -#ifdef MOZ_ENABLE_PROFILER_SPS - true, -#else - false, -#endif - MOZ_ANDROID_ACTIVITY_STREAM: #ifdef MOZ_ANDROID_ACTIVITY_STREAM true, diff --git a/toolkit/modules/Services.jsm b/toolkit/modules/Services.jsm index 58d87ffb1b..1796acd4c4 100644 --- a/toolkit/modules/Services.jsm +++ b/toolkit/modules/Services.jsm @@ -72,9 +72,6 @@ var initTable = [ ["obs", "@mozilla.org/observer-service;1", "nsIObserverService"], ["perms", "@mozilla.org/permissionmanager;1", "nsIPermissionManager"], ["prompt", "@mozilla.org/embedcomp/prompt-service;1", "nsIPromptService"], -#ifdef MOZ_ENABLE_PROFILER_SPS - ["profiler", "@mozilla.org/tools/profiler;1", "nsIProfiler"], -#endif ["scriptloader", "@mozilla.org/moz/jssubscript-loader;1", "mozIJSSubScriptLoader"], ["scriptSecurityManager", "@mozilla.org/scriptsecuritymanager;1", "nsIScriptSecurityManager"], #ifdef MOZ_TOOLKIT_SEARCH diff --git a/toolkit/moz.configure b/toolkit/moz.configure index 0ed17410ab..7d3065f53b 100644 --- a/toolkit/moz.configure +++ b/toolkit/moz.configure @@ -22,23 +22,6 @@ def systrace(value, target): set_define('MOZ_USE_SYSTRACE', systrace) -@depends(target) -def sps_profiler(target): - if target.os == 'Android': - return target.cpu in ('arm', 'x86') - elif target.kernel == 'Linux': - return target.cpu in ('x86', 'x86_64') - return target.os in ('OSX', 'WINNT') - -@depends(sps_profiler) -def sps_profiler_define(value): - if value: - return True - -set_config('MOZ_ENABLE_PROFILER_SPS', sps_profiler_define) -set_define('MOZ_ENABLE_PROFILER_SPS', sps_profiler_define) - - # JACK cubeb backend # ============================================================== option('--enable-jack', env='MOZ_JACK', -- cgit v1.2.3