[llvm] [Timers] Add a flag to set a minimum timer value for printing (PR #139306)

Arthur Eubanks via llvm-commits llvm-commits at lists.llvm.org
Mon May 19 14:34:27 PDT 2025


================
@@ -82,4 +86,34 @@ TEST(Timer, TimerGroupTimerDestructed) {
   EXPECT_FALSE(testing::internal::GetCapturedStderr().empty());
 }
 
+TEST(Timer, MinTimerFlag) {
+  testing::internal::CaptureStderr();
+
+  Timer T1("T1", "T1");
+  Timer T2("T2", "T2");
+
+  minPrintTime().setValue(2);
+
+  T1.startTimer();
+  T2.startTimer();
+
+  SleepMS(1000);
----------------
aeubanks wrote:

This test is still going to be flaky in its current state. I think it's fine to add an API to set the time for testing. Let's hear other opinions.

Separately, do we want to make the flag milliseconds or seconds?

https://github.com/llvm/llvm-project/pull/139306


More information about the llvm-commits mailing list