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

via llvm-commits llvm-commits at lists.llvm.org
Fri May 9 11:47:40 PDT 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff HEAD~1 HEAD --extensions cpp -- llvm/lib/Support/Timer.cpp llvm/unittests/Support/TimerTest.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/lib/Support/Timer.cpp b/llvm/lib/Support/Timer.cpp
index 9cc22fbb8..c5eca6924 100644
--- a/llvm/lib/Support/Timer.cpp
+++ b/llvm/lib/Support/Timer.cpp
@@ -381,9 +381,10 @@ void TimerGroup::PrintQueuedTimers(raw_ostream &OS) {
 
   // Loop through all of the timing data, printing it out.
   for (const PrintRecord &Record : llvm::reverse(TimersToPrint)) {
-    if (const TimeRecord &TR = Record.Time; TR.getUserTime() >= minPrintTime() ||
-                                            TR.getSystemTime() >= minPrintTime() ||
-                                            TR.getWallTime() >= minPrintTime()) {
+    if (const TimeRecord &TR = Record.Time;
+        TR.getUserTime() >= minPrintTime() ||
+        TR.getSystemTime() >= minPrintTime() ||
+        TR.getWallTime() >= minPrintTime()) {
       Record.Time.print(Total, OS);
       OS << Record.Description << '\n';
     }
@@ -531,7 +532,8 @@ public:
       cl::init(true), cl::Hidden};
   cl::opt<unsigned> MinPrintTime{
       "min-print-time",
-      cl::desc("Minimum time in seconds for a timer to be printed"), cl::init(0)};
+      cl::desc("Minimum time in seconds for a timer to be printed"),
+      cl::init(0)};
 
   sys::SmartMutex<true> TimerLock;
   TimerGroup DefaultTimerGroup{"misc", "Miscellaneous Ungrouped Timers",

``````````

</details>


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


More information about the llvm-commits mailing list