mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 07:42:04 +00:00
Bug 1663554 - Convert PROFILER_ADD_TEXT_MARKER and friends to PROFILER_MARKER_TEXT - r=gregtatum
Mostly mechanical changes, with some work needed to convert the different payloads (with optional timestamps, inner window id, and/or backtrace) to the equivalent MarkerOptions. Differential Revision: https://phabricator.services.mozilla.com/D89587
This commit is contained in:
parent
1a9a2dbf1e
commit
b0bf2c2172
@ -7769,10 +7769,7 @@ nsresult nsDocShell::CreateContentViewer(const nsACString& aContentType,
|
||||
BasePrincipal::Cast(thisPrincipal)->GetURI(getter_AddRefs(prinURI));
|
||||
nsPrintfCString marker("Iframe loaded in background: %s",
|
||||
prinURI->GetSpecOrDefault().get());
|
||||
TimeStamp now = TimeStamp::Now();
|
||||
profiler_add_text_marker("Background Iframe", marker,
|
||||
JS::ProfilingCategoryPair::DOM, now, now,
|
||||
Nothing());
|
||||
PROFILER_MARKER_TEXT("Background Iframe", DOM, marker);
|
||||
#endif
|
||||
SetBackgroundLoadIframe();
|
||||
}
|
||||
|
@ -200,15 +200,8 @@ void ChromeUtils::AddProfilerMarker(
|
||||
const Optional<DOMHighResTimeStamp>& aStartTime,
|
||||
const Optional<nsACString>& aText) {
|
||||
#ifdef MOZ_GECKO_PROFILER
|
||||
const nsCString& name = PromiseFlatCString(aName);
|
||||
MarkerOptions options{::geckoprofiler::category::JS};
|
||||
|
||||
if (!aText.WasPassed() && !aStartTime.WasPassed()) {
|
||||
profiler_add_js_marker(name.get());
|
||||
return;
|
||||
}
|
||||
|
||||
TimeStamp now = mozilla::TimeStamp::NowUnfuzzed();
|
||||
TimeStamp startTime = now;
|
||||
if (aStartTime.WasPassed()) {
|
||||
RefPtr<Performance> performance;
|
||||
|
||||
@ -227,22 +220,23 @@ void ChromeUtils::AddProfilerMarker(
|
||||
}
|
||||
|
||||
if (performance) {
|
||||
startTime = performance->CreationTimeStamp() +
|
||||
TimeDuration::FromMilliseconds(aStartTime.Value());
|
||||
options.Set(MarkerTiming::IntervalUntilNowFrom(
|
||||
performance->CreationTimeStamp() +
|
||||
TimeDuration::FromMilliseconds(aStartTime.Value())));
|
||||
} else {
|
||||
startTime = TimeStamp::ProcessCreation() +
|
||||
TimeDuration::FromMilliseconds(aStartTime.Value());
|
||||
options.Set(MarkerTiming::IntervalUntilNowFrom(
|
||||
TimeStamp::ProcessCreation() +
|
||||
TimeDuration::FromMilliseconds(aStartTime.Value())));
|
||||
}
|
||||
}
|
||||
|
||||
if (aText.WasPassed()) {
|
||||
profiler_add_text_marker(name.get(), aText.Value(),
|
||||
JS::ProfilingCategoryPair::JS, startTime, now);
|
||||
PROFILER_MARKER_TEXT(aName, MarkerOptions(std::move(options)),
|
||||
aText.Value());
|
||||
} else {
|
||||
profiler_add_marker(name.get(), JS::ProfilingCategoryPair::JS,
|
||||
TimingMarkerPayload(startTime, now));
|
||||
PROFILER_MARKER_UNTYPED(aName, MarkerOptions(std::move(options)));
|
||||
}
|
||||
#endif
|
||||
#endif // MOZ_GECKO_PROFILER
|
||||
}
|
||||
|
||||
/* static */
|
||||
|
@ -249,9 +249,10 @@ void PreallocatedProcessManagerImpl::RemoveBlocker(ContentParent* aParent) {
|
||||
MOZ_LOG(ContentParent::GetLog(), LogLevel::Debug,
|
||||
("Blocked preallocation for %fms",
|
||||
(TimeStamp::Now() - mBlockingStartTime).ToMilliseconds()));
|
||||
PROFILER_ADD_TEXT_MARKER("Process", "Blocked preallocation"_ns,
|
||||
JS::ProfilingCategoryPair::DOM, mBlockingStartTime,
|
||||
TimeStamp::Now());
|
||||
PROFILER_MARKER_TEXT(
|
||||
"Process",
|
||||
DOM.WithOptions(MarkerTiming::IntervalUntilNowFrom(mBlockingStartTime)),
|
||||
"Blocked preallocation");
|
||||
if (IsEmpty()) {
|
||||
AllocateAfterDelay();
|
||||
}
|
||||
|
@ -2351,9 +2351,10 @@ void RecordCompositionPayloadsPresented(
|
||||
nsPrintfCString text(
|
||||
"Latency: %dms",
|
||||
int32_t((presented - payload.mTimeStamp).ToMilliseconds()));
|
||||
profiler_add_text_marker(name.get(), text,
|
||||
JS::ProfilingCategoryPair::GRAPHICS,
|
||||
payload.mTimeStamp, presented);
|
||||
PROFILER_MARKER_TEXT(name,
|
||||
GRAPHICS.WithOptions(MarkerTiming::Interval(
|
||||
payload.mTimeStamp, presented)),
|
||||
text);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -80,15 +80,14 @@ void SurfacePoolCA::LockedPool::MutateEntryStorage(const char* aMutationType,
|
||||
|
||||
#ifdef MOZ_GECKO_PROFILER
|
||||
if (profiler_thread_is_being_profiled()) {
|
||||
profiler_add_text_marker(
|
||||
"SurfacePool",
|
||||
nsPrintfCString("%d -> %d in use | %d -> %d waiting for | %d -> %d available | %s %dx%d | "
|
||||
"%dMB total memory",
|
||||
PROFILER_MARKER_TEXT(
|
||||
"SurfacePool", GRAPHICS.WithOptions(MarkerTiming::IntervalUntilNowFrom(before)),
|
||||
nsPrintfCString("%d -> %d in use | %d -> %d waiting for | %d -> %d "
|
||||
"available | %s %dx%d | %dMB total memory",
|
||||
int(inUseCountBefore), int(mInUseEntries.size()), int(pendingCountBefore),
|
||||
int(mPendingEntries.Length()), int(availableCountBefore),
|
||||
int(mAvailableEntries.Length()), aMutationType, aSize.width, aSize.height,
|
||||
int(EstimateTotalMemory() / 1000 / 1000)),
|
||||
JS::ProfilingCategoryPair::GRAPHICS, before, TimeStamp::NowUnfuzzed());
|
||||
int(EstimateTotalMemory() / 1000 / 1000)));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -257,14 +257,12 @@ bool ImageComposite::UpdateCompositedFrame(
|
||||
mDroppedFrames += dropped;
|
||||
#if MOZ_GECKO_PROFILER
|
||||
if (profiler_can_accept_markers()) {
|
||||
TimeStamp now = TimeStamp::Now();
|
||||
const char* frameOrFrames = dropped == 1 ? "frame" : "frames";
|
||||
nsPrintfCString text("%" PRId32 " %s dropped: %" PRId32 " -> %" PRId32
|
||||
" (producer %" PRId32 ")",
|
||||
dropped, frameOrFrames, mLastFrameID, image.mFrameID,
|
||||
mLastProducerID);
|
||||
profiler_add_text_marker("Video frames dropped", text,
|
||||
JS::ProfilingCategoryPair::GRAPHICS, now, now);
|
||||
PROFILER_MARKER_TEXT("Video frames dropped", GRAPHICS, text);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -374,10 +372,8 @@ void ImageComposite::DetectTimeStampJitter(const TimedImage* aNewImage) {
|
||||
}
|
||||
}
|
||||
if (jitter) {
|
||||
TimeStamp now = TimeStamp::Now();
|
||||
nsPrintfCString text("%.2lfms", jitter->ToMilliseconds());
|
||||
profiler_add_text_marker("VideoFrameTimeStampJitter", text,
|
||||
JS::ProfilingCategoryPair::GRAPHICS, now, now);
|
||||
PROFILER_MARKER_TEXT("VideoFrameTimeStampJitter", GRAPHICS, text);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -87,8 +87,10 @@ void gecko_profiler_add_text_marker(const char* name, const char* text_bytes,
|
||||
if (profiler_thread_is_being_profiled()) {
|
||||
auto now = mozilla::TimeStamp::NowUnfuzzed();
|
||||
auto start = now - mozilla::TimeDuration::FromMicroseconds(microseconds);
|
||||
profiler_add_text_marker(name, nsDependentCSubstring(text_bytes, text_len),
|
||||
JS::ProfilingCategoryPair::GRAPHICS, start, now);
|
||||
PROFILER_MARKER_TEXT(
|
||||
mozilla::ProfilerString8View::WrapNullTerminatedString(name),
|
||||
GRAPHICS.WithOptions(mozilla::MarkerTiming::Interval(start, now)),
|
||||
mozilla::ProfilerString8View(text_bytes, text_len));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -1990,12 +1992,8 @@ void WebRenderBridgeParent::CompositeToTarget(VsyncId aId,
|
||||
if (mPaused || !mReceivedDisplayList) {
|
||||
ResetPreviousSampleTime();
|
||||
mCompositionOpportunityId = mCompositionOpportunityId.Next();
|
||||
#ifdef MOZ_GECKO_PRFOILER
|
||||
TimeStamp now = TimeStamp::Now();
|
||||
PROFILER_ADD_TEXT_MARKER("SkippedComposite",
|
||||
mPaused ? "Paused"_ns : "No display list"_ns,
|
||||
JS::ProfilingCategoryPair::GRAPHICS, now, now);
|
||||
#endif // MOZ_GECKO_PRFOILER
|
||||
PROFILER_MARKER_TEXT("SkippedComposite", GRAPHICS,
|
||||
mPaused ? "Paused"_ns : "No display list"_ns);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2014,11 +2012,8 @@ void WebRenderBridgeParent::CompositeToTarget(VsyncId aId,
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef MOZ_GECKO_PROFILER
|
||||
TimeStamp now = TimeStamp::Now();
|
||||
PROFILER_ADD_TEXT_MARKER("SkippedComposite", "Too many pending frames"_ns,
|
||||
JS::ProfilingCategoryPair::GRAPHICS, now, now);
|
||||
#endif // MOZ_GECKO_PROFILER
|
||||
PROFILER_MARKER_TEXT("SkippedComposite", GRAPHICS,
|
||||
"Too many pending frames");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2043,10 +2038,10 @@ void WebRenderBridgeParent::MaybeGenerateFrame(VsyncId aId,
|
||||
if (CompositorBridgeParent* cbp = GetRootCompositorBridgeParent()) {
|
||||
// Skip WR render during paused state.
|
||||
if (cbp->IsPaused()) {
|
||||
TimeStamp now = TimeStamp::Now();
|
||||
PROFILER_ADD_TEXT_MARKER("SkippedComposite",
|
||||
"CompositorBridgeParent is paused"_ns,
|
||||
JS::ProfilingCategoryPair::GRAPHICS, now, now);
|
||||
TimeStamp now = TimeStamp::NowUnfuzzed();
|
||||
PROFILER_MARKER_TEXT("SkippedComposite",
|
||||
GRAPHICS.WithOptions(MarkerTiming::InstantAt(now)),
|
||||
"CompositorBridgeParent is paused");
|
||||
cbp->NotifyPipelineRendered(mPipelineId, mWrEpoch, VsyncId(), now, now,
|
||||
now);
|
||||
return;
|
||||
@ -2080,9 +2075,9 @@ void WebRenderBridgeParent::MaybeGenerateFrame(VsyncId aId,
|
||||
|
||||
if (!generateFrame) {
|
||||
// Could skip generating frame now.
|
||||
PROFILER_ADD_TEXT_MARKER("SkippedComposite",
|
||||
"No reason to generate frame"_ns,
|
||||
JS::ProfilingCategoryPair::GRAPHICS, start, start);
|
||||
PROFILER_MARKER_TEXT("SkippedComposite",
|
||||
GRAPHICS.WithOptions(MarkerTiming::InstantAt(start)),
|
||||
"No reason to generate frame");
|
||||
ResetPreviousSampleTime();
|
||||
return;
|
||||
}
|
||||
|
@ -180,8 +180,10 @@ void RenderCompositorNative::CompositorEndFrame() {
|
||||
for (const auto& it : mSurfaces) {
|
||||
nativeLayerCount += int(it.second.mNativeLayers.size());
|
||||
}
|
||||
profiler_add_text_marker(
|
||||
PROFILER_MARKER_TEXT(
|
||||
"WR OS Compositor frame",
|
||||
GRAPHICS.WithOptions(
|
||||
MarkerTiming::IntervalUntilNowFrom(mBeginFrameTimeStamp)),
|
||||
nsPrintfCString("%d%% painting, %d%% overdraw, %d used "
|
||||
"layers (%d%% memory) + %d unused layers (%d%% memory)",
|
||||
int(mDrawnPixelCount * 100 / windowPixelCount),
|
||||
@ -190,9 +192,7 @@ void RenderCompositorNative::CompositorEndFrame() {
|
||||
int(mAddedTilePixelCount * 100 / windowPixelCount),
|
||||
int(nativeLayerCount - mAddedLayers.Length()),
|
||||
int((mTotalTilePixelCount - mAddedTilePixelCount) *
|
||||
100 / windowPixelCount)),
|
||||
JS::ProfilingCategoryPair::GRAPHICS, mBeginFrameTimeStamp,
|
||||
TimeStamp::NowUnfuzzed());
|
||||
100 / windowPixelCount)));
|
||||
}
|
||||
#endif
|
||||
mDrawnPixelCount = 0;
|
||||
|
@ -117,7 +117,7 @@ struct Text {
|
||||
|
||||
# define BASE_PROFILER_MARKER_TEXT(markerName, options, text) \
|
||||
do { \
|
||||
AUTO_PROFILER_STATS(base_add_marker_v2_with_Text); \
|
||||
AUTO_PROFILER_STATS(BASE_PROFILER_MARKER_TEXT); \
|
||||
::mozilla::baseprofiler::AddMarker< \
|
||||
::mozilla::baseprofiler::markers::Text>( \
|
||||
markerName, ::mozilla::baseprofiler::category::options, text); \
|
||||
|
@ -265,9 +265,10 @@ void ChannelWrapper::Resume(const nsCString& aText, ErrorResult& aRv) {
|
||||
if (nsCOMPtr<nsIChannel> chan = MaybeChannel()) {
|
||||
rv = chan->Resume();
|
||||
|
||||
PROFILER_ADD_TEXT_MARKER("Extension Suspend", aText,
|
||||
JS::ProfilingCategoryPair::NETWORK, mSuspendTime,
|
||||
mozilla::TimeStamp::NowUnfuzzed());
|
||||
PROFILER_MARKER_TEXT(
|
||||
"Extension Suspend",
|
||||
NETWORK.WithOptions(MarkerTiming::IntervalUntilNowFrom(mSuspendTime)),
|
||||
aText);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
aRv.Throw(rv);
|
||||
|
@ -341,9 +341,10 @@ int32_t Timers::Finish(JSContext* aCx, const nsAString& aHistogram,
|
||||
markerText.AppendLiteral(":");
|
||||
markerText.Append(NS_ConvertUTF16toUTF8(aKey));
|
||||
}
|
||||
profiler_add_text_marker("TelemetryStopwatch", markerText,
|
||||
JS::ProfilingCategoryPair::OTHER, timer->StartTime(),
|
||||
TimeStamp::Now());
|
||||
PROFILER_MARKER_TEXT(
|
||||
"TelemetryStopwatch",
|
||||
OTHER.WithOptions(MarkerTiming::IntervalUntilNowFrom(timer->StartTime())),
|
||||
markerText);
|
||||
#endif
|
||||
if (NS_FAILED(rv) && rv != NS_ERROR_NOT_AVAILABLE && !mSuppressErrors) {
|
||||
LogError(aCx, nsPrintfCString(
|
||||
|
@ -96,7 +96,7 @@ using Text = ::mozilla::baseprofiler::markers::Text;
|
||||
|
||||
# define PROFILER_MARKER_TEXT(markerName, options, text) \
|
||||
do { \
|
||||
AUTO_PROFILER_STATS(add_marker_v2_with_Text); \
|
||||
AUTO_PROFILER_STATS(PROFILER_MARKER_TEXT); \
|
||||
::profiler_add_marker<::geckoprofiler::markers::Text>( \
|
||||
markerName, ::geckoprofiler::category::options, text); \
|
||||
} while (false)
|
||||
|
Loading…
Reference in New Issue
Block a user