Loading tools/profiler/core/platform.cpp +20 −13 Original line number Diff line number Diff line Loading @@ -2255,7 +2255,7 @@ static void DoNativeBacktrace( // The grammar for entry sequences is in a comment above // ProfileBuffer::StreamSamplesToJSON. static inline void DoSharedSample( PSLockRef aLock, bool aIsSynchronous, PSLockRef aLock, bool aIsSynchronous, uint32_t aFeatures, const ThreadRegistration::UnlockedReaderAndAtomicRWOnThread& aThreadData, const Registers& aRegs, uint64_t aSamplePos, uint64_t aBufferRangeStart, ProfileBuffer& aBuffer, Loading @@ -2271,7 +2271,7 @@ static inline void DoSharedSample( JsFrameBuffer& jsFrames = CorePS::JsFrames(aLock); StackWalkControl* stackWalkControlIfSupported = nullptr; #if defined(HAVE_NATIVE_UNWIND) const bool captureNative = ActivePS::FeatureStackWalk(aLock) && const bool captureNative = ProfilerFeature::HasStackWalk(aFeatures) && aCaptureOptions == StackCaptureOptions::Full; StackWalkControl stackWalkControl; if constexpr (StackWalkControl::scIsSupported) { Loading @@ -2289,16 +2289,16 @@ static inline void DoSharedSample( DoNativeBacktrace(aThreadData, aRegs, nativeStack, stackWalkControlIfSupported); MergeStacks(ActivePS::Features(aLock), aIsSynchronous, aThreadData, aRegs, nativeStack, collector, jsFrames, jsFramesCount); MergeStacks(aFeatures, aIsSynchronous, aThreadData, aRegs, nativeStack, collector, jsFrames, jsFramesCount); } else #endif { MergeStacks(ActivePS::Features(aLock), aIsSynchronous, aThreadData, aRegs, nativeStack, collector, jsFrames, jsFramesCount); MergeStacks(aFeatures, aIsSynchronous, aThreadData, aRegs, nativeStack, collector, jsFrames, jsFramesCount); // We can't walk the whole native stack, but we can record the top frame. if (ActivePS::FeatureLeaf(aLock) && if (ProfilerFeature::HasLeaf(aFeatures) && aCaptureOptions == StackCaptureOptions::Full) { aBuffer.AddEntry(ProfileBufferEntry::NativeLeafAddr((void*)aRegs.mPC)); } Loading @@ -2307,7 +2307,7 @@ static inline void DoSharedSample( // Writes the components of a synchronous sample to the given ProfileBuffer. static void DoSyncSample( PSLockRef aLock, PSLockRef aLock, uint32_t aFeatures, const ThreadRegistration::UnlockedReaderAndAtomicRWOnThread& aThreadData, const TimeStamp& aNow, const Registers& aRegs, ProfileBuffer& aBuffer, StackCaptureOptions aCaptureOptions) { Loading @@ -2324,8 +2324,8 @@ static void DoSyncSample( TimeDuration delta = aNow - CorePS::ProcessStartTime(); aBuffer.AddEntry(ProfileBufferEntry::Time(delta.ToMilliseconds())); DoSharedSample(aLock, /* aIsSynchronous = */ true, aThreadData, aRegs, samplePos, bufferRangeStart, aBuffer, aCaptureOptions); DoSharedSample(aLock, /* aIsSynchronous = */ true, aFeatures, aThreadData, aRegs, samplePos, bufferRangeStart, aBuffer, aCaptureOptions); } // Writes the components of a periodic sample to ActivePS's ProfileBuffer. Loading @@ -2338,8 +2338,8 @@ static inline void DoPeriodicSample( ProfileBuffer& aBuffer) { // WARNING: this function runs within the profiler's "critical section". DoSharedSample(aLock, /* aIsSynchronous = */ false, aThreadData, aRegs, aSamplePos, aBufferRangeStart, aBuffer); DoSharedSample(aLock, /* aIsSynchronous = */ false, ActivePS::Features(aLock), aThreadData, aRegs, aSamplePos, aBufferRangeStart, aBuffer); } // END sampling/unwinding code Loading Loading @@ -5510,6 +5510,12 @@ bool profiler_capture_backtrace_into(ProfileChunkedBuffer& aChunkedBuffer, return ThreadRegistration::WithOnThreadRefOr( [&](ThreadRegistration::OnThreadRef aOnThreadRef) { mozilla::Maybe<uint32_t> maybeFeatures = RacyFeatures::FeaturesIfActiveAndUnpaused(); if (!maybeFeatures) { return false; } ProfileBuffer profileBuffer(aChunkedBuffer); Registers regs; Loading @@ -5519,7 +5525,8 @@ bool profiler_capture_backtrace_into(ProfileChunkedBuffer& aChunkedBuffer, regs.Clear(); #endif DoSyncSample(lock, aOnThreadRef.UnlockedReaderAndAtomicRWOnThreadCRef(), DoSyncSample(lock, *maybeFeatures, aOnThreadRef.UnlockedReaderAndAtomicRWOnThreadCRef(), TimeStamp::Now(), regs, profileBuffer, aCaptureOptions); return true; Loading Loading
tools/profiler/core/platform.cpp +20 −13 Original line number Diff line number Diff line Loading @@ -2255,7 +2255,7 @@ static void DoNativeBacktrace( // The grammar for entry sequences is in a comment above // ProfileBuffer::StreamSamplesToJSON. static inline void DoSharedSample( PSLockRef aLock, bool aIsSynchronous, PSLockRef aLock, bool aIsSynchronous, uint32_t aFeatures, const ThreadRegistration::UnlockedReaderAndAtomicRWOnThread& aThreadData, const Registers& aRegs, uint64_t aSamplePos, uint64_t aBufferRangeStart, ProfileBuffer& aBuffer, Loading @@ -2271,7 +2271,7 @@ static inline void DoSharedSample( JsFrameBuffer& jsFrames = CorePS::JsFrames(aLock); StackWalkControl* stackWalkControlIfSupported = nullptr; #if defined(HAVE_NATIVE_UNWIND) const bool captureNative = ActivePS::FeatureStackWalk(aLock) && const bool captureNative = ProfilerFeature::HasStackWalk(aFeatures) && aCaptureOptions == StackCaptureOptions::Full; StackWalkControl stackWalkControl; if constexpr (StackWalkControl::scIsSupported) { Loading @@ -2289,16 +2289,16 @@ static inline void DoSharedSample( DoNativeBacktrace(aThreadData, aRegs, nativeStack, stackWalkControlIfSupported); MergeStacks(ActivePS::Features(aLock), aIsSynchronous, aThreadData, aRegs, nativeStack, collector, jsFrames, jsFramesCount); MergeStacks(aFeatures, aIsSynchronous, aThreadData, aRegs, nativeStack, collector, jsFrames, jsFramesCount); } else #endif { MergeStacks(ActivePS::Features(aLock), aIsSynchronous, aThreadData, aRegs, nativeStack, collector, jsFrames, jsFramesCount); MergeStacks(aFeatures, aIsSynchronous, aThreadData, aRegs, nativeStack, collector, jsFrames, jsFramesCount); // We can't walk the whole native stack, but we can record the top frame. if (ActivePS::FeatureLeaf(aLock) && if (ProfilerFeature::HasLeaf(aFeatures) && aCaptureOptions == StackCaptureOptions::Full) { aBuffer.AddEntry(ProfileBufferEntry::NativeLeafAddr((void*)aRegs.mPC)); } Loading @@ -2307,7 +2307,7 @@ static inline void DoSharedSample( // Writes the components of a synchronous sample to the given ProfileBuffer. static void DoSyncSample( PSLockRef aLock, PSLockRef aLock, uint32_t aFeatures, const ThreadRegistration::UnlockedReaderAndAtomicRWOnThread& aThreadData, const TimeStamp& aNow, const Registers& aRegs, ProfileBuffer& aBuffer, StackCaptureOptions aCaptureOptions) { Loading @@ -2324,8 +2324,8 @@ static void DoSyncSample( TimeDuration delta = aNow - CorePS::ProcessStartTime(); aBuffer.AddEntry(ProfileBufferEntry::Time(delta.ToMilliseconds())); DoSharedSample(aLock, /* aIsSynchronous = */ true, aThreadData, aRegs, samplePos, bufferRangeStart, aBuffer, aCaptureOptions); DoSharedSample(aLock, /* aIsSynchronous = */ true, aFeatures, aThreadData, aRegs, samplePos, bufferRangeStart, aBuffer, aCaptureOptions); } // Writes the components of a periodic sample to ActivePS's ProfileBuffer. Loading @@ -2338,8 +2338,8 @@ static inline void DoPeriodicSample( ProfileBuffer& aBuffer) { // WARNING: this function runs within the profiler's "critical section". DoSharedSample(aLock, /* aIsSynchronous = */ false, aThreadData, aRegs, aSamplePos, aBufferRangeStart, aBuffer); DoSharedSample(aLock, /* aIsSynchronous = */ false, ActivePS::Features(aLock), aThreadData, aRegs, aSamplePos, aBufferRangeStart, aBuffer); } // END sampling/unwinding code Loading Loading @@ -5510,6 +5510,12 @@ bool profiler_capture_backtrace_into(ProfileChunkedBuffer& aChunkedBuffer, return ThreadRegistration::WithOnThreadRefOr( [&](ThreadRegistration::OnThreadRef aOnThreadRef) { mozilla::Maybe<uint32_t> maybeFeatures = RacyFeatures::FeaturesIfActiveAndUnpaused(); if (!maybeFeatures) { return false; } ProfileBuffer profileBuffer(aChunkedBuffer); Registers regs; Loading @@ -5519,7 +5525,8 @@ bool profiler_capture_backtrace_into(ProfileChunkedBuffer& aChunkedBuffer, regs.Clear(); #endif DoSyncSample(lock, aOnThreadRef.UnlockedReaderAndAtomicRWOnThreadCRef(), DoSyncSample(lock, *maybeFeatures, aOnThreadRef.UnlockedReaderAndAtomicRWOnThreadCRef(), TimeStamp::Now(), regs, profileBuffer, aCaptureOptions); return true; Loading