Bug 1634784 - Remove MOZ_BASE_PROFILER and replace it with MOZ_GECKO_PROFILER everywhere. r=gerald

Differential Revision: https://phabricator.services.mozilla.com/D73526
This commit is contained in:
Markus Stange 2020-05-05 21:44:11 +00:00
parent 1bb0550030
commit 6725e6df9a
38 changed files with 83 additions and 155 deletions

View File

@ -202,7 +202,7 @@ static void EnsureBaseProfilerInitialized() {
return;
}
#ifdef MOZ_BASE_PROFILER
#ifdef MOZ_GECKO_PROFILER
// The stack depth we observe here will be determined by the stack of
// whichever caller enters this code first. In practice this means that we may
// miss some root-most frames, which hopefully shouldn't ruin profiling.

View File

@ -24,7 +24,7 @@
#include "BaseProfiler.h"
#ifdef MOZ_BASE_PROFILER
#ifdef MOZ_GECKO_PROFILER
# include "EHABIStackWalk.h"
@ -645,4 +645,4 @@ EHState::EHState(const mcontext_t& context) {
} // namespace baseprofiler
} // namespace mozilla
#endif // MOZ_BASE_PROFILER
#endif // MOZ_GECKO_PROFILER

View File

@ -6,7 +6,7 @@
#include "BaseProfiler.h"
#ifdef MOZ_BASE_PROFILER
#ifdef MOZ_GECKO_PROFILER
# include "PageInformation.h"
@ -51,4 +51,4 @@ size_t PageInformation::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const {
} // namespace baseprofiler
} // namespace mozilla
#endif // MOZ_BASE_PROFILER
#endif // MOZ_GECKO_PROFILER

View File

@ -6,7 +6,7 @@
#include "BaseProfiler.h"
#ifdef MOZ_BASE_PROFILER
#ifdef MOZ_GECKO_PROFILER
# include "ProfileBuffer.h"
@ -208,4 +208,4 @@ void ProfileBufferCollector::CollectProfilingStackFrame(
} // namespace baseprofiler
} // namespace mozilla
#endif // MOZ_BASE_PROFILER
#endif // MOZ_GECKO_PROFILER

View File

@ -6,7 +6,7 @@
#include "BaseProfiler.h"
#ifdef MOZ_BASE_PROFILER
#ifdef MOZ_GECKO_PROFILER
# include "ProfileBufferEntry.h"
@ -1377,4 +1377,4 @@ void ProfileBuffer::DiscardSamplesBeforeTime(double aTime) {
} // namespace baseprofiler
} // namespace mozilla
#endif // MOZ_BASE_PROFILER
#endif // MOZ_GECKO_PROFILER

View File

@ -5,7 +5,7 @@
#include "BaseProfiler.h"
#ifdef MOZ_BASE_PROFILER
#ifdef MOZ_GECKO_PROFILER
# include "BaseProfileJSONWriter.h"
@ -129,4 +129,4 @@ void SpliceableChunkedJSONWriter::TakeAndSplice(ChunkedJSONWriteFunc* aFunc) {
} // namespace baseprofiler
} // namespace mozilla
#endif // MOZ_BASE_PROFILER
#endif // MOZ_GECKO_PROFILER

View File

@ -6,7 +6,7 @@
#include "BaseProfiler.h"
#ifdef MOZ_BASE_PROFILER
#ifdef MOZ_GECKO_PROFILER
# include "ProfiledThreadData.h"
@ -171,4 +171,4 @@ void StreamSamplesAndMarkers(const char* aName, int aThreadId,
} // namespace baseprofiler
} // namespace mozilla
#endif // MOZ_BASE_PROFILER
#endif // MOZ_GECKO_PROFILER

View File

@ -6,7 +6,7 @@
#include "BaseProfiler.h"
#ifdef MOZ_BASE_PROFILER
#ifdef MOZ_GECKO_PROFILER
# include "ProfilerBacktrace.h"
@ -80,4 +80,4 @@ ProfileBufferEntryReader::
} // namespace mozilla
#endif // MOZ_BASE_PROFILER
#endif // MOZ_GECKO_PROFILER

View File

