Browse Source

Remove SPS profiler.

- Conditionals and code blocks. (MOZ_ENABLE_PROFILER_SPS)
- Stub out several profiler-only functions.
pull/1/head
wolfbeast 4 years ago committed by Roy Tam
parent
commit
1a823f5ad6
  1. 4
      application/palemoon/installer/package-manifest.in
  2. 6
      browser/installer/package-manifest.in
  3. 12
      dom/indexedDB/ActorsParent.cpp
  4. 15
      dom/indexedDB/IndexedDatabaseManager.cpp
  5. 9
      dom/ipc/ContentChild.cpp
  6. 114
      dom/ipc/ContentParent.cpp
  7. 6
      dom/ipc/ContentParent.h
  8. 163
      dom/plugins/ipc/PluginModuleParent.cpp
  9. 19
      dom/plugins/ipc/PluginModuleParent.h
  10. 13
      dom/workers/RuntimeService.cpp
  11. 24
      gfx/layers/composite/ContainerLayerComposite.cpp
  12. 9
      gfx/layers/ipc/CompositorBridgeParent.cpp
  13. 3
      gfx/layers/ipc/CrossProcessCompositorBridgeParent.cpp
  14. 14
      gfx/layers/ipc/ImageBridgeChild.cpp
  15. 12
      gfx/thebes/ContextStateTracker.cpp
  16. 10
      js/xpconnect/src/XPCJSContext.cpp
  17. 18
      layout/base/RestyleTracker.cpp
  18. 12
      layout/base/RestyleTracker.h
  19. 17
      layout/base/nsPresShell.cpp
  20. 6
      mobile/android/installer/package-manifest.in
  21. 12
      storage/TelemetryVFS.cpp
  22. 136
      toolkit/components/telemetry/Telemetry.cpp
  23. 19
      toolkit/components/telemetry/Telemetry.h
  24. 7
      toolkit/modules/AppConstants.jsm
  25. 3
      toolkit/modules/Services.jsm
  26. 17
      toolkit/moz.configure
  27. 168
      tools/memory-profiler/GCHeapProfilerImpl.cpp
  28. 53
      tools/memory-profiler/GCHeapProfilerImpl.h
  29. 324
      tools/memory-profiler/MemoryProfiler.cpp
  30. 159
      tools/memory-profiler/MemoryProfiler.h
  31. 82
      tools/memory-profiler/NativeProfilerImpl.cpp
  32. 43
      tools/memory-profiler/NativeProfilerImpl.h
  33. 121
      tools/memory-profiler/UncensoredAllocator.cpp
  34. 48
      tools/memory-profiler/UncensoredAllocator.h
  35. 21
      tools/memory-profiler/moz.build
  36. 72
      tools/memory-profiler/nsIMemoryProfiler.idl
  37. 32
      tools/memory-profiler/nsMemoryProfilerFactory.cpp
  38. 678
      tools/profiler/core/EHABIStackWalk.cpp
  39. 28
      tools/profiler/core/EHABIStackWalk.h
  40. 1306
      tools/profiler/core/GeckoSampler.cpp
  41. 181
      tools/profiler/core/GeckoSampler.h
  42. 310
      tools/profiler/core/IntelPowerGadget.cpp
  43. 150
      tools/profiler/core/IntelPowerGadget.h
  44. 89
      tools/profiler/core/ProfileBuffer.cpp
  45. 61
      tools/profiler/core/ProfileBuffer.h
  46. 881
      tools/profiler/core/ProfileEntry.cpp
  47. 407
      tools/profiler/core/ProfileEntry.h
  48. 115
      tools/profiler/core/ProfileJSONWriter.cpp
  49. 126
      tools/profiler/core/ProfileJSONWriter.h
  50. 33
      tools/profiler/core/ProfilerBacktrace.cpp
  51. 210
      tools/profiler/core/ProfilerMarkers.cpp
  52. 48
      tools/profiler/core/StackTop.cpp
  53. 10
      tools/profiler/core/StackTop.h
  54. 57
      tools/profiler/core/SyncProfile.cpp
  55. 43
      tools/profiler/core/SyncProfile.h
  56. 73
      tools/profiler/core/ThreadInfo.cpp
  57. 66
      tools/profiler/core/ThreadInfo.h
  58. 260
      tools/profiler/core/ThreadProfile.cpp
  59. 107
      tools/profiler/core/ThreadProfile.h
  60. 715
      tools/profiler/core/platform-linux.cc
  61. 469
      tools/profiler/core/platform-macos.cc
  62. 431
      tools/profiler/core/platform-win32.cc
  63. 1257
      tools/profiler/core/platform.cpp
  64. 428
      tools/profiler/core/platform.h
  65. 145
      tools/profiler/core/shared-libraries-linux.cc
  66. 132
      tools/profiler/core/shared-libraries-macos.cc
  67. 137
      tools/profiler/core/shared-libraries-win32.cc
  68. 207
      tools/profiler/gecko/ProfileGatherer.cpp
  69. 16
      tools/profiler/gecko/Profiler.jsm
  70. 30
      tools/profiler/gecko/ProfilerIOInterposeObserver.cpp
  71. 20
      tools/profiler/gecko/ProfilerIOInterposeObserver.h
  72. 45
      tools/profiler/gecko/SaveProfileTask.cpp
  73. 54
      tools/profiler/gecko/SaveProfileTask.h
  74. 118
      tools/profiler/gecko/ThreadResponsiveness.cpp
  75. 38
      tools/profiler/gecko/ThreadResponsiveness.h
  76. 19
      tools/profiler/gecko/nsIProfileSaveEvent.idl
  77. 101
      tools/profiler/gecko/nsIProfiler.idl
  78. 308
      tools/profiler/gecko/nsProfiler.cpp
  79. 29
      tools/profiler/gecko/nsProfiler.h
  80. 31
      tools/profiler/gecko/nsProfilerFactory.cpp
  81. 67
      tools/profiler/gecko/nsProfilerStartParams.cpp
  82. 32
      tools/profiler/gecko/nsProfilerStartParams.h
  83. 207
      tools/profiler/lul/AutoObjectMapper.cpp
  84. 115
      tools/profiler/lul/AutoObjectMapper.h
  85. 114
      tools/profiler/lul/LulCommon.cpp
  86. 2180
      tools/profiler/lul/LulDwarf.cpp
  87. 359
      tools/profiler/lul/LulDwarfSummariser.cpp
  88. 65
      tools/profiler/lul/LulDwarfSummariser.h
  89. 915
      tools/profiler/lul/LulElf.cpp
  90. 1963
      tools/profiler/lul/LulMain.cpp
  91. 397
      tools/profiler/lul/LulMain.h
  92. 88
      tools/profiler/lul/platform-linux-lul.cpp
  93. 24
      tools/profiler/lul/platform-linux-lul.h
  94. 106
      tools/profiler/moz.build
  95. 8
      tools/profiler/public/GeckoProfiler.h
  96. 125
      tools/profiler/public/GeckoProfilerFunc.h
  97. 515
      tools/profiler/public/GeckoProfilerImpl.h
  98. 42
      tools/profiler/public/ProfileGatherer.h
  99. 36
      tools/profiler/public/ProfilerBacktrace.h
  100. 193
      tools/profiler/public/ProfilerMarkers.h
  101. Some files were not shown because too many files have changed in this diff Show More

