Author: Reid Kleckner
Date: 2025-05-08T14:07:44-07:00
New Revision: 47fb5bd494a9dd391abceafddb872e01a7d3492b

URL: 
https://github.com/llvm/llvm-project/commit/47fb5bd494a9dd391abceafddb872e01a7d3492b
DIFF: 
https://github.com/llvm/llvm-project/commit/47fb5bd494a9dd391abceafddb872e01a7d3492b.diff

LOG: [clang] Deflake the TimeProfile support tests (#138613)

These tests have been flaky since they were merged into the
AllClangUnitTests binary, but the flakiness is inherent to the nature of
timer-based tests.

Added: 
    

Modified: 
    clang/unittests/Support/TimeProfilerTest.cpp

Removed: 
    


################################################################################
diff  --git a/clang/unittests/Support/TimeProfilerTest.cpp 
b/clang/unittests/Support/TimeProfilerTest.cpp
index f8053f2dfce48..7698742426dfc 100644
--- a/clang/unittests/Support/TimeProfilerTest.cpp
+++ b/clang/unittests/Support/TimeProfilerTest.cpp
@@ -155,6 +155,16 @@ std::string buildTraceGraph(StringRef Json) {
       bool InsideCurrentEvent =
           Event.TimestampBegin >= EventStack.top()->TimestampBegin &&
           Event.TimestampEnd <= EventStack.top()->TimestampEnd;
+
+      // Presumably due to timer rounding, PerformPendingInstantiations often
+      // appear to be within the timer interval of the immediately previous
+      // event group. We always know these events occur at level 1, not level 
2,
+      // in our tests, so pop an event in that case.
+      if (InsideCurrentEvent && Event.Name == "PerformPendingInstantiations" &&
+          EventStack.size() == 2) {
+        InsideCurrentEvent = false;
+      }
+
       if (!InsideCurrentEvent)
         EventStack.pop();
       else


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to