mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
Bug 1735697 - Remove profiler_can_accept_markers(), use profiler_thread_is_being_profiled() instead - r=florian
Differential Revision: https://phabricator.services.mozilla.com/D128577
This commit is contained in:
parent
424aac2b72
commit
df50ece611
@ -7899,7 +7899,7 @@ nsresult nsDocShell::CreateContentViewer(const nsACString& aContentType,
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (!parentSite.Equals(thisSite)) {
|
||||
if (profiler_can_accept_markers()) {
|
||||
if (profiler_thread_is_being_profiled()) {
|
||||
nsCOMPtr<nsIURI> prinURI;
|
||||
BasePrincipal::Cast(thisPrincipal)->GetURI(getter_AddRefs(prinURI));
|
||||
nsPrintfCString marker("Iframe loaded in background: %s",
|
||||
|
@ -52,7 +52,7 @@ struct AnimationEventInfo {
|
||||
nsCSSPseudoElements::PseudoTypeAsString(aTarget.mPseudoType);
|
||||
|
||||
if ((aMessage == eAnimationCancel || aMessage == eAnimationEnd) &&
|
||||
profiler_can_accept_markers()) {
|
||||
profiler_thread_is_being_profiled()) {
|
||||
nsCString markerText;
|
||||
aAnimationName->ToUTF8String(markerText);
|
||||
PROFILER_MARKER_TEXT(
|
||||
@ -89,7 +89,7 @@ struct AnimationEventInfo {
|
||||
nsCSSPseudoElements::PseudoTypeAsString(aTarget.mPseudoType);
|
||||
|
||||
if ((aMessage == eTransitionEnd || aMessage == eTransitionCancel) &&
|
||||
profiler_can_accept_markers()) {
|
||||
profiler_thread_is_being_profiled()) {
|
||||
nsCString markerText;
|
||||
markerText.Assign(nsCSSProps::GetStringValue(aProperty));
|
||||
if (aMessage == eTransitionCancel) {
|
||||
|
@ -193,7 +193,7 @@ void ChromeUtils::AddProfilerMarker(
|
||||
GlobalObject& aGlobal, const nsACString& aName,
|
||||
const ProfilerMarkerOptionsOrDouble& aOptions,
|
||||
const Optional<nsACString>& aText) {
|
||||
if (!profiler_can_accept_markers()) {
|
||||
if (!profiler_thread_is_being_profiled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -138,7 +138,7 @@ void TimeoutManager::MoveIdleToActive() {
|
||||
}
|
||||
timeout->remove();
|
||||
mTimeouts.InsertFront(timeout);
|
||||
if (profiler_can_accept_markers()) {
|
||||
if (profiler_thread_is_being_profiled()) {
|
||||
if (num == 0) {
|
||||
now = TimeStamp::Now();
|
||||
}
|
||||
|
@ -170,7 +170,7 @@ void nsDOMNavigationTiming::NotifyLoadEventEnd() {
|
||||
Tracing, "Navigation");
|
||||
|
||||
if (IsTopLevelContentDocumentInContentProcess()) {
|
||||
if (profiler_can_accept_markers() || PAGELOAD_LOG_ENABLED()) {
|
||||
if (profiler_thread_is_being_profiled() || PAGELOAD_LOG_ENABLED()) {
|
||||
TimeDuration elapsed = mLoadEventEnd - mNavigationStart;
|
||||
TimeDuration duration = mLoadEventEnd - mLoadEventStart;
|
||||
nsAutoCString spec;
|
||||
@ -368,7 +368,7 @@ void nsDOMNavigationTiming::TTITimeout(nsITimer* aTimer) {
|
||||
|
||||
mTTITimer = nullptr;
|
||||
|
||||
if (profiler_can_accept_markers() || PAGELOAD_LOG_ENABLED()) {
|
||||
if (profiler_thread_is_being_profiled() || PAGELOAD_LOG_ENABLED()) {
|
||||
TimeDuration elapsed = mTTFI - mNavigationStart;
|
||||
MOZ_ASSERT(elapsed.ToMilliseconds() > 0);
|
||||
TimeDuration elapsedLongTask =
|
||||
@ -447,7 +447,7 @@ void nsDOMNavigationTiming::NotifyContentfulCompositeForRootContentDocument(
|
||||
|
||||
mContentfulComposite = aCompositeEndTime;
|
||||
|
||||
if (profiler_can_accept_markers() || PAGELOAD_LOG_ENABLED()) {
|
||||
if (profiler_thread_is_being_profiled() || PAGELOAD_LOG_ENABLED()) {
|
||||
TimeDuration elapsed = mContentfulComposite - mNavigationStart;
|
||||
nsAutoCString spec;
|
||||
if (mLoadedURI) {
|
||||
|
@ -6241,7 +6241,7 @@ bool nsGlobalWindowInner::RunTimeoutHandler(Timeout* aTimeout,
|
||||
const char* reason = GetTimeoutReasonString(timeout);
|
||||
|
||||
nsCString str;
|
||||
if (profiler_can_accept_markers()) {
|
||||
if (profiler_thread_is_being_profiled()) {
|
||||
TimeDuration originalInterval = timeout->When() - timeout->SubmitTime();
|
||||
str.Append(reason);
|
||||
str.Append(" with interval ");
|
||||
|
@ -291,7 +291,7 @@ UniquePtr<AudioStream::Chunk> AudioSink::PopFrames(uint32_t aFrames) {
|
||||
mCurrentData->mTime.ToMicroseconds(),
|
||||
mCurrentData->Frames() - mCursor->Available(), framesToPop);
|
||||
|
||||
if (profiler_can_accept_markers()) {
|
||||
if (profiler_thread_is_being_profiled()) {
|
||||
mOwnerThread->Dispatch(NS_NewRunnableFunction(
|
||||
"AudioSink:AddMarker",
|
||||
[startTime = mCurrentData->mTime.ToMicroseconds(),
|
||||
|
@ -488,7 +488,7 @@ nsresult DecodedStream::Start(const TimeUnit& aStartTime,
|
||||
MOZ_ASSERT(mStartTime.isNothing(), "playback already started.");
|
||||
|
||||
AUTO_PROFILER_LABEL(FUNCTION_SIGNATURE, MEDIA_PLAYBACK);
|
||||
if (profiler_can_accept_markers()) {
|
||||
if (profiler_thread_is_being_profiled()) {
|
||||
nsPrintfCString markerString("StartTime=%" PRId64,
|
||||
aStartTime.ToMicroseconds());
|
||||
PLAYBACK_PROFILER_MARKER(markerString);
|
||||
@ -665,7 +665,7 @@ void DecodedStream::SetPlaying(bool aPlaying) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (profiler_can_accept_markers()) {
|
||||
if (profiler_thread_is_being_profiled()) {
|
||||
nsPrintfCString markerString("Playing=%s", aPlaying ? "true" : "false");
|
||||
PLAYBACK_PROFILER_MARKER(markerString);
|
||||
}
|
||||
@ -675,7 +675,7 @@ void DecodedStream::SetPlaying(bool aPlaying) {
|
||||
|
||||
void DecodedStream::SetVolume(double aVolume) {
|
||||
AssertOwnerThread();
|
||||
if (profiler_can_accept_markers()) {
|
||||
if (profiler_thread_is_being_profiled()) {
|
||||
nsPrintfCString markerString("Volume=%f", aVolume);
|
||||
PLAYBACK_PROFILER_MARKER(markerString);
|
||||
}
|
||||
@ -690,7 +690,7 @@ void DecodedStream::SetVolume(double aVolume) {
|
||||
|
||||
void DecodedStream::SetPlaybackRate(double aPlaybackRate) {
|
||||
AssertOwnerThread();
|
||||
if (profiler_can_accept_markers()) {
|
||||
if (profiler_thread_is_being_profiled()) {
|
||||
nsPrintfCString markerString("PlaybackRate=%f", aPlaybackRate);
|
||||
PLAYBACK_PROFILER_MARKER(markerString);
|
||||
}
|
||||
@ -705,7 +705,7 @@ void DecodedStream::SetPlaybackRate(double aPlaybackRate) {
|
||||
|
||||
void DecodedStream::SetPreservesPitch(bool aPreservesPitch) {
|
||||
AssertOwnerThread();
|
||||
if (profiler_can_accept_markers()) {
|
||||
if (profiler_thread_is_being_profiled()) {
|
||||
nsPrintfCString markerString("PreservesPitch=%s",
|
||||
aPreservesPitch ? "true" : "false");
|
||||
PLAYBACK_PROFILER_MARKER(markerString);
|
||||
@ -1088,7 +1088,7 @@ void DecodedStream::NotifyOutput(int64_t aTime) {
|
||||
mLastOutputTime = time;
|
||||
auto currentTime = GetPosition();
|
||||
|
||||
if (profiler_can_accept_markers()) {
|
||||
if (profiler_thread_is_being_profiled()) {
|
||||
nsPrintfCString markerString("OutputTime=%" PRId64,
|
||||
currentTime.ToMicroseconds());
|
||||
PLAYBACK_PROFILER_MARKER(markerString);
|
||||
|
@ -2123,7 +2123,7 @@ void TrackBuffersManager::InsertFrames(TrackBuffer& aSamples,
|
||||
aSamples.Length(), aTrackData.mInfo->mMimeType.get(),
|
||||
aIntervals.GetStart().ToMicroseconds(),
|
||||
aIntervals.GetEnd().ToMicroseconds());
|
||||
if (profiler_can_accept_markers()) {
|
||||
if (profiler_thread_is_being_profiled()) {
|
||||
nsPrintfCString markerString(
|
||||
"Processing %zu %s frames(start:%" PRId64 " end:%" PRId64 ")",
|
||||
aSamples.Length(), aTrackData.mInfo->mMimeType.get(),
|
||||
@ -2348,7 +2348,7 @@ uint32_t TrackBuffersManager::RemoveFrames(const TimeIntervals& aIntervals,
|
||||
lastRemovedIndex - firstRemovedIndex.ref() + 1,
|
||||
removedIntervals.GetStart().ToSeconds(),
|
||||
removedIntervals.GetEnd().ToSeconds());
|
||||
if (profiler_can_accept_markers()) {
|
||||
if (profiler_thread_is_being_profiled()) {
|
||||
nsPrintfCString markerString(
|
||||
"Removing frames from:%u (frames:%u) ([%f, %f))",
|
||||
firstRemovedIndex.ref(), lastRemovedIndex - firstRemovedIndex.ref() + 1,
|
||||
|
@ -55,7 +55,7 @@ const char* PerformanceRecorder::FindMediaResolution(int32_t aHeight) {
|
||||
|
||||
/* static */
|
||||
bool PerformanceRecorder::IsMeasurementEnabled() {
|
||||
return profiler_can_accept_markers() ||
|
||||
return profiler_thread_is_being_profiled() ||
|
||||
PerformanceRecorder::sEnableMeasurementForTesting;
|
||||
}
|
||||
|
||||
|
@ -330,7 +330,7 @@ void Performance::Mark(const nsAString& aName, ErrorResult& aRv) {
|
||||
new PerformanceMark(GetParentObject(), aName, Now());
|
||||
InsertUserEntry(performanceMark);
|
||||
|
||||
if (profiler_can_accept_markers()) {
|
||||
if (profiler_thread_is_being_profiled()) {
|
||||
Maybe<uint64_t> innerWindowId;
|
||||
if (GetOwner()) {
|
||||
innerWindowId = Some(GetOwner()->WindowID());
|
||||
@ -408,7 +408,7 @@ void Performance::Measure(const nsAString& aName,
|
||||
new PerformanceMeasure(GetParentObject(), aName, startTime, endTime);
|
||||
InsertUserEntry(performanceMeasure);
|
||||
|
||||
if (profiler_can_accept_markers()) {
|
||||
if (profiler_thread_is_being_profiled()) {
|
||||
TimeStamp startTimeStamp =
|
||||
CreationTimeStamp() + TimeDuration::FromMilliseconds(startTime);
|
||||
TimeStamp endTimeStamp =
|
||||
|
@ -454,7 +454,7 @@ void WorkerGlobalScope::ImportScripts(JSContext* aCx,
|
||||
{
|
||||
AUTO_PROFILER_MARKER_TEXT(
|
||||
"ImportScripts", JS, MarkerStack::Capture(),
|
||||
profiler_can_accept_markers()
|
||||
profiler_thread_is_being_profiled()
|
||||
? StringJoin(","_ns, aScriptURLs,
|
||||
[](nsACString& dest, const auto& scriptUrl) {
|
||||
AppendUTF16toUTF8(scriptUrl, dest);
|
||||
|
@ -14,8 +14,7 @@
|
||||
#include <string> // for char_traits, string, basic_string
|
||||
#include <type_traits> // for remove_reference<>::type
|
||||
#include "CompositableHost.h" // for CompositableHost
|
||||
#include "GeckoProfiler.h" // for profiler_can_accept_markers, PROFILER_MARKER_TEXT
|
||||
#include "LayerUserData.h" // for LayerUserData
|
||||
#include "LayerUserData.h" // for LayerUserData
|
||||
#include "TreeTraversal.h" // for ForwardIterator, ForEachNode, DepthFirstSearch, TraversalFlag, TraversalFl...
|
||||
#include "UnitTransforms.h" // for ViewAs, PixelCastJustification, PixelCastJustification::RenderTargetIsPare...
|
||||
#include "apz/src/AsyncPanZoomController.h" // for AsyncPanZoomController
|
||||
@ -24,9 +23,9 @@
|
||||
#include "gfxMatrix.h" // for gfxMatrix
|
||||
#include "gfxUtils.h" // for gfxUtils, gfxUtils::sDumpPaintFile
|
||||
#include "mozilla/ArrayIterator.h" // for ArrayIterator
|
||||
#include "mozilla/BaseProfilerMarkersPrerequisites.h" // for MarkerTiming
|
||||
#include "mozilla/DebugOnly.h" // for DebugOnly
|
||||
#include "mozilla/DebugOnly.h" // for DebugOnly
|
||||
#include "mozilla/Logging.h" // for LogLevel, LogLevel::Debug, MOZ_LOG_TEST
|
||||
#include "mozilla/ProfilerMarkers.h" // for profiler_thread_is_being_profiled, PROFILER_MARKER_TEXT
|
||||
#include "mozilla/ScrollPositionUpdate.h" // for ScrollPositionUpdate
|
||||
#include "mozilla/Telemetry.h" // for AccumulateTimeDelta
|
||||
#include "mozilla/TelemetryHistogramEnums.h" // for KEYPRESS_PRESENT_LATENCY, SCROLL_PRESENT_LATENCY
|
||||
@ -99,7 +98,7 @@ void RecordCompositionPayloadsPresented(
|
||||
if (aPayloads.Length()) {
|
||||
TimeStamp presented = aCompositionEndTime;
|
||||
for (const CompositionPayload& payload : aPayloads) {
|
||||
if (profiler_can_accept_markers()) {
|
||||
if (profiler_thread_is_being_profiled()) {
|
||||
MOZ_RELEASE_ASSERT(payload.mType <= kHighestCompositionPayloadType);
|
||||
nsAutoCString name(
|
||||
kCompositionPayloadTypeNames[uint8_t(payload.mType)]);
|
||||
|
@ -44,7 +44,8 @@ void ImageComposite::UpdateBias(size_t aImageIndex, bool aFrameChanged) {
|
||||
? mImages[aImageIndex + 1].mTimeStamp
|
||||
: TimeStamp();
|
||||
|
||||
if (profiler_can_accept_markers() && compositedImageTime && nextImageTime) {
|
||||
if (profiler_thread_is_being_profiled() && compositedImageTime &&
|
||||
nextImageTime) {
|
||||
TimeDuration offsetCurrent = compositedImageTime - compositionTime;
|
||||
TimeDuration offsetNext = nextImageTime - compositionTime;
|
||||
nsPrintfCString str("current %.2lfms, next %.2lfms",
|
||||
@ -181,7 +182,7 @@ void ImageComposite::SetImages(nsTArray<TimedImage>&& aNewImages) {
|
||||
// will never be shown.
|
||||
CountSkippedFrames(&aNewImages[0]);
|
||||
|
||||
if (profiler_can_accept_markers()) {
|
||||
if (profiler_thread_is_being_profiled()) {
|
||||
int len = aNewImages.Length();
|
||||
const auto& first = aNewImages[0];
|
||||
const auto& last = aNewImages.LastElement();
|
||||
@ -208,7 +209,7 @@ bool ImageComposite::UpdateCompositedFrame(
|
||||
"Should only be called during a composition");
|
||||
|
||||
nsCString descr;
|
||||
if (profiler_can_accept_markers()) {
|
||||
if (profiler_thread_is_being_profiled()) {
|
||||
nsCString relativeTimeString;
|
||||
if (image.mTimeStamp) {
|
||||
relativeTimeString.AppendPrintf(
|
||||
@ -253,7 +254,7 @@ bool ImageComposite::UpdateCompositedFrame(
|
||||
|
||||
if (dropped > 0) {
|
||||
mDroppedFrames += dropped;
|
||||
if (profiler_can_accept_markers()) {
|
||||
if (profiler_thread_is_being_profiled()) {
|
||||
const char* frameOrFrames = dropped == 1 ? "frame" : "frames";
|
||||
nsPrintfCString text("%" PRId32 " %s dropped: %" PRId32 " -> %" PRId32
|
||||
" (producer %" PRId32 ")",
|
||||
@ -346,7 +347,7 @@ void ImageComposite::CountSkippedFrames(const TimedImage* aImage) {
|
||||
}
|
||||
|
||||
void ImageComposite::DetectTimeStampJitter(const TimedImage* aNewImage) {
|
||||
if (!profiler_can_accept_markers() || aNewImage->mTimeStamp.IsNull()) {
|
||||
if (!profiler_thread_is_being_profiled() || aNewImage->mTimeStamp.IsNull()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1918,7 +1918,7 @@ int32_t RecordContentFrameTime(
|
||||
double latencyNorm = latencyMs / aVsyncRate.ToMilliseconds();
|
||||
int32_t fracLatencyNorm = lround(latencyNorm * 100.0);
|
||||
|
||||
if (profiler_can_accept_markers()) {
|
||||
if (profiler_thread_is_being_profiled()) {
|
||||
struct ContentFrameMarker {
|
||||
static constexpr Span<const char> MarkerTypeName() {
|
||||
return MakeStringSpan("CONTENT_FRAME_TIME");
|
||||
|
@ -221,7 +221,7 @@ class SceneBuiltNotification : public wr::NotificationHandler {
|
||||
CompositorThread()->Dispatch(NS_NewRunnableFunction(
|
||||
"SceneBuiltNotificationRunnable", [parent, epoch, startTime]() {
|
||||
auto endTime = TimeStamp::Now();
|
||||
if (profiler_can_accept_markers()) {
|
||||
if (profiler_thread_is_being_profiled()) {
|
||||
PROFILER_MARKER("CONTENT_FULL_PAINT_TIME", GRAPHICS,
|
||||
MarkerTiming::Interval(startTime, endTime),
|
||||
ContentBuildMarker);
|
||||
|
@ -1754,7 +1754,7 @@ void gfxFontFamily::FindFontForChar(GlobalFontMatch* aMatchData) {
|
||||
}
|
||||
|
||||
nsCString charAndName;
|
||||
if (profiler_can_accept_markers()) {
|
||||
if (profiler_thread_is_being_profiled()) {
|
||||
charAndName = nsPrintfCString("\\u%x %s", aMatchData->mCh, mName.get());
|
||||
}
|
||||
AUTO_PROFILER_LABEL_DYNAMIC_NSCSTRING("gfxFontFamily::FindFontForChar",
|
||||
|
@ -451,7 +451,7 @@ class ImageResource : public Image {
|
||||
explicit AutoProfilerImagePaintMarker(ImageResource* self)
|
||||
: mStartTime(TimeStamp::Now()) {
|
||||
nsAutoCString spec;
|
||||
if (self->mURI && profiler_can_accept_markers()) {
|
||||
if (self->mURI && profiler_thread_is_being_profiled()) {
|
||||
static const size_t sMaxTruncatedLength = 1024;
|
||||
self->mURI->GetSpec(mSpec);
|
||||
if (mSpec.Length() >= sMaxTruncatedLength) {
|
||||
|
@ -114,7 +114,7 @@ already_AddRefed<Image> ImageFactory::CreateImage(
|
||||
}
|
||||
#endif
|
||||
|
||||
if (profiler_can_accept_markers()) {
|
||||
if (profiler_thread_is_being_profiled()) {
|
||||
static const size_t sMaxTruncatedLength = 1024;
|
||||
nsAutoCString spec;
|
||||
aURI->GetSpec(spec);
|
||||
|
@ -588,7 +588,7 @@ bool XPCJSContext::InterruptCallback(JSContext* cx) {
|
||||
// Now is a good time to turn on profiling if it's pending.
|
||||
PROFILER_JS_INTERRUPT_CALLBACK();
|
||||
|
||||
if (profiler_can_accept_markers()) {
|
||||
if (profiler_thread_is_being_profiled()) {
|
||||
nsDependentCString filename("unknown file");
|
||||
JS::AutoFilename scriptFilename;
|
||||
// Computing the line number can be very expensive (see bug 1330231 for
|
||||
|
@ -18,7 +18,7 @@ class MOZ_RAII AutoProfilerStyleMarker {
|
||||
public:
|
||||
explicit AutoProfilerStyleMarker(UniquePtr<ProfileChunkedBuffer> aCause,
|
||||
const Maybe<uint64_t>& aInnerWindowID)
|
||||
: mActive(profiler_can_accept_markers()),
|
||||
: mActive(profiler_thread_is_being_profiled()),
|
||||
mStartTime(TimeStamp::Now()),
|
||||
mCause(std::move(aCause)),
|
||||
mInnerWindowID(aInnerWindowID) {
|
||||
|
@ -1253,7 +1253,7 @@ bool nsRefreshDriver::RemoveRefreshObserver(nsARefreshObserver* aObserver,
|
||||
return false;
|
||||
}
|
||||
|
||||
if (profiler_can_accept_markers()) {
|
||||
if (profiler_thread_is_being_profiled()) {
|
||||
auto& data = array.ElementAt(index);
|
||||
nsPrintfCString str("%s [%s]", data.mDescription,
|
||||
kFlushTypeNames[aFlushType]);
|
||||
@ -1361,7 +1361,7 @@ void nsRefreshDriver::AddImageRequest(imgIRequest* aRequest) {
|
||||
|
||||
EnsureTimerStarted();
|
||||
|
||||
if (profiler_can_accept_markers()) {
|
||||
if (profiler_thread_is_being_profiled()) {
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
aRequest->GetURI(getter_AddRefs(uri));
|
||||
nsAutoCString uristr;
|
||||
@ -1386,7 +1386,7 @@ void nsRefreshDriver::RemoveImageRequest(imgIRequest* aRequest) {
|
||||
}
|
||||
}
|
||||
|
||||
if (removed && profiler_can_accept_markers()) {
|
||||
if (removed && profiler_thread_is_being_profiled()) {
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
aRequest->GetURI(getter_AddRefs(uri));
|
||||
nsAutoCString uristr;
|
||||
@ -1573,7 +1573,7 @@ void nsRefreshDriver::EnsureTimerStarted(EnsureTimerStartedFlags aFlags) {
|
||||
|
||||
if (!mHasStartedTimerAtLeastOnce) {
|
||||
mHasStartedTimerAtLeastOnce = true;
|
||||
if (profiler_can_accept_markers()) {
|
||||
if (profiler_thread_is_being_profiled()) {
|
||||
nsCString text = "initial timer start "_ns;
|
||||
if (mPresContext->Document()->GetDocumentURI()) {
|
||||
text.Append(
|
||||
@ -2233,7 +2233,7 @@ void nsRefreshDriver::Tick(VsyncId aId, TimeStamp aNowTime,
|
||||
AUTO_PROFILER_LABEL("nsRefreshDriver::Tick", LAYOUT);
|
||||
|
||||
nsAutoCString profilerStr;
|
||||
if (profiler_can_accept_markers()) {
|
||||
if (profiler_thread_is_being_profiled()) {
|
||||
profilerStr.AppendLiteral("Tick reasons:");
|
||||
AppendTickReasonsToString(tickReasons, profilerStr);
|
||||
}
|
||||
@ -2492,7 +2492,7 @@ void nsRefreshDriver::Tick(VsyncId aId, TimeStamp aNowTime,
|
||||
if (mViewManagerFlushIsPending) {
|
||||
AutoRecordPhase paintRecord(&phasePaint);
|
||||
nsCString transactionId;
|
||||
if (profiler_can_accept_markers()) {
|
||||
if (profiler_thread_is_being_profiled()) {
|
||||
transactionId.AppendLiteral("Transaction ID: ");
|
||||
transactionId.AppendInt((uint64_t)mNextTransactionId);
|
||||
}
|
||||
|
@ -315,17 +315,6 @@ MFBT_API bool IsThreadBeingProfiled();
|
||||
return baseprofiler::detail::RacyFeatures::IsActiveAndUnpaused();
|
||||
}
|
||||
|
||||
// Same as profiler_is_active(), but with the same extra checks that determine
|
||||
// if the profiler would currently store markers. So this should be used before
|
||||
// doing some potentially-expensive work that's used in a marker. E.g.:
|
||||
//
|
||||
// if (profiler_can_accept_markers()) {
|
||||
// BASE_PROFILER_MARKER(name, OTHER, SomeMarkerType, expensivePayload);
|
||||
// }
|
||||
[[nodiscard]] inline bool profiler_can_accept_markers() {
|
||||
return baseprofiler::detail::RacyFeatures::IsActiveAndUnpaused();
|
||||
}
|
||||
|
||||
// Is the profiler active and unpaused, and is the current thread being
|
||||
// profiled? (Same caveats and recommented usage as profiler_is_active().)
|
||||
[[nodiscard]] inline bool profiler_thread_is_being_profiled() {
|
||||
|
@ -686,7 +686,7 @@ int32_t nsSocketTransportService::Poll(TimeDuration* pollDuration,
|
||||
if (pollTimeout != PR_INTERVAL_NO_WAIT) {
|
||||
profiler_thread_wake();
|
||||
}
|
||||
if (profiler_can_accept_markers()) {
|
||||
if (profiler_thread_is_being_profiled()) {
|
||||
PROFILER_MARKER_TEXT(
|
||||
"SocketTransportService::Poll", NETWORK,
|
||||
MarkerTiming::IntervalUntilNowFrom(startTime),
|
||||
|
@ -867,7 +867,7 @@ void HttpChannelChild::OnStopRequest(
|
||||
mCacheReadStart = aTiming.cacheReadStart();
|
||||
mCacheReadEnd = aTiming.cacheReadEnd();
|
||||
|
||||
if (profiler_can_accept_markers()) {
|
||||
if (profiler_thread_is_being_profiled()) {
|
||||
nsAutoCString requestMethod;
|
||||
GetRequestMethod(requestMethod);
|
||||
nsAutoCString contentType;
|
||||
@ -1357,7 +1357,7 @@ void HttpChannelChild::Redirect1Begin(
|
||||
|
||||
ResourceTimingStructArgsToTimingsStruct(timing, mTransactionTimings);
|
||||
|
||||
if (profiler_can_accept_markers()) {
|
||||
if (profiler_thread_is_being_profiled()) {
|
||||
nsAutoCString requestMethod;
|
||||
GetRequestMethod(requestMethod);
|
||||
nsAutoCString contentType;
|
||||
@ -1664,7 +1664,7 @@ HttpChannelChild::CompleteRedirectSetup(nsIStreamListener* aListener) {
|
||||
*/
|
||||
|
||||
mLastStatusReported = TimeStamp::Now();
|
||||
if (profiler_can_accept_markers()) {
|
||||
if (profiler_thread_is_being_profiled()) {
|
||||
nsAutoCString requestMethod;
|
||||
GetRequestMethod(requestMethod);
|
||||
|
||||
@ -1990,7 +1990,7 @@ nsresult HttpChannelChild::AsyncOpenInternal(nsIStreamListener* aListener) {
|
||||
gHttpHandler->OnOpeningRequest(this);
|
||||
|
||||
mLastStatusReported = TimeStamp::Now();
|
||||
if (profiler_can_accept_markers()) {
|
||||
if (profiler_thread_is_being_profiled()) {
|
||||
nsAutoCString requestMethod;
|
||||
GetRequestMethod(requestMethod);
|
||||
|
||||
|
@ -92,7 +92,7 @@ void InterceptedHttpChannel::AsyncOpenInternal() {
|
||||
// We save this timestamp from outside of the if block in case we enable the
|
||||
// profiler after AsyncOpen().
|
||||
mLastStatusReported = TimeStamp::Now();
|
||||
if (profiler_can_accept_markers()) {
|
||||
if (profiler_thread_is_being_profiled()) {
|
||||
nsAutoCString requestMethod;
|
||||
GetRequestMethod(requestMethod);
|
||||
|
||||
@ -505,7 +505,7 @@ InterceptedHttpChannel::Cancel(nsresult aStatus) {
|
||||
|
||||
mCanceled = true;
|
||||
|
||||
if (mLastStatusReported && profiler_can_accept_markers()) {
|
||||
if (mLastStatusReported && profiler_thread_is_being_profiled()) {
|
||||
// These do allocations/frees/etc; avoid if not active
|
||||
// mLastStatusReported can be null if Cancel is called before we added the
|
||||
// start marker.
|
||||
@ -675,7 +675,7 @@ InterceptedHttpChannel::ResetInterception(bool aBypass) {
|
||||
mLoadFlags);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (profiler_can_accept_markers()) {
|
||||
if (profiler_thread_is_being_profiled()) {
|
||||
nsAutoCString requestMethod;
|
||||
GetRequestMethod(requestMethod);
|
||||
|
||||
@ -1043,7 +1043,7 @@ InterceptedHttpChannel::OnStopRequest(nsIRequest* aRequest, nsresult aStatus) {
|
||||
// Register entry to the PerformanceStorage resource timing
|
||||
MaybeReportTimingData();
|
||||
|
||||
if (profiler_can_accept_markers()) {
|
||||
if (profiler_thread_is_being_profiled()) {
|
||||
// These do allocations/frees/etc; avoid if not active
|
||||
nsAutoCString requestMethod;
|
||||
GetRequestMethod(requestMethod);
|
||||
|
@ -23,7 +23,7 @@ void profiler_add_network_marker(
|
||||
UniquePtr<ProfileChunkedBuffer> aSource,
|
||||
const Maybe<nsDependentCString>& aContentType, nsIURI* aRedirectURI,
|
||||
uint32_t aRedirectFlags, uint64_t aRedirectChannelId) {
|
||||
if (!profiler_can_accept_markers()) {
|
||||
if (!profiler_thread_is_being_profiled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -5014,7 +5014,7 @@ nsresult nsHttpChannel::SetupReplacementChannel(nsIURI* newURI,
|
||||
"[this=%p newChannel=%p preserveMethod=%d]",
|
||||
this, newChannel, preserveMethod));
|
||||
|
||||
if (!mEndMarkerAdded && profiler_can_accept_markers()) {
|
||||
if (!mEndMarkerAdded && profiler_thread_is_being_profiled()) {
|
||||
mEndMarkerAdded = true;
|
||||
|
||||
nsAutoCString requestMethod;
|
||||
@ -5542,7 +5542,7 @@ nsresult nsHttpChannel::CancelInternal(nsresult status) {
|
||||
mStatus = NS_FAILED(status) ? status : NS_ERROR_ABORT;
|
||||
|
||||
if (mLastStatusReported && !mEndMarkerAdded &&
|
||||
profiler_can_accept_markers()) {
|
||||
profiler_thread_is_being_profiled()) {
|
||||
// These do allocations/frees/etc; avoid if not active
|
||||
// mLastStatusReported can be null if Cancel is called before we added the
|
||||
// start marker.
|
||||
@ -5862,7 +5862,7 @@ void nsHttpChannel::AsyncOpenFinal(TimeStamp aTimeStamp) {
|
||||
// We save this timestamp from outside of the if block in case we enable the
|
||||
// profiler after AsyncOpen().
|
||||
mLastStatusReported = TimeStamp::Now();
|
||||
if (profiler_can_accept_markers()) {
|
||||
if (profiler_thread_is_being_profiled()) {
|
||||
nsAutoCString requestMethod;
|
||||
GetRequestMethod(requestMethod);
|
||||
|
||||
@ -7487,7 +7487,7 @@ nsresult nsHttpChannel::ContinueOnStopRequest(nsresult aStatus, bool aIsFromNet,
|
||||
|
||||
MaybeFlushConsoleReports();
|
||||
|
||||
if (!mEndMarkerAdded && profiler_can_accept_markers()) {
|
||||
if (!mEndMarkerAdded && profiler_thread_is_being_profiled()) {
|
||||
// These do allocations/frees/etc; avoid if not active
|
||||
mEndMarkerAdded = true;
|
||||
|
||||
|
@ -383,7 +383,7 @@ int32_t Timers::Finish(JSContext* aCx, const nsAString& aHistogram,
|
||||
} else {
|
||||
rv = TelemetryHistogram::Accumulate(histogram.get(), delta);
|
||||
}
|
||||
if (profiler_can_accept_markers()) {
|
||||
if (profiler_thread_is_being_profiled()) {
|
||||
nsCString markerText = histogram;
|
||||
if (!aKey.IsVoid()) {
|
||||
markerText.AppendLiteral(":");
|
||||
@ -531,7 +531,7 @@ bool Timers::FinishUserInteraction(
|
||||
return false;
|
||||
}
|
||||
|
||||
if (profiler_can_accept_markers()) {
|
||||
if (profiler_thread_is_being_profiled()) {
|
||||
nsAutoCString markerText(timer->GetBHRAnnotationValue());
|
||||
if (aAdditionalText.WasPassed()) {
|
||||
markerText.Append(",");
|
||||
|
@ -49,7 +49,7 @@ static void profiler_add_js_marker(const char* aMarkerName,
|
||||
}
|
||||
|
||||
static void profiler_add_js_allocation_marker(JS::RecordAllocationInfo&& info) {
|
||||
if (!profiler_can_accept_markers()) {
|
||||
if (!profiler_thread_is_being_profiled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -76,7 +76,7 @@ void ProfilerIOInterposeObserver::Observe(Observation& aObservation) {
|
||||
uint32_t features = *maybeFeatures;
|
||||
|
||||
if (!profiler_thread_is_being_profiled(profiler_main_thread_id()) &&
|
||||
!profiler_can_accept_markers()) {
|
||||
!profiler_thread_is_being_profiled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -164,7 +164,6 @@ using ProfilingStateChangeCallback = std::function<void(ProfilingState)>;
|
||||
|
||||
[[nodiscard]] inline bool profiler_is_active() { return false; }
|
||||
[[nodiscard]] inline bool profiler_is_active_and_unpaused() { return false; }
|
||||
[[nodiscard]] inline bool profiler_can_accept_markers() { return false; }
|
||||
[[nodiscard]] inline bool profiler_feature_active(uint32_t aFeature) {
|
||||
return false;
|
||||
}
|
||||
@ -307,18 +306,6 @@ class RacyFeatures {
|
||||
return mozilla::profiler::detail::RacyFeatures::IsActiveAndUnpaused();
|
||||
}
|
||||
|
||||
// Same as profiler_is_active(), but with the same extra checks that determine
|
||||
// if the profiler would currently store markers. So this should be used before
|
||||
// doing some potentially-expensive work that's used in a marker. E.g.:
|
||||
//
|
||||
// if (profiler_can_accept_markers()) {
|
||||
// ExpensiveMarkerPayload expensivePayload = CreateExpensivePayload();
|
||||
// BASE_PROFILER_ADD_MARKER_WITH_PAYLOAD(name, OTHER, expensivePayload);
|
||||
// }
|
||||
[[nodiscard]] inline bool profiler_can_accept_markers() {
|
||||
return mozilla::profiler::detail::RacyFeatures::IsActiveAndUnpaused();
|
||||
}
|
||||
|
||||
// Is the profiler active and paused? Returns false if the profiler is inactive.
|
||||
[[nodiscard]] bool profiler_is_paused();
|
||||
|
||||
|
@ -1762,7 +1762,6 @@ TEST(GeckoProfiler, Pause)
|
||||
const char* filters[] = {"GeckoMain", "Profiled GeckoProfiler.Pause"};
|
||||
|
||||
ASSERT_TRUE(!profiler_is_paused());
|
||||
ASSERT_TRUE(!profiler_can_accept_markers());
|
||||
ASSERT_TRUE(!profiler_thread_is_being_profiled());
|
||||
ASSERT_TRUE(!profiler_thread_is_being_profiled(ProfilerThreadId{}));
|
||||
ASSERT_TRUE(!profiler_thread_is_being_profiled(profiler_current_thread_id()));
|
||||
@ -1803,7 +1802,6 @@ TEST(GeckoProfiler, Pause)
|
||||
filters, MOZ_ARRAY_LENGTH(filters), 0);
|
||||
|
||||
ASSERT_TRUE(!profiler_is_paused());
|
||||
ASSERT_TRUE(profiler_can_accept_markers());
|
||||
ASSERT_TRUE(profiler_thread_is_being_profiled());
|
||||
ASSERT_TRUE(profiler_thread_is_being_profiled(ProfilerThreadId{}));
|
||||
ASSERT_TRUE(profiler_thread_is_being_profiled(profiler_current_thread_id()));
|
||||
@ -1851,7 +1849,6 @@ TEST(GeckoProfiler, Pause)
|
||||
profiler_pause();
|
||||
|
||||
ASSERT_TRUE(profiler_is_paused());
|
||||
ASSERT_TRUE(!profiler_can_accept_markers());
|
||||
ASSERT_TRUE(!profiler_thread_is_being_profiled());
|
||||
ASSERT_TRUE(!profiler_thread_is_being_profiled(ProfilerThreadId{}));
|
||||
ASSERT_TRUE(!profiler_thread_is_being_profiled(profiler_current_thread_id()));
|
||||
@ -1905,7 +1902,6 @@ TEST(GeckoProfiler, Pause)
|
||||
profiler_resume();
|
||||
|
||||
ASSERT_TRUE(!profiler_is_paused());
|
||||
ASSERT_TRUE(profiler_can_accept_markers());
|
||||
ASSERT_TRUE(profiler_thread_is_being_profiled());
|
||||
ASSERT_TRUE(profiler_thread_is_being_profiled(ProfilerThreadId{}));
|
||||
ASSERT_TRUE(profiler_thread_is_being_profiled(profiler_current_thread_id()));
|
||||
@ -1941,7 +1937,6 @@ TEST(GeckoProfiler, Pause)
|
||||
profiler_stop();
|
||||
|
||||
ASSERT_TRUE(!profiler_is_paused());
|
||||
ASSERT_TRUE(!profiler_can_accept_markers());
|
||||
ASSERT_TRUE(!profiler_thread_is_being_profiled());
|
||||
ASSERT_TRUE(!profiler_thread_is_being_profiled(ProfilerThreadId{}));
|
||||
ASSERT_TRUE(!profiler_thread_is_being_profiled(profiler_current_thread_id()));
|
||||
|
@ -599,7 +599,7 @@ class LogModuleManager {
|
||||
charsWritten = strlen(buffToWrite);
|
||||
}
|
||||
|
||||
if (mAddProfilerMarker && profiler_can_accept_markers()) {
|
||||
if (mAddProfilerMarker && profiler_thread_is_being_profiled()) {
|
||||
struct LogMarker {
|
||||
static constexpr Span<const char> MarkerTypeName() {
|
||||
return MakeStringSpan("Log");
|
||||
|
Loading…
Reference in New Issue
Block a user