tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 493110acba5e07e58ea686b01e9a7dbdca0c1be7
parent 53772e4cc4022d2cbeb4ba5427c8117010227805
Author: Sandor Molnar <smolnar@mozilla.com>
Date:   Sat,  1 Nov 2025 01:52:36 +0200

Revert "Bug 1996304 - Rename AUTO_PROFILER_TRACING_MARKER to AUTO_PROFILER_MARKER. r=mstange,profiler-reviewers,layout-reviewers,emilio" for causing cppunit perma failures

This reverts commit eba2838e1be12a09749961082df41a92433a3bca.

Diffstat:
Mdom/vr/VRDisplay.cpp | 2+-
Mgfx/layers/ipc/ImageBridgeParent.cpp | 2+-
Mgfx/layers/wr/WebRenderBridgeParent.cpp | 9+++++----
Mgfx/layers/wr/WebRenderLayerManager.cpp | 4++--
Mgfx/vr/VRManager.cpp | 4++--
Mgfx/vr/ipc/VRManagerChild.cpp | 2+-
Mgfx/webrender_bindings/Moz2DImageRenderer.cpp | 2+-
Mgfx/webrender_bindings/RenderMacIOSurfaceTextureHost.cpp | 3++-
Mgfx/webrender_bindings/RenderThread.cpp | 2+-
Mgfx/webrender_bindings/src/moz2d_renderer.rs | 7++++---
Mipc/ipdl/ipdl/lower.py | 3++-
Mlayout/base/PresShell.cpp | 7++++---
Mlayout/base/nsLayoutUtils.cpp | 4++--
Mlayout/base/nsRefreshDriver.cpp | 9+++++----
Mlayout/generic/ScrollContainerFrame.cpp | 4++--
Mmozglue/baseprofiler/public/BaseProfilerMarkers.h | 11+++++++++--
Mmozglue/tests/TestBaseProfiler.cpp | 8++++----
Msecurity/manager/ssl/nsNSSComponent.cpp | 2+-
Mtools/profiler/public/ETWTools.h | 3+--
Mtools/profiler/public/ProfilerMarkers.h | 42+++++++++++++++++++++++++++---------------
Mtools/profiler/rust-api/src/marker/mod.rs | 65++++++++++++++++++++---------------------------------------------
Mtools/profiler/tests/gtest/GeckoProfiler.cpp | 2+-
Mwidget/cocoa/nsCocoaWindow.mm | 3++-
Mxpcom/base/CycleCollectedJSContext.cpp | 2+-
Mxpcom/threads/TimerThread.cpp | 2+-
25 files changed, 102 insertions(+), 102 deletions(-)