4
application/palemoon/installer/package-manifest.in

@ -169,14 +169,10 @@
#endif
#ifdef NS_PRINTING
#endif
#ifdef MOZ_ENABLE_PROFILER_SPS
#endif
#ifdef NECKO_WIFI
#endif
#ifdef MOZ_WEBRTC
#endif
#ifdef MOZ_ENABLE_PROFILER_SPS
#endif
#ifdef MOZ_ENABLE_XREMOTE
#endif
#ifdef XP_MACOSX

6
browser/installer/package-manifest.in

@ -251,9 +251,6 @@
@RESPATH@/components/layout_xul.xpt
@RESPATH@/components/locale.xpt
@RESPATH@/components/lwbrk.xpt
#ifdef MOZ_ENABLE_PROFILER_SPS
@RESPATH@/components/memory_profiler.xpt
#endif
@RESPATH@/browser/components/migration.xpt
@RESPATH@/components/mimetype.xpt
@RESPATH@/components/mozfind.xpt
@ -285,9 +282,6 @@
@RESPATH@/components/plugin.xpt
@RESPATH@/components/pref.xpt
@RESPATH@/components/prefetch.xpt
#ifdef MOZ_ENABLE_PROFILER_SPS
@RESPATH@/components/profiler.xpt
#endif
@RESPATH@/components/rdf.xpt
@RESPATH@/components/satchel.xpt
@RESPATH@/components/saxparser.xpt

12
dom/indexedDB/ActorsParent.cpp

@ -13470,10 +13470,6 @@ nsresult
ConnectionPool::
ThreadRunnable::Run()
{
#ifdef MOZ_ENABLE_PROFILER_SPS
char stackTopGuess;
#endif // MOZ_ENABLE_PROFILER_SPS
MOZ_ASSERT(!IsOnBackgroundThread());
MOZ_ASSERT(mContinueRunning);
@ -13490,10 +13486,6 @@ ThreadRunnable::Run()
const nsPrintfCString threadName("IndexedDB #%lu", mSerialNumber);
PR_SetCurrentThreadName(threadName.get());
#ifdef MOZ_ENABLE_PROFILER_SPS
profiler_register_thread(threadName.get(), &stackTopGuess);
#endif // MOZ_ENABLE_PROFILER_SPS
}
{
@ -13537,10 +13529,6 @@ ThreadRunnable::Run()
}
}
#ifdef MOZ_ENABLE_PROFILER_SPS
profiler_unregister_thread();
#endif // MOZ_ENABLE_PROFILER_SPS
return NS_OK;
}

15
dom/indexedDB/IndexedDatabaseManager.cpp