@ -5,7 +5,7 @@
#include "BaseProfiler.h"
#ifdef MOZ_BASE_PROFILER
#ifdef MOZ_GECKO_PROFILER
# include "BaseProfilerMarkerPayload.h"
@ -543,4 +543,4 @@ void LongTaskMarkerPayload::StreamPayload(SpliceableJSONWriter& aWriter,
} // namespace baseprofiler
} // namespace mozilla
#endif // MOZ_BASE_PROFILER
#endif // MOZ_GECKO_PROFILER

View File

@ -6,7 +6,7 @@
#include "BaseProfiler.h"
#ifdef MOZ_BASE_PROFILER
#ifdef MOZ_GECKO_PROFILER
# include "BaseProfilingCategory.h"
@ -72,4 +72,4 @@ const ProfilingCategoryPairInfo& GetProfilingCategoryPairInfo(
} // namespace baseprofiler
} // namespace mozilla
#endif // MOZ_BASE_PROFILER
#endif // MOZ_GECKO_PROFILER

View File

@ -6,7 +6,7 @@
#include "BaseProfiler.h"
#ifdef MOZ_BASE_PROFILER
#ifdef MOZ_GECKO_PROFILER
# include "BaseProfilingStack.h"
@ -53,4 +53,4 @@ void ProfilingStack::ensureCapacitySlow() {
} // namespace baseprofiler
} // namespace mozilla
#endif // MOZ_BASE_PROFILER
#endif // MOZ_GECKO_PROFILER

View File

@ -6,7 +6,7 @@
#include "BaseProfiler.h"
#ifdef MOZ_BASE_PROFILER
#ifdef MOZ_GECKO_PROFILER
# include "RegisteredThread.h"
@ -44,4 +44,4 @@ size_t RegisteredThread::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const {
} // namespace baseprofiler
} // namespace mozilla
#endif // MOZ_BASE_PROFILER
#endif // MOZ_GECKO_PROFILER

View File

@ -6,7 +6,7 @@
#include "BaseProfiler.h"
#ifdef MOZ_BASE_PROFILER
#ifdef MOZ_GECKO_PROFILER
# ifdef XP_WIN
# undef UNICODE
@ -93,4 +93,4 @@ void VTuneProfiler::RegisterThreadInternal(const char* aName) {
} // namespace baseprofiler
} // namespace mozilla
#endif // MOZ_BASE_PROFILER
#endif // MOZ_GECKO_PROFILER

View File

@ -28,7 +28,7 @@
#include "BaseProfiler.h"
#ifdef MOZ_BASE_PROFILER
#ifdef MOZ_GECKO_PROFILER
# include "platform.h"
@ -3584,4 +3584,4 @@ void profiler_suspend_and_sample_thread(int aThreadId, uint32_t aFeatures,
} // namespace baseprofiler
} // namespace mozilla
#endif // MOZ_BASE_PROFILER
#endif // MOZ_GECKO_PROFILER

View File