diff --git a/dom/vr/VRDisplay.cpp b/dom/vr/VRDisplay.cpp @@ -564,7 +564,7 @@ void VRDisplay::GetLayers(nsTArray<VRLayer>& result) { } void VRDisplay::SubmitFrame() { - AUTO_PROFILER_MARKER("SubmitFrameAtVRDisplay", OTHER); + AUTO_PROFILER_TRACING_MARKER("VR", "SubmitFrameAtVRDisplay", OTHER); if (mClient && !mClient->IsPresentationGenerationCurrent()) { mPresentation = nullptr; diff --git a/gfx/layers/ipc/ImageBridgeParent.cpp b/gfx/layers/ipc/ImageBridgeParent.cpp @@ -194,7 +194,7 @@ class MOZ_STACK_CLASS AutoImageBridgeParentAsyncMessageSender final { mozilla::ipc::IPCResult ImageBridgeParent::RecvUpdate( EditArray&& aEdits, OpDestroyArray&& aToDestroy, const uint64_t& aFwdTransactionId) { - AUTO_PROFILER_MARKER("ImageBridgeTransaction", GRAPHICS); + AUTO_PROFILER_TRACING_MARKER("Paint", "ImageBridgeTransaction", GRAPHICS); AUTO_PROFILER_LABEL("ImageBridgeParent::RecvUpdate", GRAPHICS); // This ensures that destroy operations are always processed. It is not safe diff --git a/gfx/layers/wr/WebRenderBridgeParent.cpp b/gfx/layers/wr/WebRenderBridgeParent.cpp @@ -1284,7 +1284,8 @@ mozilla::ipc::IPCResult WebRenderBridgeParent::RecvSetDisplayList( CompositorBridgeParent* cbp = GetRootCompositorBridgeParent(); uint64_t innerWindowId = cbp ? cbp->GetInnerWindowId() : 0; - AUTO_PROFILER_MARKER_INNERWINDOWID("SetDisplayList", GRAPHICS, innerWindowId); + AUTO_PROFILER_TRACING_MARKER_INNERWINDOWID("Paint", "SetDisplayList", + GRAPHICS, innerWindowId); UpdateFwdTransactionId(aFwdTransactionId); // This ensures that destroy operations are always processed. It is not safe @@ -1423,7 +1424,7 @@ mozilla::ipc::IPCResult WebRenderBridgeParent::RecvEmptyTransaction( aTxnURL); } - AUTO_PROFILER_MARKER("EmptyTransaction", GRAPHICS); + AUTO_PROFILER_TRACING_MARKER("Paint", "EmptyTransaction", GRAPHICS); UpdateFwdTransactionId(aFwdTransactionId); // This ensures that destroy operations are always processed. It is not safe @@ -2348,8 +2349,8 @@ void WebRenderBridgeParent::CompositeToTarget(VsyncId aId, CompositorBridgeParent* cbp = GetRootCompositorBridgeParent(); uint64_t innerWindowId = cbp ? cbp->GetInnerWindowId() : 0; - AUTO_PROFILER_MARKER_INNERWINDOWID("CompositeToTarget", GRAPHICS, - innerWindowId); + AUTO_PROFILER_TRACING_MARKER_INNERWINDOWID("Paint", "CompositeToTarget", + GRAPHICS, innerWindowId); bool paused = true; if (cbp) { diff --git a/gfx/layers/wr/WebRenderLayerManager.cpp b/gfx/layers/wr/WebRenderLayerManager.cpp @@ -341,7 +341,7 @@ void WebRenderLayerManager::EndTransactionWithoutLayer( nsDisplayList* aDisplayList, nsDisplayListBuilder* aDisplayListBuilder, WrFiltersHolder&& aFilters, WebRenderBackgroundData* aBackground, const double aGeckoDLBuildTime, bool aRenderOffscreen) { - AUTO_PROFILER_MARKER("WrDisplayList", GRAPHICS); + AUTO_PROFILER_TRACING_MARKER("Paint", "WrDisplayList", GRAPHICS); auto clearTarget = MakeScopeExit([&] { mTarget = nullptr; }); @@ -473,7 +473,7 @@ void WebRenderLayerManager::EndTransactionWithoutLayer( GetCompositorBridgeChild()->EndCanvasTransaction(); { - AUTO_PROFILER_MARKER("ForwardDPTransaction", GRAPHICS); + AUTO_PROFILER_TRACING_MARKER("Paint", "ForwardDPTransaction", GRAPHICS); DisplayListData dlData; diplayListBuilder->End(dlData); resourceUpdates.Flush(dlData.mResourceUpdates, dlData.mSmallShmems, diff --git a/gfx/vr/VRManager.cpp b/gfx/vr/VRManager.cpp @@ -517,7 +517,7 @@ void VRManager::StartFrame() { if (mState != VRManagerState::Active) { return; } - AUTO_PROFILER_MARKER("GetSensorState", OTHER); + AUTO_PROFILER_TRACING_MARKER("VR", "GetSensorState", OTHER); /** * Do not start more VR frames until the last submitted frame is already @@ -1438,7 +1438,7 @@ void VRManager::SubmitFrameInternal(const layers::SurfaceDescriptor& aTexture, #if !defined(MOZ_WIDGET_ANDROID) MOZ_ASSERT(mSubmitThread->GetThread() == NS_GetCurrentThread()); #endif // !defined(MOZ_WIDGET_ANDROID) - AUTO_PROFILER_MARKER("SubmitFrameAtVRDisplayExternal", OTHER); + AUTO_PROFILER_TRACING_MARKER("VR", "SubmitFrameAtVRDisplayExternal", OTHER); { // scope lock MonitorAutoLock lock(mCurrentSubmitTaskMonitor); diff --git a/gfx/vr/ipc/VRManagerChild.cpp b/gfx/vr/ipc/VRManagerChild.cpp @@ -403,7 +403,7 @@ void VRManagerChild::CancelFrameRequestCallback(int32_t aHandle) { } void VRManagerChild::RunFrameRequestCallbacks() { - AUTO_PROFILER_MARKER("RunFrameRequestCallbacks", GRAPHICS); + AUTO_PROFILER_TRACING_MARKER("VR", "RunFrameRequestCallbacks", GRAPHICS); TimeStamp nowTime = TimeStamp::Now(); mozilla::TimeDuration duration = nowTime - mStartTimeStamp; diff --git a/gfx/webrender_bindings/Moz2DImageRenderer.cpp b/gfx/webrender_bindings/Moz2DImageRenderer.cpp @@ -351,7 +351,7 @@ static bool Moz2DRenderCallback(const Range<const uint8_t> aBlob, const mozilla::wr::LayoutIntRect* aDirtyRect, Range<uint8_t> aOutput) { IntSize size(aRenderRect->width(), aRenderRect->height()); - AUTO_PROFILER_MARKER("RasterizeSingleBlob", GRAPHICS); + AUTO_PROFILER_TRACING_MARKER("WebRender", "RasterizeSingleBlob", GRAPHICS); #ifndef FUZZING MOZ_RELEASE_ASSERT(size.width > 0 && size.height > 0); #endif diff --git a/gfx/webrender_bindings/RenderMacIOSurfaceTextureHost.cpp b/gfx/webrender_bindings/RenderMacIOSurfaceTextureHost.cpp @@ -114,7 +114,8 @@ wr::WrExternalImage RenderMacIOSurfaceTextureHost::Lock(uint8_t aChannelIndex, // in the D3D11 texture host. auto timeout = TimeDuration::FromMilliseconds(10000); auto start = TimeStamp::Now(); - AUTO_PROFILER_MARKER("Lock MacIOSurfaceTexture", GRAPHICS); + AUTO_PROFILER_TRACING_MARKER("WebRender", "Lock MacIOSurfaceTexture", + GRAPHICS); while (!mGpuFence->HasCompleted() && (TimeStamp::Now() - start) < timeout) { PR_Sleep(PR_MillisecondsToInterval(1)); } diff --git a/gfx/webrender_bindings/RenderThread.cpp b/gfx/webrender_bindings/RenderThread.cpp @@ -830,7 +830,7 @@ void RenderThread::UpdateAndRender( std::string markerName = "Composite #" + std::to_string(AsUint64(aWindowId)); AutoProfilerTracing tracingCompositeMarker( - markerName.c_str(), geckoprofiler::category::GRAPHICS, + "Paint", markerName.c_str(), geckoprofiler::category::GRAPHICS, Some(renderer->GetCompositorBridge()->GetInnerWindowId())); bool render = aParams.render; diff --git a/gfx/webrender_bindings/src/moz2d_renderer.rs b/gfx/webrender_bindings/src/moz2d_renderer.rs @@ -10,7 +10,7 @@ //! registering fonts found in the blob (see `prepare_request`). use bindings::{wr_moz2d_render_cb, ArcVecU8, ByteSlice, MutByteSlice}; -use gecko_profiler::auto_profiler_marker; +use gecko_profiler::auto_profiler_marker_tracing; use gecko_profiler::gecko_profiler_label; use rayon::prelude::*; use rayon::ThreadPool; @@ -507,10 +507,11 @@ impl AsyncBlobImageRasterizer for Moz2dBlobRasterizer { ) -> Vec<(BlobImageRequest, BlobImageResult)> { // All we do here is spin up our workers to callback into gecko to replay the drawing commands. gecko_profiler_label!(Graphics, Rasterization); - auto_profiler_marker!( + auto_profiler_marker_tracing!( "BlobRasterization", gecko_profiler::gecko_profiler_category!(Graphics), - Default::default() + Default::default(), + "Webrender".into() ); let requests: Vec<Job> = requests diff --git a/ipc/ipdl/ipdl/lower.py b/ipc/ipdl/ipdl/lower.py @@ -5207,8 +5207,9 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor): [ StmtExpr( ExprCall( - ExprVar("AUTO_PROFILER_MARKER"), + ExprVar("AUTO_PROFILER_TRACING_MARKER"), [ + ExprLiteral.String("Sync IPC"), ExprLiteral.String( self.protocol.name + "::" diff --git a/layout/base/PresShell.cpp b/layout/base/PresShell.cpp @@ -6099,8 +6099,9 @@ void PresShell::ProcessSynthMouseOrPointerMoveEvent( // input block. Same for the APZ response field. InputAPZContext apzContext(aPointerInfo.mLastTargetGuid, 0, nsEventStatus_eIgnore); - AUTO_PROFILER_MARKER_DOCSHELL("DispatchSynthMouseOrPointerMove", GRAPHICS, - pointShell->GetPresContext()->GetDocShell()); + AUTO_PROFILER_TRACING_MARKER_DOCSHELL( + "Paint", "DispatchSynthMouseOrPointerMove", GRAPHICS, + pointShell->GetPresContext()->GetDocShell()); nsEventStatus status = nsEventStatus_eIgnore; if (popupFrame) { pointShell->HandleEvent(popupFrame, &event, false, &status); @@ -10656,7 +10657,7 @@ bool PresShell::DoReflow(nsIFrame* target, bool aInterruptible, innerWindowID = Some(window->WindowID()); } AutoProfilerTracing tracingLayoutFlush( - aInterruptible ? "Reflow (interruptible)" : "Reflow (sync)", + "Paint", aInterruptible ? "Reflow (interruptible)" : "Reflow (sync)", geckoprofiler::category::LAYOUT, std::move(mReflowCause), innerWindowID); mReflowCause = nullptr; diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp @@ -3073,7 +3073,7 @@ void nsLayoutUtils::PaintFrame(gfxContext* aRenderingContext, nsIFrame* aFrame, { AUTO_PROFILER_LABEL_CATEGORY_PAIR(GRAPHICS_DisplayListBuilding); - AUTO_PROFILER_MARKER("DisplayList", GRAPHICS); + AUTO_PROFILER_TRACING_MARKER("Paint", "DisplayList", GRAPHICS); PerfStats::AutoMetricRecording<PerfStats::Metric::DisplayListBuilding> autoRecording; @@ -3267,7 +3267,7 @@ void nsLayoutUtils::PaintFrame(gfxContext* aRenderingContext, nsIFrame* aFrame, builder->Check(); { - AUTO_PROFILER_MARKER("DisplayListResources", GRAPHICS); + AUTO_PROFILER_TRACING_MARKER("Paint", "DisplayListResources", GRAPHICS); builder->EndFrame(); diff --git a/layout/base/nsRefreshDriver.cpp b/layout/base/nsRefreshDriver.cpp @@ -2084,8 +2084,8 @@ void nsRefreshDriver::RunVideoFrameCallbacks( // else window is partially torn down already } - AUTO_PROFILER_MARKER_INNERWINDOWID("requestVideoFrame callbacks", GRAPHICS, - doc->InnerWindowID()); + AUTO_PROFILER_TRACING_MARKER_INNERWINDOWID( + "Paint", "requestVideoFrame callbacks", GRAPHICS, doc->InnerWindowID()); for (const auto& videoElm : videoElms) { VideoFrameCallbackMetadata metadata; @@ -2145,8 +2145,9 @@ void nsRefreshDriver::RunFrameRequestCallbacks( // else window is partially torn down already } - AUTO_PROFILER_MARKER_INNERWINDOWID("requestAnimationFrame callbacks", - GRAPHICS, doc->InnerWindowID()); + AUTO_PROFILER_TRACING_MARKER_INNERWINDOWID( + "Paint", "requestAnimationFrame callbacks", GRAPHICS, + doc->InnerWindowID()); for (auto& callback : callbacks.mList) { if (callback.mCancelled) { continue; diff --git a/layout/generic/ScrollContainerFrame.cpp b/layout/generic/ScrollContainerFrame.cpp @@ -5758,8 +5758,8 @@ ScrollContainerFrame::ScrollEndEvent::Run() { void ScrollContainerFrame::FireScrollEvent() { RefPtr<nsIContent> content = GetContent(); RefPtr<nsPresContext> presContext = PresContext(); - AUTO_PROFILER_MARKER_DOCSHELL("FireScrollEvent", GRAPHICS, - presContext->GetDocShell()); + AUTO_PROFILER_TRACING_MARKER_DOCSHELL("Paint", "FireScrollEvent", GRAPHICS, + presContext->GetDocShell()); MOZ_ASSERT(mScrollEvent); mScrollEvent->Revoke(); diff --git a/mozglue/baseprofiler/public/BaseProfilerMarkers.h b/mozglue/baseprofiler/public/BaseProfilerMarkers.h @@ -230,7 +230,9 @@ struct StackMarker : public BaseMarkerType<StackMarker> { static constexpr bool StoreName = true; using MS = MarkerSchema; - static constexpr MS::PayloadField PayloadFields[0] = {}; + static constexpr MS::PayloadField PayloadFields[] = { + {"category", MS::InputType::CString, "Type", MS::Format::String, + MS::PayloadFlags::Searchable}}; static constexpr MS::Location Locations[] = {MS::Location::MarkerChart, MS::Location::MarkerTable, @@ -238,7 +240,12 @@ struct StackMarker : public BaseMarkerType<StackMarker> { static constexpr bool IsStackBased = true; - static void StreamJSONMarkerData(SpliceableJSONWriter& aWriter) {} + static void StreamJSONMarkerData(SpliceableJSONWriter& aWriter, + const ProfilerString8View& aCategory) { + if (aCategory.Length() != 0) { + aWriter.StringProperty("category", aCategory); + } + } }; } // namespace mozilla::baseprofiler::markers diff --git a/mozglue/tests/TestBaseProfiler.cpp b/mozglue/tests/TestBaseProfiler.cpp @@ -4079,8 +4079,8 @@ void TestProfiler() { ::mozilla::baseprofiler::markers::NoPayload{})); MOZ_RELEASE_ASSERT(baseprofiler::AddMarker( - "stackmarker", mozilla::baseprofiler::category::OTHER, {}, - mozilla::baseprofiler::markers::StackMarker{})); + "tracing", mozilla::baseprofiler::category::OTHER, {}, + mozilla::baseprofiler::markers::Tracing{}, "category")); MOZ_RELEASE_ASSERT(baseprofiler::AddMarker( "text", mozilla::baseprofiler::category::OTHER, {}, @@ -4710,9 +4710,9 @@ void TestPredefinedMarkers() { mozilla::ProfileChunkedBuffer::ThreadSafety::WithoutMutex, chunkManager); MOZ_RELEASE_ASSERT(mozilla::baseprofiler::AddMarkerToBuffer( - buffer, std::string_view("stackmarker"), + buffer, std::string_view("tracing"), mozilla::baseprofiler::category::OTHER, {}, - mozilla::baseprofiler::markers::StackMarker{})); + mozilla::baseprofiler::markers::Tracing{}, "category")); MOZ_RELEASE_ASSERT(mozilla::baseprofiler::AddMarkerToBuffer( buffer, std::string_view("text"), mozilla::baseprofiler::category::OTHER, diff --git a/security/manager/ssl/nsNSSComponent.cpp b/security/manager/ssl/nsNSSComponent.cpp @@ -1479,7 +1479,7 @@ void UnmigrateFromPrefixedCertDBs() { nsresult nsNSSComponent::InitializeNSS() { MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsNSSComponent::InitializeNSS\n")); AUTO_PROFILER_LABEL("nsNSSComponent::InitializeNSS", OTHER); - AUTO_PROFILER_MARKER("nsNSSComponent::InitializeNSS", OTHER); + AUTO_PROFILER_TRACING_MARKER("NSS", "nsNSSComponent::InitializeNSS", OTHER); static_assert( nsINSSErrorsService::NSS_SEC_ERROR_BASE == SEC_ERROR_BASE && diff --git a/tools/profiler/public/ETWTools.h b/tools/profiler/public/ETWTools.h @@ -18,8 +18,7 @@ namespace ETW { template <typename T, typename = void> struct MarkerHasPayload : std::false_type {}; template <typename T> -struct MarkerHasPayload<T, std::void_t<decltype(T::PayloadFields), - decltype(std::size(T::PayloadFields))>> +struct MarkerHasPayload<T, std::void_t<decltype(T::PayloadFields)>> : std::true_type {}; // Allows checking for the presence of T::Name. diff --git a/tools/profiler/public/ProfilerMarkers.h b/tools/profiler/public/ProfilerMarkers.h @@ -542,10 +542,11 @@ class AutoProfilerFmtMarker { class MOZ_RAII AutoProfilerTracing { public: - AutoProfilerTracing(const char* aMarkerName, + AutoProfilerTracing(const char* aCategoryString, const char* aMarkerName, mozilla::MarkerCategory aCategoryPair, const mozilla::Maybe<uint64_t>& aInnerWindowID) - : mMarkerName(aMarkerName), + : mCategoryString(aCategoryString), + mMarkerName(aMarkerName), mCategoryPair(aCategoryPair), mInnerWindowID(aInnerWindowID) { profiler_add_marker( @@ -553,14 +554,18 @@ class MOZ_RAII AutoProfilerTracing { mCategoryPair, {mozilla::MarkerTiming::IntervalStart(), mozilla::MarkerInnerWindowId(mInnerWindowID)}, - mozilla::baseprofiler::markers::StackMarker{}); + mozilla::baseprofiler::markers::StackMarker{}, + mozilla::ProfilerString8View::WrapNullTerminatedString( + mCategoryString)); } AutoProfilerTracing( - const char* aMarkerName, mozilla::MarkerCategory aCategoryPair, + const char* aCategoryString, const char* aMarkerName, + mozilla::MarkerCategory aCategoryPair, mozilla::UniquePtr<mozilla::ProfileChunkedBuffer> aBacktrace, const mozilla::Maybe<uint64_t>& aInnerWindowID) - : mMarkerName(aMarkerName), + : mCategoryString(aCategoryString), + mMarkerName(aMarkerName), mCategoryPair(aCategoryPair), mInnerWindowID(aInnerWindowID) { profiler_add_marker( @@ -569,7 +574,9 @@ class MOZ_RAII AutoProfilerTracing { {mozilla::MarkerTiming::IntervalStart(), mozilla::MarkerInnerWindowId(mInnerWindowID), mozilla::MarkerStack::TakeBacktrace(std::move(aBacktrace))}, - mozilla::baseprofiler::markers::StackMarker{}); + mozilla::baseprofiler::markers::StackMarker{}, + mozilla::ProfilerString8View::WrapNullTerminatedString( + mCategoryString)); } ~AutoProfilerTracing() { @@ -578,27 +585,32 @@ class MOZ_RAII AutoProfilerTracing { mCategoryPair, {mozilla::MarkerTiming::IntervalEnd(), mozilla::MarkerInnerWindowId(mInnerWindowID)}, - mozilla::baseprofiler::markers::StackMarker{}); + mozilla::baseprofiler::markers::StackMarker{}, + mozilla::ProfilerString8View::WrapNullTerminatedString( + mCategoryString)); } protected: + const char* mCategoryString; const char* mMarkerName; const mozilla::MarkerCategory mCategoryPair; const mozilla::Maybe<uint64_t> mInnerWindowID; }; // Adds a START/END pair of tracing markers. -#define AUTO_PROFILER_MARKER(markerName, categoryPair) \ - AutoProfilerTracing PROFILER_RAII( \ - markerName, geckoprofiler::category::categoryPair, mozilla::Nothing()) -#define AUTO_PROFILER_MARKER_INNERWINDOWID(markerName, categoryPair, \ - innerWindowId) \ - AutoProfilerTracing PROFILER_RAII(markerName, \ +#define AUTO_PROFILER_TRACING_MARKER(categoryString, markerName, categoryPair) \ + AutoProfilerTracing PROFILER_RAII(categoryString, markerName, \ + geckoprofiler::category::categoryPair, \ + mozilla::Nothing()) +#define AUTO_PROFILER_TRACING_MARKER_INNERWINDOWID( \ + categoryString, markerName, categoryPair, innerWindowId) \ + AutoProfilerTracing PROFILER_RAII(categoryString, markerName, \ geckoprofiler::category::categoryPair, \ mozilla::Some(innerWindowId)) -#define AUTO_PROFILER_MARKER_DOCSHELL(markerName, categoryPair, docShell) \ +#define AUTO_PROFILER_TRACING_MARKER_DOCSHELL(categoryString, markerName, \ + categoryPair, docShell) \ AutoProfilerTracing PROFILER_RAII( \ - markerName, geckoprofiler::category::categoryPair, \ + categoryString, markerName, geckoprofiler::category::categoryPair, \ geckoprofiler::markers::detail:: \ profiler_get_inner_window_id_from_docshell(docShell)) diff --git a/tools/profiler/rust-api/src/marker/mod.rs b/tools/profiler/rust-api/src/marker/mod.rs @@ -455,51 +455,24 @@ impl ProfilerMarker for Tracing { } } -/// Stack marker type for Rust code. -/// This must be kept in sync with the `mozilla::baseprofiler::markers::StackMarker` -/// C++ counterpart. -#[derive(Serialize, Deserialize, Debug)] -pub struct StackMarker(); - -impl ProfilerMarker for StackMarker { - fn marker_type_name() -> &'static str { - "StackMarker" - } - - fn stream_json_marker_data(&self, _json_writer: &mut JSONWriter) {} - - // StackMarker is a bit special because we have the same schema in the - // C++ side. This function will only get called when no StackMarkers are - // generated from the C++ side. But, most of the time, this will not be called - // when there is another C++ StackMarker marker. - fn marker_type_display() -> MarkerSchema { - use crate::marker::schema::*; - let mut schema = MarkerSchema::new(&[ - Location::MarkerChart, - Location::MarkerTable, - Location::TimelineOverview, - ]); - schema.set_stack_based(); - schema - } -} - /// RAII-style scoped tracing marker for Rust code. -/// This is a Rust-style equivalent of the C++ AUTO_PROFILER_MARKER -/// Profiler markers are emitted at when an AutoProfilerMarker is +/// This is a Rust-style equivalent of the C++ AUTO_PROFILER_TRACING_MARKER +/// Profiler markers are emitted at when an AutoProfilerTracingMarker is /// created, and when it is dropped (destroyed). -pub struct AutoProfilerMarker<'a> { +pub struct AutoProfilerTracingMarker<'a> { name: &'a str, category: ProfilingCategoryPair, options: MarkerOptions, + payload: CowString, } -impl<'a> AutoProfilerMarker<'a> { +impl<'a> AutoProfilerTracingMarker<'a> { pub fn new( name: &'a str, category: ProfilingCategoryPair, options: MarkerOptions, - ) -> Option<AutoProfilerMarker<'a>> { + payload: CowString, + ) -> Option<AutoProfilerTracingMarker<'a>> { if !crate::profiler_state::can_accept_markers() { return None; } @@ -508,19 +481,20 @@ impl<'a> AutoProfilerMarker<'a> { name, category, options.with_timing(MarkerTiming::interval_start(ProfilerTime::now())), - StackMarker(), + Tracing(payload.clone()), ); - Some(AutoProfilerMarker { + Some(AutoProfilerTracingMarker { name, category, options, + payload, }) } } -impl<'a> Drop for AutoProfilerMarker<'a> { +impl<'a> Drop for AutoProfilerTracingMarker<'a> { fn drop(&mut self) { - // If we have an AutoProfilerMarker object, then the profiler was + // If we have an AutoProfilerTracingMarker object, then the profiler was // running + accepting markers when it was *created*. We have no // guarantee that it's still running though, so check again! If the // profiler has stopped, then there's no point recording the second of a @@ -534,7 +508,7 @@ impl<'a> Drop for AutoProfilerMarker<'a> { self.category, self.options .with_timing(MarkerTiming::interval_end(ProfilerTime::now())), - StackMarker(), + Tracing(self.payload.clone()), ); } } @@ -547,26 +521,27 @@ impl<'a> Drop for AutoProfilerMarker<'a> { /// /// Example usage: /// ```rust -/// auto_profiler_marker!( +/// auto_profiler_marker_tracing!( /// "BlobRasterization", /// gecko_profiler_category!(Graphics), /// Default::default(), +/// "Webrender".to_string() /// ); /// ``` /// #[cfg(feature = "enabled")] #[macro_export] -macro_rules! auto_profiler_marker { - ($name:expr, $category:expr,$options:expr) => { +macro_rules! auto_profiler_marker_tracing { + ($name:expr, $category:expr,$options:expr, $payload:expr) => { let _macro_created_rust_tracing_marker = - $crate::AutoProfilerMarker::new($name, $category, $options); + $crate::AutoProfilerTracingMarker::new($name, $category, $options, $payload); }; } #[cfg(not(feature = "enabled"))] #[macro_export] -macro_rules! auto_profiler_marker { - ($name:expr, $category:expr,$options:expr) => { +macro_rules! auto_profiler_marker_tracing { + ($name:expr, $category:expr,$options:expr, $payload:expr) => { // Do nothing if the profiler is not enabled }; } diff --git a/tools/profiler/tests/gtest/GeckoProfiler.cpp b/tools/profiler/tests/gtest/GeckoProfiler.cpp @@ -2304,7 +2304,7 @@ TEST(GeckoProfiler, Markers) MarkerStack::TakeBacktrace(std::move(bt)), Tracing, "B"); { - AUTO_PROFILER_MARKER("auto tracing", OTHER); + AUTO_PROFILER_TRACING_MARKER("C", "auto tracing", OTHER); } { diff --git a/widget/cocoa/nsCocoaWindow.mm b/widget/cocoa/nsCocoaWindow.mm @@ -843,7 +843,8 @@ void nsCocoaWindow::PaintWindowInContentLayer() { } void nsCocoaWindow::HandleMainThreadCATransaction() { - AUTO_PROFILER_MARKER("HandleMainThreadCATransaction", GRAPHICS); + AUTO_PROFILER_TRACING_MARKER("Paint", "HandleMainThreadCATransaction", + GRAPHICS); WillPaintWindow(); if (GetWindowRenderer()->GetBackendType() == LayersBackend::LAYERS_NONE) { diff --git a/xpcom/base/CycleCollectedJSContext.cpp b/xpcom/base/CycleCollectedJSContext.cpp @@ -1152,7 +1152,7 @@ bool CycleCollectedJSContext::PerformMicroTaskCheckPoint(bool aForce) { mozilla::AutoRestore<Maybe<uint32_t>> restore(mMicroTaskRecursionDepth); mMicroTaskRecursionDepth = Some(currentDepth); - AUTO_PROFILER_MARKER("Perform microtasks", JS); + AUTO_PROFILER_TRACING_MARKER("JS", "Perform microtasks", JS); bool didProcess = false; AutoSlowOperation aso; diff --git a/xpcom/threads/TimerThread.cpp b/xpcom/threads/TimerThread.cpp @@ -833,7 +833,7 @@ void TimerThread::Wait(TimeDuration aWaitFor) MOZ_REQUIRES(mMonitor) { mWaiting = true; mNotified = false; { - AUTO_PROFILER_MARKER("TimerThread::Wait", OTHER); + AUTO_PROFILER_TRACING_MARKER("TimerThread", "Wait", OTHER); mMonitor.Wait(aWaitFor); } mWaiting = false;