@ -153,7 +153,7 @@ const char kPrefMaxSerilizedMsgSize[] = IDB_PREF_BRANCH_ROOT "maxSerializedMsgSi
const char kPrefLoggingEnabled[] = IDB_PREF_LOGGING_BRANCH_ROOT "enabled";
const char kPrefLoggingDetails[] = IDB_PREF_LOGGING_BRANCH_ROOT "details";
#if defined(DEBUG) || defined(MOZ_ENABLE_PROFILER_SPS)
#if defined(DEBUG)
const char kPrefLoggingProfiler[] =
IDB_PREF_LOGGING_BRANCH_ROOT "profiler-marks";
#endif
@ -415,10 +415,7 @@ IndexedDatabaseManager::Init()
Preferences::RegisterCallback(LoggingModePrefChangedCallback,
kPrefLoggingDetails);
#ifdef MOZ_ENABLE_PROFILER_SPS
Preferences::RegisterCallback(LoggingModePrefChangedCallback,
kPrefLoggingProfiler);
#endif
Preferences::RegisterCallbackAndCall(LoggingModePrefChangedCallback,
kPrefLoggingEnabled);
@ -479,10 +476,6 @@ IndexedDatabaseManager::Destroy()
Preferences::UnregisterCallback(LoggingModePrefChangedCallback,
kPrefLoggingDetails);
#ifdef MOZ_ENABLE_PROFILER_SPS
Preferences::UnregisterCallback(LoggingModePrefChangedCallback,
kPrefLoggingProfiler);
#endif
Preferences::UnregisterCallback(LoggingModePrefChangedCallback,
kPrefLoggingEnabled);
@ -1060,15 +1053,13 @@ IndexedDatabaseManager::LoggingModePrefChangedCallback(
}
bool useProfiler =
#if defined(DEBUG) || defined(MOZ_ENABLE_PROFILER_SPS)
#if defined(DEBUG)
Preferences::GetBool(kPrefLoggingProfiler);
#if !defined(MOZ_ENABLE_PROFILER_SPS)
if (useProfiler) {
NS_WARNING("IndexedDB cannot create profiler marks because this build does "
"not have profiler extensions enabled!");
useProfiler = false;
}
#endif
#else
false;
#endif

9
dom/ipc/ContentChild.cpp

@ -2612,15 +2612,6 @@ ContentChild::RecvShutdown()
GetIPCChannel()->SetAbortOnError(false);
#ifdef MOZ_ENABLE_PROFILER_SPS
if (profiler_is_active()) {
// We're shutting down while we were profiling. Send the
// profile up to the parent so that we don't lose this
// information.
Unused << RecvGatherProfile();
}
#endif
// Start a timer that will insure we quickly exit after a reasonable
// period of time. Prevents shutdown hangs after our connection to the
// parent closes.

114
dom/ipc/ContentParent.cpp

