Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: e887d63b2279cb6d55355d649fc5f42e7322ab1f
      
https://github.com/WebKit/WebKit/commit/e887d63b2279cb6d55355d649fc5f42e7322ab1f
  Author: Nikolas Zimmermann <[email protected]>
  Date:   2026-09-15 (Tue, 15 Sep 2026)

  Changed paths:
    M Source/WTF/wtf/SystemTracing.h
    M Source/WTF/wtf/glib/SysprofAnnotator.h
    M Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/FrameRenderer.cpp
    M Tools/TestWebKitAPI/PlatformGTK.cmake
    M Tools/TestWebKitAPI/PlatformWPE.cmake
    A Tools/TestWebKitAPI/Tests/WTF/glib/SysprofAnnotator.cpp

  Log Message:
  -----------
  [GLib] SysprofAnnotator mixes up the begins and ends of nested and 
overlapping marks
https://bugs.webkit.org/show_bug.cgi?id=324151

Reviewed by Justin Michaud.

SysprofAnnotator kept only one begin per signpost name and object, the
pointer passed to WTFBeginSignpost(), and only one begin per trace point
name. A second begin replaced the first, so only one of the two ends
found a begin, and the other was written as 0 ms. This broke the
durations of recursive, concurrent and overlapping marks.

Keep a stack of begins per mark and remember the thread of each begin.
An end takes the latest begin of its own thread, or, for a mark that
ends on another thread, the latest begin of any thread. Trace points
that carry an identifier, such as loads, are paired by it instead. A
load begins again on every redirect, so it keeps its first begin and its
mark covers the whole load. Pages in one web process no longer share
RenderingUpdateRunLoopObserver marks, which are now signposts of their
FrameRenderer.

Add a hook so unit tests can read the marks instead of sysprof.
Use that to construct test coverage for SysprofAnnotator.cpp.

Tests: Tools/TestWebKitAPI/Tests/WTF/glib/SysprofAnnotator.cpp

* Source/WTF/wtf/SystemTracing.h:
(WTF::tracePoint):
(WTF::TraceScope::TraceScope):
(WTF::TraceScope::~TraceScope):
* Source/WTF/wtf/glib/SysprofAnnotator.h:
* Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/FrameRenderer.cpp:
(WebKit::FrameRenderer::scheduleRenderingUpdateRunLoopObserver):
(WebKit::FrameRenderer::invalidateRenderingUpdateRunLoopObserver):
* Tools/TestWebKitAPI/PlatformGTK.cmake:
* Tools/TestWebKitAPI/PlatformWPE.cmake:
* Tools/TestWebKitAPI/Tests/WTF/glib/SysprofAnnotator.cpp: Added.
(TestWebKitAPI::WTF_REQUIRES_LOCK):
(TestWebKitAPI::recordMark):
(TestWebKitAPI::marksNamed):
(TestWebKitAPI::checkpoint):
(TestWebKitAPI::ranBetween):
(TestWebKitAPI::TEST_F(WTF_SysprofAnnotator, 
SignpostCarriesTheMessagesOfItsBeginAndEnd)):
(TestWebKitAPI::TEST_F(WTF_SysprofAnnotator, 
SignpostsOfDifferentObjectsOverlap)):
(TestWebKitAPI::TEST_F(WTF_SysprofAnnotator, 
SignpostEndingOnAnotherThreadThanItBegan)):
(TestWebKitAPI::TEST_F(WTF_SysprofAnnotator, SameSignpostOnTwoThreadsAtOnce)):
(TestWebKitAPI::TEST_F(WTF_SysprofAnnotator, SignpostEndWithoutBegin)):
(TestWebKitAPI::TEST_F(WTF_SysprofAnnotator, TraceScopeNestedInOneOfItsName)):
(TestWebKitAPI::TEST_F(WTF_SysprofAnnotator, 
TraceScopeOfATracePointPairedByItsData)):
(TestWebKitAPI::TEST_F(WTF_SysprofAnnotator, TraceScopeCarryingData)):
(TestWebKitAPI::TEST_F(WTF_SysprofAnnotator, SameTraceScopeOnTwoThreadsAtOnce)):
(TestWebKitAPI::TEST_F(WTF_SysprofAnnotator, 
TraceScopeEndDoesNotTakeTheBeginOfAnotherThread)):
(TestWebKitAPI::TEST_F(WTF_SysprofAnnotator, TracePointsWithoutData)):
(TestWebKitAPI::TEST_F(WTF_SysprofAnnotator, 
TracePointEndingOnAnotherThreadWithDataItsBeginLacks)):
(TestWebKitAPI::TEST_F(WTF_SysprofAnnotator, 
OverlappingTracePointsPairByTheirData)):
(TestWebKitAPI::TEST_F(WTF_SysprofAnnotator, 
RedirectedLoadIsTimedFromItsFirstBegin)):
(TestWebKitAPI::TEST_F(WTF_SysprofAnnotator, 
ProvisionalLoadBegunAgainIsTimedFromItsLatestBegin)):
(TestWebKitAPI::TEST_F(WTF_SysprofAnnotator, TracePointEndWithoutBegin)):
(TestWebKitAPI::TEST_F(WTF_SysprofAnnotator, 
TracePointCarryingDataEndingOnAnotherThread)):
(TestWebKitAPI::TEST_F(WTF_SysprofAnnotator, OverlappingProcessLaunches)):
(TestWebKitAPI::TEST_F(WTF_SysprofAnnotator, 
OverlappingTracePointsFromJavaScript)):
(TestWebKitAPI::TEST_F(WTF_SysprofAnnotator, BeginsWithoutEndAreBounded)):
(TestWebKitAPI::TEST_F(WTF_SysprofAnnotator, InstantMarks)):

Canonical link: https://commits.webkit.org/321234@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to