diff options
Diffstat (limited to 'toolkit/components')
-rw-r--r-- | toolkit/components/telemetry/Telemetry.cpp | 136 | ||||
-rw-r--r-- | toolkit/components/telemetry/Telemetry.h | 19 |
2 files changed, 0 insertions, 155 deletions
diff --git a/toolkit/components/telemetry/Telemetry.cpp b/toolkit/components/telemetry/Telemetry.cpp index 6dbd59bcf..f0a1789d6 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<uintptr_t>& 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<uintptr_t>::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<uintptr_t>::max(); - } - - std::sort(rawStack.begin(), rawStack.end(), CompareByIndex); -#endif - // Copy the information to the return value. ProcessedStack Ret; for (std::vector<StackFrame>::iterator i = rawStack.begin(), @@ -2692,28 +2591,6 @@ GetStackAndModules(const std::vector<uintptr_t>& 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 64f50013a..d86876376 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<mozilla::HangMonitor::HangAnnotations> - aAnnotations); -#endif - class ThreadHangStats; /** |