@ -81,9 +81,6 @@
#include "mozilla/Preferences.h"
#include "mozilla/ProcessHangMonitor.h"
#include "mozilla/ProcessHangMonitorIPC.h"
#ifdef MOZ_ENABLE_PROFILER_SPS
#include "mozilla/ProfileGatherer.h"
#endif
#include "mozilla/ScopeExit.h"
#include "mozilla/Services.h"
#include "mozilla/StaticPtr.h"
@ -220,11 +217,6 @@
#include "nsIBrowserSearchService.h"
#endif
#ifdef MOZ_ENABLE_PROFILER_SPS
#include "nsIProfiler.h"
#include "nsIProfileSaveEvent.h"
#endif
#ifdef XP_WIN
#include "mozilla/widget/AudioSession.h"
#endif
@ -245,9 +237,6 @@ extern const char* kForceEnableE10sPref;
using base::ChildPrivileges;
using base::KillProcess;
#ifdef MOZ_ENABLE_PROFILER_SPS
using mozilla::ProfileGatherer;
#endif
using namespace mozilla::dom::power;
using namespace mozilla::media;
@ -514,14 +503,6 @@ static const char* sObserverTopics[] = {
"file-watcher-update",
#ifdef ACCESSIBILITY
"a11y-init-or-shutdown",
#endif
#ifdef MOZ_ENABLE_PROFILER_SPS
"profiler-started",
"profiler-stopped",
"profiler-paused",
"profiler-resumed",
"profiler-subprocess-gather",
"profiler-subprocess",
#endif
"cacheservice:empty-cache",
};
@ -1305,26 +1286,6 @@ ContentParent::Init()
}
#endif
#ifdef MOZ_ENABLE_PROFILER_SPS
nsCOMPtr<nsIProfiler> profiler(do_GetService("@mozilla.org/tools/profiler;1"));
bool profilerActive = false;
DebugOnly<nsresult> rv = profiler->IsActive(&profilerActive);
MOZ_ASSERT(NS_SUCCEEDED(rv));
if (profilerActive) {
nsCOMPtr<nsIProfilerStartParams> currentProfilerParams;
rv = profiler->GetStartParams(getter_AddRefs(currentProfilerParams));
MOZ_ASSERT(NS_SUCCEEDED(rv));
nsCOMPtr<nsISupports> gatherer;
rv = profiler->GetProfileGatherer(getter_AddRefs(gatherer));
MOZ_ASSERT(NS_SUCCEEDED(rv));
mGatherer = static_cast<ProfileGatherer*>(gatherer.get());
StartProfiler(currentProfilerParams);
}
#endif
RefPtr<GeckoMediaPluginServiceParent> gmps(GeckoMediaPluginServiceParent::GetSingleton());
gmps->UpdateContentProcessGMPCapabilities();
}
@ -1751,12 +1712,6 @@ ContentParent::ActorDestroy(ActorDestroyReason why)
mConsoleService = nullptr;
#ifdef MOZ_ENABLE_PROFILER_SPS
if (mGatherer && !mProfile.IsEmpty()) {
mGatherer->OOPExitProfile(mProfile);
}
#endif
if (obs) {
RefPtr<nsHashPropertyBag> props = new nsHashPropertyBag();
@ -2556,27 +2511,6 @@ ContentParent::Observe(nsISupports* aSubject,
NS_ASSERTION(!mSubprocess, "Close should have nulled mSubprocess");
}
#ifdef MOZ_ENABLE_PROFILER_SPS
// Need to do this before the mIsAlive check to avoid missing profiles.
if (!strcmp(aTopic, "profiler-subprocess-gather")) {
if (mGatherer) {
mGatherer->WillGatherOOPProfile();
if (mIsAlive && mSubprocess) {
Unused << SendGatherProfile();
}
}
}
else if (!strcmp(aTopic, "profiler-subprocess")) {
nsCOMPtr<nsIProfileSaveEvent> pse = do_QueryInterface(aSubject);
if (pse) {
if (!mProfile.IsEmpty()) {
pse->AddSubProfile(mProfile.get());
mProfile.Truncate();
}
}
}
#endif
if (!mIsAlive || !mSubprocess)
return NS_OK;
@ -2662,22 +2596,6 @@ ContentParent::Observe(nsISupports* aSubject,
Unused << SendShutdownA11y();
}
}
#endif
#ifdef MOZ_ENABLE_PROFILER_SPS
else if (!strcmp(aTopic, "profiler-started")) {
nsCOMPtr<nsIProfilerStartParams> params(do_QueryInterface(aSubject));
StartProfiler(params);
}
else if (!strcmp(aTopic, "profiler-stopped")) {
mGatherer = nullptr;
Unused << SendStopProfiler();
}
else if (!strcmp(aTopic, "profiler-paused")) {
Unused << SendPauseProfiler(true);
}
else if (!strcmp(aTopic, "profiler-resumed")) {
Unused << SendPauseProfiler(false);
}
#endif
else if (!strcmp(aTopic, "cacheservice:empty-cache")) {
Unused << SendNotifyEmptyHTTPCache();
@ -4559,13 +4477,7 @@ ContentParent::RecvCreateWindow(PBrowserParent* aThisTab,
bool
ContentParent::RecvProfile(const nsCString& aProfile)
{
#ifdef MOZ_ENABLE_PROFILER_SPS
if (NS_WARN_IF(!mGatherer)) {
return true;
}
mProfile = aProfile;
mGatherer->GatheredOOPProfile();
#endif
/*** STUB ***/
return true;
}
@ -4658,29 +4570,7 @@ ContentParent::RecvNotifyBenchmarkResult(const nsString& aCodecName,
void
ContentParent::StartProfiler(nsIProfilerStartParams* aParams)
{
#ifdef MOZ_ENABLE_PROFILER_SPS
if (NS_WARN_IF(!aParams)) {
return;
}
ProfilerInitParams ipcParams;
ipcParams.enabled() = true;
aParams->GetEntries(&ipcParams.entries());
aParams->GetInterval(&ipcParams.interval());
ipcParams.features() = aParams->GetFeatures();
ipcParams.threadFilters() = aParams->GetThreadFilterNames();
Unused << SendStartProfiler(ipcParams);
nsCOMPtr<nsIProfiler> profiler(do_GetService("@mozilla.org/tools/profiler;1"));
if (NS_WARN_IF(!profiler)) {
return;
}
nsCOMPtr<nsISupports> gatherer;
profiler->GetProfileGatherer(getter_AddRefs(gatherer));
mGatherer = static_cast<ProfileGatherer*>(gatherer.get());
#endif
/*** STUB ***/
}
bool

6
dom/ipc/ContentParent.h

@ -42,9 +42,6 @@ class nsIWidget;
namespace mozilla {
class PRemoteSpellcheckEngineParent;
#ifdef MOZ_ENABLE_PROFILER_SPS
class ProfileGatherer;
#endif
namespace embedding {
class PrintingParent;
@ -1128,9 +1125,6 @@ private:
PProcessHangMonitorParent* mHangMonitorActor;
#ifdef MOZ_ENABLE_PROFILER_SPS
RefPtr<mozilla::ProfileGatherer> mGatherer;
#endif
nsCString mProfile;
UniquePtr<gfx::DriverCrashGuard> mDriverCrashGuard;

163
dom/plugins/ipc/PluginModuleParent.cpp

@ -18,9 +18,6 @@
#include "mozilla/plugins/PluginBridge.h"
#include "mozilla/plugins/PluginInstanceParent.h"
#include "mozilla/Preferences.h"
#ifdef MOZ_ENABLE_PROFILER_SPS
#include "mozilla/ProfileGatherer.h"
#endif
#include "mozilla/ProcessHangMonitor.h"
#include "mozilla/Services.h"
#include "mozilla/Telemetry.h"
@ -46,11 +43,6 @@
#include "PluginUtilsWin.h"
#endif
#ifdef MOZ_ENABLE_PROFILER_SPS
#include "nsIProfiler.h"
#include "nsIProfileSaveEvent.h"
#endif
#ifdef MOZ_WIDGET_GTK
#include <glib.h>
#elif XP_MACOSX
@ -61,9 +53,6 @@
using base::KillProcess;
using mozilla::PluginLibrary;
#ifdef MOZ_ENABLE_PROFILER_SPS
using mozilla::ProfileGatherer;
#endif
using mozilla::ipc::MessageChannel;
using mozilla::ipc::GeckoChildProcessHost;
using mozilla::dom::CrashReporterParent;
@ -544,25 +533,6 @@ PluginModuleChromeParent::OnProcessLaunched(const bool aSucceeded)
}
#endif
}
#ifdef MOZ_ENABLE_PROFILER_SPS
nsCOMPtr<nsIProfiler> profiler(do_GetService("@mozilla.org/tools/profiler;1"));
bool profilerActive = false;
DebugOnly<nsresult> rv = profiler->IsActive(&profilerActive);
MOZ_ASSERT(NS_SUCCEEDED(rv));
if (profilerActive) {
nsCOMPtr<nsIProfilerStartParams> currentProfilerParams;
rv = profiler->GetStartParams(getter_AddRefs(currentProfilerParams));
MOZ_ASSERT(NS_SUCCEEDED(rv));
nsCOMPtr<nsISupports> gatherer;
rv = profiler->GetProfileGatherer(getter_AddRefs(gatherer));
MOZ_ASSERT(NS_SUCCEEDED(rv));
mGatherer = static_cast<ProfileGatherer*>(gatherer.get());
StartProfiler(currentProfilerParams);
}
#endif
}
bool
@ -648,10 +618,6 @@ PluginModuleChromeParent::PluginModuleChromeParent(const char* aFilePath,
mSandboxLevel = aSandboxLevel;
mRunID = GeckoChildProcessHost::GetUniqueID();
#ifdef MOZ_ENABLE_PROFILER_SPS
InitPluginProfiling();
#endif
mozilla::HangMonitor::RegisterAnnotator(*this);
}
@ -661,10 +627,6 @@ PluginModuleChromeParent::~PluginModuleChromeParent()
NS_RUNTIMEABORT("unsafe destruction");
}
#ifdef MOZ_ENABLE_PROFILER_SPS
ShutdownPluginProfiling();
#endif
#ifdef XP_WIN
// If we registered for audio notifications, stop.
mozilla::plugins::PluginUtilsWin::RegisterForAudioDeviceChanges(this,
@ -2680,133 +2642,10 @@ PluginModuleParent::AnswerNPN_SetValue_NPPVpluginRequiresAudioDeviceChanges(
return true;
}
#ifdef MOZ_ENABLE_PROFILER_SPS
class PluginProfilerObserver final : public nsIObserver,
public nsSupportsWeakReference
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIOBSERVER
explicit PluginProfilerObserver(PluginModuleChromeParent* pmp)
: mPmp(pmp)
{}
private:
~PluginProfilerObserver() {}
PluginModuleChromeParent* mPmp;
};
NS_IMPL_ISUPPORTS(PluginProfilerObserver, nsIObserver, nsISupportsWeakReference)
NS_IMETHODIMP
PluginProfilerObserver::Observe(nsISupports *aSubject,
const char *aTopic,
const char16_t *aData)
{
if (!strcmp(aTopic, "profiler-started")) {
nsCOMPtr<nsIProfilerStartParams> params(do_QueryInterface(aSubject));
mPmp->StartProfiler(params);
} else if (!strcmp(aTopic, "profiler-stopped")) {
mPmp->StopProfiler();
} else if (!strcmp(aTopic, "profiler-subprocess-gather")) {
mPmp->GatherAsyncProfile();
} else if (!strcmp(aTopic, "profiler-subprocess")) {
nsCOMPtr<nsIProfileSaveEvent> pse = do_QueryInterface(aSubject);
mPmp->GatheredAsyncProfile(pse);
}
return NS_OK;
}
void
PluginModuleChromeParent::InitPluginProfiling()
{
nsCOMPtr<nsIObserverService> observerService = mozilla::services::GetObserverService();
if (observerService) {
mProfilerObserver = new PluginProfilerObserver(this);
observerService->AddObserver(mProfilerObserver, "profiler-started", false);
observerService->AddObserver(mProfilerObserver, "profiler-stopped", false);
observerService->AddObserver(mProfilerObserver, "profiler-subprocess-gather", false);
observerService->AddObserver(mProfilerObserver, "profiler-subprocess", false);
}
}
void
PluginModuleChromeParent::ShutdownPluginProfiling()
{
nsCOMPtr<nsIObserverService> observerService = mozilla::services::GetObserverService();
if (observerService) {
observerService->RemoveObserver(mProfilerObserver, "profiler-started");
observerService->RemoveObserver(mProfilerObserver, "profiler-stopped");
observerService->RemoveObserver(mProfilerObserver, "profiler-subprocess-gather");
observerService->RemoveObserver(mProfilerObserver, "profiler-subprocess");
}
}
void
PluginModuleChromeParent::StartProfiler(nsIProfilerStartParams* aParams)
{
if (NS_WARN_IF(!aParams)) {
return;
}
ProfilerInitParams ipcParams;
ipcParams.enabled() = true;
aParams->GetEntries(&ipcParams.entries());
aParams->GetInterval(&ipcParams.interval());
ipcParams.features() = aParams->GetFeatures();
ipcParams.threadFilters() = aParams->GetThreadFilterNames();
Unused << SendStartProfiler(ipcParams);
nsCOMPtr<nsIProfiler> profiler(do_GetService("@mozilla.org/tools/profiler;1"));
if (NS_WARN_IF(!profiler)) {
return;
}
nsCOMPtr<nsISupports> gatherer;
profiler->GetProfileGatherer(getter_AddRefs(gatherer));
mGatherer = static_cast<ProfileGatherer*>(gatherer.get());
}
void
PluginModuleChromeParent::StopProfiler()
{
mGatherer = nullptr;
Unused << SendStopProfiler();
}
void
PluginModuleChromeParent::GatherAsyncProfile()
{
if (NS_WARN_IF(!mGatherer)) {
return;
}
mGatherer->WillGatherOOPProfile();
Unused << SendGatherProfile();
}
void
PluginModuleChromeParent::GatheredAsyncProfile(nsIProfileSaveEvent* aSaveEvent)
{
if (aSaveEvent && !mProfile.IsEmpty()) {
aSaveEvent->AddSubProfile(mProfile.get());
mProfile.Truncate();
}
}
#endif // MOZ_ENABLE_PROFILER_SPS
bool
PluginModuleChromeParent::RecvProfile(const nsCString& aProfile)
{
#ifdef MOZ_ENABLE_PROFILER_SPS
if (NS_WARN_IF(!mGatherer)) {
return true;
}
mProfile = aProfile;
mGatherer->GatheredOOPProfile();
#endif
/*** STUB ***/
return true;
}

19
dom/plugins/ipc/PluginModuleParent.h

@ -30,10 +30,6 @@ class nsIProfileSaveEvent;
class nsPluginTag;
namespace mozilla {
#ifdef MOZ_ENABLE_PROFILER_SPS
class ProfileGatherer;
#endif
namespace layers {
class TextureClientRecycleAllocator;
} // namespace layers
@ -467,13 +463,6 @@ class PluginModuleChromeParent
void CachedSettingChanged();
#ifdef MOZ_ENABLE_PROFILER_SPS
void GatherAsyncProfile();
void GatheredAsyncProfile(nsIProfileSaveEvent* aSaveEvent);
void StartProfiler(nsIProfilerStartParams* aParams);
void StopProfiler();
#endif
virtual bool
RecvProfile(const nsCString& aProfile) override;
@ -519,11 +508,6 @@ private:
virtual void UpdatePluginTimeout() override;
#ifdef MOZ_ENABLE_PROFILER_SPS
void InitPluginProfiling();
void ShutdownPluginProfiling();
#endif
void RegisterSettingsCallbacks();
void UnregisterSettingsCallbacks();
@ -606,9 +590,6 @@ private:
// processes in existence!
dom::ContentParent* mContentParent;
nsCOMPtr<nsIObserver> mPluginOfflineObserver;
#ifdef MOZ_ENABLE_PROFILER_SPS
RefPtr<mozilla::ProfileGatherer> mGatherer;
#endif
nsCString mProfile;
bool mIsBlocklisted;
static bool sInstantiated;

13
dom/workers/RuntimeService.cpp

@ -2811,13 +2811,6 @@ WorkerThreadPrimaryRunnable::Run()
}
{
#ifdef MOZ_ENABLE_PROFILER_SPS
PseudoStack* stack = mozilla_get_pseudo_stack();
if (stack) {
stack->sampleContext(cx);
}
#endif
{
JSAutoRequest ar(cx);
@ -2829,12 +2822,6 @@ WorkerThreadPrimaryRunnable::Run()
}
BackgroundChild::CloseForCurrentThread();
#ifdef MOZ_ENABLE_PROFILER_SPS
if (stack) {
stack->sampleContext(nullptr);
}
#endif
}
// There may still be runnables on the debugger event queue that hold a

24
gfx/layers/composite/ContainerLayerComposite.cpp

@ -35,9 +35,6 @@
#include "TextRenderer.h" // for TextRenderer
#include <vector>
#include "GeckoProfiler.h" // for GeckoProfiler
#ifdef MOZ_ENABLE_PROFILER_SPS
#include "ProfilerMarkers.h" // for ProfilerMarkers
#endif
#define CULLING_LOG(...)
// #define CULLING_LOG(...) printf_stderr("CULLING: " __VA_ARGS__)
@ -86,26 +83,7 @@ static gfx::IntRect ContainerVisibleRect(ContainerT* aContainer)
static void PrintUniformityInfo(Layer* aLayer)
{
#ifdef MOZ_ENABLE_PROFILER_SPS
if (!profiler_is_active()) {
return;
}
// Don't want to print a log for smaller layers
if (aLayer->GetLocalVisibleRegion().GetBounds().width < 300 ||
aLayer->GetLocalVisibleRegion().GetBounds().height < 300) {
return;
}
Matrix4x4 transform = aLayer->AsLayerComposite()->GetShadowBaseTransform();
if (!transform.Is2D()) {
return;
}
Point translation = transform.As2D().GetTranslation();
LayerTranslationPayload* payload = new LayerTranslationPayload(aLayer, translation);
PROFILER_MARKER_PAYLOAD("LayerTranslation", payload);
#endif
/*** STUB ***/
}
/* all of the per-layer prepared data we need to maintain */

9
gfx/layers/ipc/CompositorBridgeParent.cpp

@ -74,9 +74,6 @@
#include "mozilla/HalTypes.h"
#include "mozilla/StaticPtr.h"
#include "mozilla/Telemetry.h"
#ifdef MOZ_ENABLE_PROFILER_SPS
#include "ProfilerMarkers.h"
#endif
#include "mozilla/VsyncDispatcher.h"
#if defined(XP_WIN) || defined(MOZ_WIDGET_GTK)
#include "VsyncSource.h"
@ -1923,11 +1920,7 @@ CompositorBridgeParent::GetAPZCTreeManager(uint64_t aLayersId)
static void
InsertVsyncProfilerMarker(TimeStamp aVsyncTimestamp)
{
#ifdef MOZ_ENABLE_PROFILER_SPS
MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());
VsyncPayload* payload = new VsyncPayload(aVsyncTimestamp);
PROFILER_MARKER_PAYLOAD("VsyncTimestamp", payload);
#endif
/*** STUB ***/
}
/*static */ void