@ -6,7 +6,7 @@
#include "BaseProfiler.h"
#ifdef MOZ_BASE_PROFILER
#ifdef MOZ_GECKO_PROFILER
# include "BaseProfilerSharedLibraries.h"
@ -850,4 +850,4 @@ SharedLibraryInfo SharedLibraryInfo::GetInfoForSelf() {
void SharedLibraryInfo::Initialize() { /* do nothing */
}
#endif // MOZ_BASE_PROFILER
#endif // MOZ_GECKO_PROFILER

View File

@ -5,7 +5,7 @@
#include "BaseProfiler.h"
#ifdef MOZ_BASE_PROFILER
#ifdef MOZ_GECKO_PROFILER
# include "BaseProfilerSharedLibraries.h"
@ -185,4 +185,4 @@ SharedLibraryInfo SharedLibraryInfo::GetInfoForSelf() {
return sharedLibraryInfo;
}
#endif // MOZ_BASE_PROFILER
#endif // MOZ_GECKO_PROFILER

View File

@ -5,7 +5,7 @@
#include "BaseProfiler.h"
#ifdef MOZ_BASE_PROFILER
#ifdef MOZ_GECKO_PROFILER
# include <windows.h>
# include <dbghelp.h>
@ -238,4 +238,4 @@ SharedLibraryInfo SharedLibraryInfo::GetInfoForSelf() {
void SharedLibraryInfo::Initialize() { /* do nothing */
}
#endif // MOZ_BASE_PROFILER
#endif // MOZ_GECKO_PROFILER

View File

@ -6,7 +6,7 @@
#include "BaseProfiler.h"
#ifdef MOZ_BASE_PROFILER
#ifdef MOZ_GECKO_PROFILER
# include <sys/mman.h>
# include <unistd.h>
@ -153,4 +153,4 @@ bool AutoObjectMapperFaultyLib::Map(/*OUT*/ void** start,
# endif // defined(MOZ_LINKER)
#endif // MOZ_BASE_PROFILER
#endif // MOZ_GECKO_PROFILER

View File

@ -39,7 +39,7 @@
#include "BaseProfiler.h"
#ifdef MOZ_BASE_PROFILER
#ifdef MOZ_GECKO_PROFILER
// There's no internal-only interface for LulCommon. Hence include
// the external interface directly.
@ -103,4 +103,4 @@ const UniqueString* UniqueStringUniverse::ToUniqueString(string str) {
} // namespace lul
#endif // MOZ_BASE_PROFILER
#endif // MOZ_GECKO_PROFILER

View File

@ -43,7 +43,7 @@
#include "BaseProfiler.h"
#ifdef MOZ_BASE_PROFILER
#ifdef MOZ_GECKO_PROFILER
# include <stdint.h>
# include <stdio.h>
@ -2255,4 +2255,4 @@ void DwarfCFIToModule::Reporter::ExpressionCouldNotBeSummarised(
} // namespace lul
#endif // MOZ_BASE_PROFILER
#endif // MOZ_GECKO_PROFILER

View File

@ -6,7 +6,7 @@
#include "BaseProfiler.h"
#ifdef MOZ_BASE_PROFILER
#ifdef MOZ_GECKO_PROFILER
# include "LulDwarfSummariser.h"
@ -556,4 +556,4 @@ void Summariser::End() {
} // namespace lul
#endif // MOZ_BASE_PROFILER
#endif // MOZ_GECKO_PROFILER

View File

@ -47,7 +47,7 @@
#include "BaseProfiler.h"
#ifdef MOZ_BASE_PROFILER
#ifdef MOZ_GECKO_PROFILER
# include <errno.h>
# include <fcntl.h>
@ -875,4 +875,4 @@ void FileID::ConvertIdentifierToString(const uint8_t identifier[kMDGUIDSize],
} // namespace lul
#endif // MOZ_BASE_PROFILER
#endif // MOZ_GECKO_PROFILER

View File

@ -6,7 +6,7 @@
#include "BaseProfiler.h"
#ifdef MOZ_BASE_PROFILER
#ifdef MOZ_GECKO_PROFILER
# include "LulMain.h"
@ -1959,4 +1959,4 @@ void RunLulUnitTests(/*OUT*/ int* aNTests, /*OUT*/ int* aNTestsPassed,
} // namespace lul
#endif // MOZ_BASE_PROFILER
#endif // MOZ_GECKO_PROFILER

View File

@ -5,7 +5,7 @@
#include "BaseProfiler.h"
#ifdef MOZ_BASE_PROFILER
#ifdef MOZ_GECKO_PROFILER
# include <stdio.h>
# include <signal.h>
@ -83,4 +83,4 @@ void logging_sink_for_LUL(const char* str) {
// VERBOSE_LOG("[%d] %s", profiler_current_process_id(), str);
}
#endif // MOZ_BASE_PROFILER
#endif // MOZ_GECKO_PROFILER

View File

@ -74,8 +74,9 @@ if CONFIG['MOZ_GECKO_PROFILER']:
FINAL_LIBRARY = 'mozglue'
# BaseProfiler.h and BaseProfilerCounts.h are the only headers that are usable
# in non-MOZ_GECKO_PROFILER builds, and they only contains no-op macros in that
# Many of the headers in this directory are usable in non-MOZ_GECKO_PROFILER
# builds.
# BaseProfiler.h and BaseProfilerCounts.h only contain no-op macros in that
# case.
EXPORTS += [
'public/BaseProfiler.h',

View File

@ -8,8 +8,8 @@
#include "BaseProfiler.h"
#ifndef MOZ_BASE_PROFILER
# error Do not #include this header when MOZ_BASE_PROFILER is not #defined.
#ifndef MOZ_GECKO_PROFILER
# error Do not #include this header when MOZ_GECKO_PROFILER is not #defined.
#endif
#include "mozilla/JSONWriter.h"

View File

@ -16,24 +16,17 @@
#ifndef BaseProfiler_h
#define BaseProfiler_h
// Everything in here is also safe to include unconditionally, and only defines
// empty macros if MOZ_GECKO_PROFILER or MOZ_BASE_PROFILER is unset.
// MOZ_BASE_PROFILER is #defined (or not) in this header, so it should be
// #included wherever Base Profiler may be used.
#ifdef MOZ_GECKO_PROFILER
# define MOZ_BASE_PROFILER
#endif // MOZ_GECKO_PROFILER
// This file is safe to include unconditionally, and only defines
// empty macros if MOZ_GECKO_PROFILER is not set.
// BaseProfilerCounts.h is also safe to include unconditionally, with empty
// macros if MOZ_BASE_PROFILER is unset.
// macros if MOZ_GECKO_PROFILER is not set.
#include "mozilla/BaseProfilerCounts.h"
#ifndef MOZ_BASE_PROFILER
#ifndef MOZ_GECKO_PROFILER
// This file can be #included unconditionally. However, everything within this
// file must be guarded by a #ifdef MOZ_BASE_PROFILER, *except* for the
// file must be guarded by a #ifdef MOZ_GECKO_PROFILER, *except* for the
// following macros, which encapsulate the most common operations and thus
// avoid the need for many #ifdefs.
@ -67,7 +60,7 @@
# define AUTO_PROFILER_STATS(name)
#else // !MOZ_BASE_PROFILER
#else // !MOZ_GECKO_PROFILER
# include "BaseProfilingStack.h"
@ -1030,6 +1023,6 @@ MFBT_API void GetProfilerEnvVarsForChildProcess(
} // namespace baseprofiler
} // namespace mozilla
#endif // !MOZ_BASE_PROFILER
#endif // !MOZ_GECKO_PROFILER
#endif // BaseProfiler_h

View File

@ -7,7 +7,7 @@
#ifndef BaseProfilerCounts_h
#define BaseProfilerCounts_h
#ifndef MOZ_BASE_PROFILER
#ifndef MOZ_GECKO_PROFILER
# define BASE_PROFILER_DEFINE_COUNT_TOTAL(label, category, description)
# define BASE_PROFILER_DEFINE_COUNT(label, category, description)
@ -275,6 +275,6 @@ class ProfilerCounterTotal final : public BaseProfilerCount {
} // namespace baseprofiler
} // namespace mozilla
#endif // !MOZ_BASE_PROFILER
#endif // !MOZ_GECKO_PROFILER
#endif // BaseProfilerCounts_h

View File

@ -14,12 +14,12 @@
#ifdef DEBUG
# include "BaseProfiler.h"
# ifdef MOZ_BASE_PROFILER
# ifdef MOZ_GECKO_PROFILER
# include "mozilla/Atomics.h"
// When #defined, safety-checking code is added. By default: DEBUG builds,
// and we need `MOZ_BASE_PROFILER` to use `profiler_current_thread_id()`.
// and we need `MOZ_GECKO_PROFILER` to use `profiler_current_thread_id()`.
# define MOZ_BASE_PROFILER_DEBUG
# endif // MOZ_BASE_PROFILER
# endif // MOZ_GECKO_PROFILER
#endif // DEBUG
namespace mozilla {

View File

@ -9,8 +9,8 @@
#include "BaseProfiler.h"
#ifndef MOZ_BASE_PROFILER
# error Do not #include this header when MOZ_BASE_PROFILER is not #defined.
#ifndef MOZ_GECKO_PROFILER
# error Do not #include this header when MOZ_GECKO_PROFILER is not #defined.
#endif
#include "mozilla/Atomics.h"

View File

@ -9,8 +9,8 @@
#include "BaseProfiler.h"
#ifndef MOZ_BASE_PROFILER
# error Do not #include this header when MOZ_BASE_PROFILER is not #defined.
#ifndef MOZ_GECKO_PROFILER
# error Do not #include this header when MOZ_GECKO_PROFILER is not #defined.
#endif
#include <algorithm>

View File

@ -9,8 +9,8 @@
#include "BaseProfiler.h"
#ifndef MOZ_BASE_PROFILER
# error Do not #include this header when MOZ_BASE_PROFILER is not #defined.
#ifndef MOZ_GECKO_PROFILER
# error Do not #include this header when MOZ_GECKO_PROFILER is not #defined.
#endif
#include "mozilla/Types.h"

View File

@ -13,8 +13,8 @@
#include "BaseProfiler.h"
#ifndef MOZ_BASE_PROFILER
# error Do not #include this header when MOZ_BASE_PROFILER is not #defined.
#ifndef MOZ_GECKO_PROFILER
# error Do not #include this header when MOZ_GECKO_PROFILER is not #defined.
#endif
#include <algorithm>

View File

@ -638,7 +638,7 @@ MFBT_API void DllBlocklist_Initialize(uint32_t aInitFlags) {
// cases, it's ok not to check user32.dll in this scenario.
const bool skipUser32Check =
(sInitFlags & eDllBlocklistInitFlagWasBootstrapped)
#ifdef MOZ_BASE_PROFILER
#ifdef MOZ_GECKO_PROFILER
||
(!IsWin10AnniversaryUpdateOrLater() && baseprofiler::profiler_is_active())
#endif

View File

@ -16,10 +16,10 @@
#include "mozilla/ProfileChunkedBuffer.h"
#include "mozilla/Vector.h"
#ifdef MOZ_BASE_PROFILER
#ifdef MOZ_GECKO_PROFILER
# include "BaseProfileJSONWriter.h"
# include "BaseProfilerMarkerPayload.h"
#endif // MOZ_BASE_PROFILER
#endif // MOZ_GECKO_PROFILER
#if defined(_MSC_VER) || defined(__MINGW32__)
# include <windows.h>
@ -2530,7 +2530,7 @@ void TestProfilerDependencies() {
TestBlocksRingBufferSerialization();
}
#ifdef MOZ_BASE_PROFILER
#ifdef MOZ_GECKO_PROFILER
class BaseTestMarkerPayload : public baseprofiler::ProfilerMarkerPayload {
public:
@ -2855,10 +2855,10 @@ void TestProfiler() {
printf("TestProfiler done\n");
}
#else // MOZ_BASE_PROFILER
#else // MOZ_GECKO_PROFILER
// Testing that macros are still #defined (but do nothing) when
// MOZ_BASE_PROFILER is disabled.
// MOZ_GECKO_PROFILER is disabled.
void TestProfiler() {
// These don't need to make sense, we just want to know that they're defined
// and don't do anything.
@ -2872,7 +2872,7 @@ void TestProfiler() {
AUTO_BASE_PROFILER_THREAD_SLEEP;
}
#endif // MOZ_BASE_PROFILER else
#endif // MOZ_GECKO_PROFILER else
#if defined(XP_WIN)
int wmain()
@ -2880,18 +2880,18 @@ int wmain()
int main()
#endif // defined(XP_WIN)
{
#ifdef MOZ_BASE_PROFILER
#ifdef MOZ_GECKO_PROFILER
printf("BaseTestProfiler -- pid: %d, tid: %d\n",
baseprofiler::profiler_current_process_id(),
baseprofiler::profiler_current_thread_id());
// ::SleepMilli(10000);
#endif // MOZ_BASE_PROFILER
#endif // MOZ_GECKO_PROFILER
// Always run tests that don't involve the profiler directly.
TestProfilerDependencies();
// Note that there are two `TestProfiler` functions above, depending on
// whether MOZ_BASE_PROFILER is #defined.
// whether MOZ_GECKO_PROFILER is #defined.
TestProfiler();
return 0;

View File

@ -288,52 +288,7 @@ void Registers::SyncPopulate() {
#if defined(GP_PLAT_amd64_windows)
# ifndef MOZ_BASE_PROFILER
// If MOZ_BASE_PROFILER is *not* #defined, we need to implement this here, as
// the one in mozglue/baseprofiler will not even be built.
static WindowsDllInterceptor NtDllIntercept;
typedef NTSTATUS(NTAPI* LdrUnloadDll_func)(HMODULE module);
static WindowsDllInterceptor::FuncHookType<LdrUnloadDll_func> stub_LdrUnloadDll;
static NTSTATUS NTAPI patched_LdrUnloadDll(HMODULE module) {
// Prevent the stack walker from suspending this thread when LdrUnloadDll
// holds the RtlLookupFunctionEntry lock.
AutoSuppressStackWalking suppress;
return stub_LdrUnloadDll(module);
}
// These pointers are disguised as PVOID to avoid pulling in obscure headers
typedef PVOID(WINAPI* LdrResolveDelayLoadedAPI_func)(
PVOID ParentModuleBase, PVOID DelayloadDescriptor, PVOID FailureDllHook,
PVOID FailureSystemHook, PVOID ThunkAddress, ULONG Flags);
static WindowsDllInterceptor::FuncHookType<LdrResolveDelayLoadedAPI_func>
stub_LdrResolveDelayLoadedAPI;
static PVOID WINAPI patched_LdrResolveDelayLoadedAPI(
PVOID ParentModuleBase, PVOID DelayloadDescriptor, PVOID FailureDllHook,
PVOID FailureSystemHook, PVOID ThunkAddress, ULONG Flags) {
// Prevent the stack walker from suspending this thread when
// LdrResolveDelayLoadAPI holds the RtlLookupFunctionEntry lock.
AutoSuppressStackWalking suppress;
return stub_LdrResolveDelayLoadedAPI(ParentModuleBase, DelayloadDescriptor,
FailureDllHook, FailureSystemHook,
ThunkAddress, Flags);
}
void InitializeWin64ProfilerHooks() {
NtDllIntercept.Init("ntdll.dll");
stub_LdrUnloadDll.Set(NtDllIntercept, "LdrUnloadDll", &patched_LdrUnloadDll);
if (IsWin8OrLater()) { // LdrResolveDelayLoadedAPI was introduced in Win8
stub_LdrResolveDelayLoadedAPI.Set(NtDllIntercept,
"LdrResolveDelayLoadedAPI",
&patched_LdrResolveDelayLoadedAPI);
}
}
# else // ndef MOZ_BASE_PROFILER
// If MOZ_BASE_PROFILER is #defined, we just use InitializeWin64ProfilerHooks
// that it implements.
// Use InitializeWin64ProfilerHooks from the base profiler.
namespace mozilla {
namespace baseprofiler {
@ -343,5 +298,4 @@ MFBT_API void InitializeWin64ProfilerHooks();
using mozilla::baseprofiler::InitializeWin64ProfilerHooks;
# endif // ndef MOZ_BASE_PROFILER else
#endif // defined(GP_PLAT_amd64_windows)

View File

@ -1132,7 +1132,6 @@ class ActivePS {
MOZ_ASSERT(sInstance);
uint64_t bufferRangeStart = sInstance->mProfileBuffer.BufferRangeStart();
// Discard exit profiles that were gathered before our buffer RangeStart.
#ifdef MOZ_BASE_PROFILER
// If we have started to overwrite our data from when the Base profile was
// added, we should get rid of that Base profile because it's now older than
// our oldest Gecko profile data.
@ -1159,14 +1158,12 @@ class ActivePS {
sInstance->mBaseProfileThreads.get());
sInstance->mBaseProfileThreads.reset();
}
#endif
sInstance->mExitProfiles.eraseIf(
[bufferRangeStart](const ExitProfile& aExitProfile) {
return aExitProfile.mBufferPositionAtGatherTime < bufferRangeStart;
});
}
#ifdef MOZ_BASE_PROFILER
static void AddBaseProfileThreads(PSLockRef aLock,
UniquePtr<char[]> aBaseProfileThreads) {
MOZ_ASSERT(sInstance);
@ -1186,7 +1183,6 @@ class ActivePS {
sInstance->mBaseProfileThreads.get());
return std::move(sInstance->mBaseProfileThreads);
}
#endif
static void AddExitProfile(PSLockRef aLock, const nsCString& aExitProfile) {
MOZ_ASSERT(sInstance);
@ -1293,11 +1289,9 @@ class ActivePS {
bool mWasPaused;
#endif
#ifdef MOZ_BASE_PROFILER
// Optional startup profile thread array from BaseProfiler.
UniquePtr<char[]> mBaseProfileThreads;
ProfileBufferBlockIndex mGeckoIndexWhenBaseProfileAdded;
#endif
struct ExitProfile {
nsCString mJSON;
@ -2570,13 +2564,11 @@ static void locked_profiler_stream_json_for_this_process(
}
#endif
#ifdef MOZ_BASE_PROFILER
UniquePtr<char[]> baseProfileThreads =
ActivePS::MoveBaseProfileThreads(aLock);
if (baseProfileThreads) {
aWriter.Splice(baseProfileThreads.get());
}
#endif
}
aWriter.EndArray();
@ -2660,9 +2652,7 @@ static void PrintUsageThenExit(int aExitCode) {
"\n"
" MOZ_PROFILER_HELP\n"
" If set to any value, prints this message.\n"
#ifdef MOZ_BASE_PROFILER
" Use MOZ_BASE_PROFILER_HELP for BaseProfiler help.\n"
#endif
"\n"
" MOZ_LOG\n"
" Enables logging. The levels of logging available are\n"
@ -4001,7 +3991,6 @@ void GetProfilerEnvVarsForChildProcess(
}
aSetEnv("MOZ_PROFILER_STARTUP_FILTERS", filtersString.c_str());
#ifdef MOZ_BASE_PROFILER
// Blindly copy MOZ_BASE_PROFILER_STARTUP* env-vars.
auto copyEnv = [&](const char* aName) {
const char* env = getenv(aName);
@ -4017,7 +4006,6 @@ void GetProfilerEnvVarsForChildProcess(
copyEnv("MOZ_BASE_PROFILER_STARTUP_FEATURES_BITFIELD");
copyEnv("MOZ_BASE_PROFILER_STARTUP_FEATURES");
copyEnv("MOZ_BASE_PROFILER_STARTUP_FILTERS");
#endif
}
} // namespace mozilla
@ -4139,7 +4127,6 @@ static void TriggerPollJSSamplingOnMainThread() {
}
}
#ifdef MOZ_BASE_PROFILER
static bool HasMinimumLength(const char* aString, size_t aMinimumLength) {
if (!aString) {
return false;
@ -4151,7 +4138,6 @@ static bool HasMinimumLength(const char* aString, size_t aMinimumLength) {
}
return true;
}
#endif // MOZ_BASE_PROFILER
static void locked_profiler_start(PSLockRef aLock, PowerOfTwo32 aCapacity,
double aInterval, uint32_t aFeatures,
@ -4181,7 +4167,6 @@ static void locked_profiler_start(PSLockRef aLock, PowerOfTwo32 aCapacity,
MOZ_RELEASE_ASSERT(CorePS::Exists() && !ActivePS::Exists(aLock));
#ifdef MOZ_BASE_PROFILER
UniquePtr<char[]> baseprofile;
if (baseprofiler::profiler_is_active()) {
// Note that we still hold the lock, so the sampler cannot run yet and
@ -4206,7 +4191,6 @@ static void locked_profiler_start(PSLockRef aLock, PowerOfTwo32 aCapacity,
// TODO: Re-start BP after GP shutdown, to capture post-XPCOM shutdown.
baseprofiler::profiler_stop();
}
#endif
#if defined(GP_PLAT_amd64_windows)
InitializeWin64ProfilerHooks();
@ -4232,7 +4216,6 @@ static void locked_profiler_start(PSLockRef aLock, PowerOfTwo32 aCapacity,
// ActivePS::Create can only succeed or crash.
MOZ_ASSERT(ActivePS::Exists(aLock));
#ifdef MOZ_BASE_PROFILER
// An "empty" profile string may in fact contain 1 character (a newline), so
// we want at least 2 characters to register a profile.
if (HasMinimumLength(baseprofile.get(), 2)) {
@ -4241,7 +4224,6 @@ static void locked_profiler_start(PSLockRef aLock, PowerOfTwo32 aCapacity,
// corresponding Gecko Profiler thread.
ActivePS::AddBaseProfileThreads(aLock, std::move(baseprofile));
}
#endif
// Set up profiling for each registered thread, if appropriate.
Maybe<int> mainThreadId;

View File

@ -1793,7 +1793,6 @@ TEST(GeckoProfiler, PostSamplingCallback)
[&](SamplingState) { ASSERT_TRUE(false); }));
}
#ifdef MOZ_BASE_PROFILER
TEST(GeckoProfiler, BaseProfilerHandOff)
{
const char* filters[] = {"GeckoMain"};
@ -1840,4 +1839,3 @@ TEST(GeckoProfiler, BaseProfilerHandOff)
profiler_stop();
ASSERT_TRUE(!profiler_is_active());
}
#endif // MOZ_BASE_PROFILER