diff --git a/mozglue/baseprofiler/core/platform-linux-android.cpp b/mozglue/baseprofiler/core/platform-linux-android.cpp index 02634514b6f8..9829d74c37f6 100644 --- a/mozglue/baseprofiler/core/platform-linux-android.cpp +++ b/mozglue/baseprofiler/core/platform-linux-android.cpp @@ -387,7 +387,7 @@ static void* ThreadEntry(void* aArg) { SamplerThread::SamplerThread(PSLockRef aLock, uint32_t aActivityGeneration, double aIntervalMilliseconds) - : Sampler(aLock), + : mSampler(aLock), mActivityGeneration(aActivityGeneration), mIntervalMicroseconds( std::max(1, int(floor(aIntervalMilliseconds * 1000 + 0.5)))) { @@ -451,7 +451,7 @@ void SamplerThread::Stop(PSLockRef aLock) { // though this SamplerThread is still alive, because the next time the main // loop of Run() iterates it won't get past the mActivityGeneration check, // and so won't send any signals. - Sampler::Disable(aLock); + mSampler.Disable(aLock); } // END SamplerThread target specifics diff --git a/mozglue/baseprofiler/core/platform-macos.cpp b/mozglue/baseprofiler/core/platform-macos.cpp index 3e686036c110..68db6348b3a2 100644 --- a/mozglue/baseprofiler/core/platform-macos.cpp +++ b/mozglue/baseprofiler/core/platform-macos.cpp @@ -153,7 +153,7 @@ static void* ThreadEntry(void* aArg) { SamplerThread::SamplerThread(PSLockRef aLock, uint32_t aActivityGeneration, double aIntervalMilliseconds) - : Sampler(aLock), + : mSampler(aLock), mActivityGeneration(aActivityGeneration), mIntervalMicroseconds( std::max(1, int(floor(aIntervalMilliseconds * 1000 + 0.5)))), @@ -174,7 +174,7 @@ void SamplerThread::SleepMicro(uint32_t aMicroseconds) { // case where the usleep call is interrupted by a signal. } -void SamplerThread::Stop(PSLockRef aLock) { Sampler::Disable(aLock); } +void SamplerThread::Stop(PSLockRef aLock) { mSampler.Disable(aLock); } // END SamplerThread target specifics //////////////////////////////////////////////////////////////////////// diff --git a/mozglue/baseprofiler/core/platform-win32.cpp b/mozglue/baseprofiler/core/platform-win32.cpp index 8f28a40f2ea5..a70546ce86ff 100644 --- a/mozglue/baseprofiler/core/platform-win32.cpp +++ b/mozglue/baseprofiler/core/platform-win32.cpp @@ -200,7 +200,7 @@ static unsigned int __stdcall ThreadEntry(void* aArg) { SamplerThread::SamplerThread(PSLockRef aLock, uint32_t aActivityGeneration, double aIntervalMilliseconds) - : Sampler(aLock), + : mSampler(aLock), mActivityGeneration(aActivityGeneration), mIntervalMicroseconds( std::max(1, int(floor(aIntervalMilliseconds * 1000 + 0.5)))) { @@ -267,7 +267,7 @@ void SamplerThread::Stop(PSLockRef aLock) { ::timeEndPeriod(mIntervalMicroseconds / 1000); } - Sampler::Disable(aLock); + mSampler.Disable(aLock); } // END SamplerThread target specifics diff --git a/mozglue/baseprofiler/core/platform.cpp b/mozglue/baseprofiler/core/platform.cpp index b1613ead44b0..8455b177c013 100644 --- a/mozglue/baseprofiler/core/platform.cpp +++ b/mozglue/baseprofiler/core/platform.cpp @@ -983,8 +983,8 @@ class Registers { void Clear() { memset(this, 0, sizeof(*this)); } // These fields are filled in by - // SamplerThread::SuspendAndSampleAndResumeThread() for periodic and - // backtrace samples, and by SyncPopulate() for synchronous samples. + // Sampler::SuspendAndSampleAndResumeThread() for periodic and backtrace + // samples, and by SyncPopulate() for synchronous samples. Address mPC; // Instruction pointer. Address mSP; // Stack pointer. Address mFP; // Frame pointer. @@ -1885,7 +1885,7 @@ class Sampler { // active. It periodically runs through all registered threads, finds those // that should be sampled, then pauses and samples them. -class SamplerThread : public Sampler { +class SamplerThread { public: // Creates a sampler thread, but doesn't start it. SamplerThread(PSLockRef aLock, uint32_t aActivityGeneration, @@ -1903,6 +1903,9 @@ class SamplerThread : public Sampler { // Best effort timing. void SleepMicro(uint32_t aMicroseconds); + // The sampler used to suspend and sample threads. + Sampler mSampler; + // The activity generation, for detecting when the sampler thread must stop. const uint32_t mActivityGeneration; @@ -2010,7 +2013,7 @@ void SamplerThread::Run() { } now = TimeStamp::NowUnfuzzed(); - SuspendAndSampleAndResumeThread( + mSampler.SuspendAndSampleAndResumeThread( lock, *registeredThread, [&](const Registers& aRegs) { DoPeriodicSample(lock, *registeredThread, *profiledThreadData, now, aRegs); diff --git a/tools/profiler/core/platform-linux-android.cpp b/tools/profiler/core/platform-linux-android.cpp index a421e635f32b..c1a9babc231a 100644 --- a/tools/profiler/core/platform-linux-android.cpp +++ b/tools/profiler/core/platform-linux-android.cpp @@ -378,7 +378,7 @@ static void* ThreadEntry(void* aArg) { SamplerThread::SamplerThread(PSLockRef aLock, uint32_t aActivityGeneration, double aIntervalMilliseconds) - : Sampler(aLock), + : mSampler(aLock), mActivityGeneration(aActivityGeneration), mIntervalMicroseconds( std::max(1, int(floor(aIntervalMilliseconds * 1000 + 0.5)))) { @@ -442,7 +442,7 @@ void SamplerThread::Stop(PSLockRef aLock) { // though this SamplerThread is still alive, because the next time the main // loop of Run() iterates it won't get past the mActivityGeneration check, // and so won't send any signals. - Sampler::Disable(aLock); + mSampler.Disable(aLock); } // END SamplerThread target specifics diff --git a/tools/profiler/core/platform-macos.cpp b/tools/profiler/core/platform-macos.cpp index c4177282e9f8..2afe046643d0 100644 --- a/tools/profiler/core/platform-macos.cpp +++ b/tools/profiler/core/platform-macos.cpp @@ -148,7 +148,7 @@ static void* ThreadEntry(void* aArg) { SamplerThread::SamplerThread(PSLockRef aLock, uint32_t aActivityGeneration, double aIntervalMilliseconds) - : Sampler(aLock), + : mSampler(aLock), mActivityGeneration(aActivityGeneration), mIntervalMicroseconds( std::max(1, int(floor(aIntervalMilliseconds * 1000 + 0.5)))), @@ -169,7 +169,7 @@ void SamplerThread::SleepMicro(uint32_t aMicroseconds) { // case where the usleep call is interrupted by a signal. } -void SamplerThread::Stop(PSLockRef aLock) { Sampler::Disable(aLock); } +void SamplerThread::Stop(PSLockRef aLock) { mSampler.Disable(aLock); } // END SamplerThread target specifics //////////////////////////////////////////////////////////////////////// diff --git a/tools/profiler/core/platform-win32.cpp b/tools/profiler/core/platform-win32.cpp index ceff5f11ba28..e0adfb9cab41 100644 --- a/tools/profiler/core/platform-win32.cpp +++ b/tools/profiler/core/platform-win32.cpp @@ -185,7 +185,7 @@ static unsigned int __stdcall ThreadEntry(void* aArg) { SamplerThread::SamplerThread(PSLockRef aLock, uint32_t aActivityGeneration, double aIntervalMilliseconds) - : Sampler(aLock), + : mSampler(aLock), mActivityGeneration(aActivityGeneration), mIntervalMicroseconds( std::max(1, int(floor(aIntervalMilliseconds * 1000 + 0.5)))) { @@ -252,7 +252,7 @@ void SamplerThread::Stop(PSLockRef aLock) { ::timeEndPeriod(mIntervalMicroseconds / 1000); } - Sampler::Disable(aLock); + mSampler.Disable(aLock); } // END SamplerThread target specifics diff --git a/tools/profiler/core/platform.cpp b/tools/profiler/core/platform.cpp index e47a5646823a..218a606fdd9d 100644 --- a/tools/profiler/core/platform.cpp +++ b/tools/profiler/core/platform.cpp @@ -1083,8 +1083,8 @@ class Registers { void Clear() { memset(this, 0, sizeof(*this)); } // These fields are filled in by - // SamplerThread::SuspendAndSampleAndResumeThread() for periodic and - // backtrace samples, and by SyncPopulate() for synchronous samples. + // Sampler::SuspendAndSampleAndResumeThread() for periodic and backtrace + // samples, and by SyncPopulate() for synchronous samples. Address mPC; // Instruction pointer. Address mSP; // Stack pointer. Address mFP; // Frame pointer. @@ -2431,7 +2431,7 @@ class Sampler { // active. It periodically runs through all registered threads, finds those // that should be sampled, then pauses and samples them. -class SamplerThread : public Sampler { +class SamplerThread { public: // Creates a sampler thread, but doesn't start it. SamplerThread(PSLockRef aLock, uint32_t aActivityGeneration, @@ -2449,6 +2449,9 @@ class SamplerThread : public Sampler { // Best effort timing. void SleepMicro(uint32_t aMicroseconds); + // The sampler used to suspend and sample threads. + Sampler mSampler; + // The activity generation, for detecting when the sampler thread must stop. const uint32_t mActivityGeneration; @@ -2578,7 +2581,7 @@ void SamplerThread::Run() { } now = TimeStamp::NowUnfuzzed(); - SuspendAndSampleAndResumeThread( + mSampler.SuspendAndSampleAndResumeThread( lock, *registeredThread, [&](const Registers& aRegs) { DoPeriodicSample(lock, *registeredThread, *profiledThreadData, now, aRegs);