3
gfx/layers/ipc/CrossProcessCompositorBridgeParent.cpp

@ -73,9 +73,6 @@
#include "mozilla/HalTypes.h"
#include "mozilla/StaticPtr.h"
#include "mozilla/Telemetry.h"
#ifdef MOZ_ENABLE_PROFILER_SPS
#include "ProfilerMarkers.h"
#endif
#include "mozilla/VsyncDispatcher.h"
#if defined(XP_WIN) || defined(MOZ_WIDGET_GTK)
#include "VsyncSource.h"

14
gfx/layers/ipc/ImageBridgeChild.cpp

@ -73,24 +73,10 @@ protected:
MOZ_IS_CLASS_INIT
void Init() {
#ifdef MOZ_ENABLE_PROFILER_SPS
mPseudoStackHack = mozilla_get_pseudo_stack();
#endif
}
void CleanUp() {
#ifdef MOZ_ENABLE_PROFILER_SPS
mPseudoStackHack = nullptr;
#endif
}
private:
#ifdef MOZ_ENABLE_PROFILER_SPS
// This is needed to avoid a spurious leak report. There's no other
// use for it. See bug 1239504 and bug 1215265.
MOZ_INIT_OUTSIDE_CTOR PseudoStack* mPseudoStackHack;
#endif
};
}

12
gfx/thebes/ContextStateTracker.cpp

@ -5,9 +5,6 @@
#include "ContextStateTracker.h"
#include "GLContext.h"
#ifdef MOZ_ENABLE_PROFILER_SPS
#include "ProfilerMarkers.h"
#endif
namespace mozilla {
@ -110,15 +107,6 @@ ContextStateTrackerOGL::Flush(GLContext* aGL)
aGL->fDeleteQueries(1, &handle);
#ifdef MOZ_ENABLE_PROFILER_SPS
PROFILER_MARKER_PAYLOAD("gpu_timer_query", new GPUMarkerPayload(
mCompletedSections[0].mCpuTimeStart,
mCompletedSections[0].mCpuTimeEnd,
0,
gpuTime
));
#endif
mCompletedSections.RemoveElementAt(0);
}
}

10
js/xpconnect/src/XPCJSContext.cpp

@ -1528,12 +1528,6 @@ XPCJSContext::~XPCJSContext()
delete mDyingWrappedNativeProtoMap;
mDyingWrappedNativeProtoMap = nullptr;
#ifdef MOZ_ENABLE_PROFILER_SPS
// Tell the profiler that the context is gone
if (PseudoStack* stack = mozilla_get_pseudo_stack())
stack->sampleContext(nullptr);
#endif
Preferences::UnregisterCallback(ReloadPrefsCallback, JS_OPTIONS_DOT_STR, this);
}
@ -3382,10 +3376,6 @@ XPCJSContext::Initialize()
JS_AddWeakPointerCompartmentCallback(cx, WeakPointerCompartmentCallback, this);
JS_SetWrapObjectCallbacks(cx, &WrapObjectCallbacks);
js::SetPreserveWrapperCallback(cx, PreserveWrapper);
#ifdef MOZ_ENABLE_PROFILER_SPS
if (PseudoStack* stack = mozilla_get_pseudo_stack())
stack->sampleContext(cx);
#endif
JS_SetAccumulateTelemetryCallback(cx, AccumulateTelemetryCallback);
js::SetActivityCallback(cx, ActivityCallback, this);
JS_AddInterruptCallback(cx, InterruptCallback);

18
layout/base/RestyleTracker.cpp

@ -61,9 +61,6 @@ RestyleTracker::Document() const {
struct RestyleEnumerateData : RestyleTracker::Hints {
RefPtr<dom::Element> mElement;
#if defined(MOZ_ENABLE_PROFILER_SPS)
UniquePtr<ProfilerBacktrace> mBacktrace;
#endif
};
inline void
@ -257,12 +254,6 @@ RestyleTracker::DoProcessRestyles()
data->mRestyleHint, MarkerTracingType::START)));
}
#if defined(MOZ_ENABLE_PROFILER_SPS)
Maybe<GeckoProfilerTracingRAII> profilerRAII;
if (profiler_feature_active("restyle")) {
profilerRAII.emplace("Paint", "Styles", Move(data->mBacktrace));
}
#endif
ProcessOneRestyle(element, data->mRestyleHint, data->mChangeHint,
data->mRestyleHintData);
AddRestyleRootsIfAwaitingRestyle(data->mDescendants);
@ -337,9 +328,6 @@ RestyleTracker::DoProcessRestyles()
// We can move data since we'll be clearing mPendingRestyles after
// we finish enumerating it.
restyle->mRestyleHintData = Move(data->mRestyleHintData);
#if defined(MOZ_ENABLE_PROFILER_SPS)
restyle->mBacktrace = Move(data->mBacktrace);
#endif
#ifdef RESTYLE_LOGGING
count++;
@ -365,12 +353,6 @@ RestyleTracker::DoProcessRestyles()
index++, count);
LOG_RESTYLE_INDENT();
#if defined(MOZ_ENABLE_PROFILER_SPS)
Maybe<GeckoProfilerTracingRAII> profilerRAII;
if (profiler_feature_active("restyle")) {
profilerRAII.emplace("Paint", "Styles", Move(currentRestyle->mBacktrace));
}
#endif
if (isTimelineRecording) {
timelines->AddMarkerForDocShell(docShell, Move(
MakeUnique<RestyleTimelineMarker>(

12
layout/base/RestyleTracker.h

@ -22,10 +22,6 @@
#include "GeckoProfiler.h"
#include "mozilla/Maybe.h"
#if defined(MOZ_ENABLE_PROFILER_SPS)
#include "ProfilerBacktrace.h"
#endif
namespace mozilla {
class RestyleManager;
@ -128,9 +124,6 @@ public:
// that we called AddPendingRestyle for and found the element this is
// the RestyleData for as its nearest restyle root.
nsTArray<RefPtr<Element>> mDescendants;
#if defined(MOZ_ENABLE_PROFILER_SPS)
UniquePtr<ProfilerBacktrace> mBacktrace;
#endif
};
/**
@ -265,11 +258,6 @@ RestyleTracker::AddPendingRestyleToTable(Element* aElement,
if (!existingData) {
RestyleData* rd =
new RestyleData(aRestyleHint, aMinChangeHint, aRestyleHintData);
#if defined(MOZ_ENABLE_PROFILER_SPS)
if (profiler_feature_active("restyle")) {
rd->mBacktrace.reset(profiler_get_backtrace());
}
#endif
mPendingRestyles.Put(aElement, rd);
return false;
}

17
layout/base/nsPresShell.cpp

@ -4064,23 +4064,6 @@ PresShell::FlushPendingNotifications(mozilla::ChangesToFlush aFlush)
*/
mozFlushType flushType = aFlush.mFlushType;
#ifdef MOZ_ENABLE_PROFILER_SPS
static const char flushTypeNames[][20] = {
"Content",
"ContentAndNotify",
"Style",
"InterruptibleLayout",
"Layout",
"Display"
};
// Make sure that we don't miss things added to mozFlushType!
MOZ_ASSERT(static_cast<uint32_t>(flushType) <= ArrayLength(flushTypeNames));
PROFILER_LABEL_PRINTF("PresShell", "Flush",
js::ProfileEntry::Category::GRAPHICS, "(Flush_%s)", flushTypeNames[flushType - 1]);
#endif
#ifdef ACCESSIBILITY
#ifdef DEBUG
nsAccessibilityService* accService = GetAccService();

6
mobile/android/installer/package-manifest.in

@ -174,9 +174,6 @@
@BINPATH@/components/layout_xul.xpt
@BINPATH@/components/locale.xpt
@BINPATH@/components/lwbrk.xpt
#ifdef MOZ_ENABLE_PROFILER_SPS
@BINPATH@/components/memory_profiler.xpt
#endif
@BINPATH@/components/mimetype.xpt
@BINPATH@/components/mozfind.xpt
@BINPATH@/components/necko_about.xpt
@ -206,9 +203,6 @@
@BINPATH@/components/plugin.xpt
@BINPATH@/components/pref.xpt
@BINPATH@/components/prefetch.xpt
#ifdef MOZ_ENABLE_PROFILER_SPS
@BINPATH@/components/profiler.xpt
#endif
@BINPATH@/components/rdf.xpt
@BINPATH@/components/satchel.xpt
@BINPATH@/components/saxparser.xpt

12
storage/TelemetryVFS.cpp

@ -110,18 +110,6 @@ public:
// We don't report SQLite I/O on Windows because we have a comprehensive
// mechanism for intercepting I/O on that platform that captures a superset
// of the data captured here.
#if defined(MOZ_ENABLE_PROFILER_SPS) && !defined(XP_WIN)
if (IOInterposer::IsObservedOperation(op)) {
const char* main_ref = "sqlite-mainthread";
const char* other_ref = "sqlite-otherthread";
// Create observation
IOInterposeObserver::Observation ob(op, start, end,
(mainThread ? main_ref : other_ref));
// Report observation
IOInterposer::Report(ob);
}
#endif /* defined(MOZ_ENABLE_PROFILER_SPS) && !defined(XP_WIN) */
}
private:

136
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);

19
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;
/**

7
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,

3
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