[llvm] Changing TimeProfiler.cpp clock from microseconds to nanoseconds (PR #68096)

Mark Dewing via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 3 21:53:52 PDT 2023


================
@@ -114,16 +114,16 @@ struct llvm::TimeTraceProfiler {
 
     // Check that end times monotonically increase.
     assert((Entries.empty() ||
-            (E.getFlameGraphStartUs(StartTime) + E.getFlameGraphDurUs() >=
-             Entries.back().getFlameGraphStartUs(StartTime) +
-                 Entries.back().getFlameGraphDurUs())) &&
+            (E.getFlameGraphStartNs(StartTime) + E.getFlameGraphDurNs() >=
+             Entries.back().getFlameGraphStartNs(StartTime) +
+                 Entries.back().getFlameGraphDurNs())) &&
            "TimeProfiler scope ended earlier than previous scope");
 
     // Calculate duration at full precision for overall counts.
     DurationType Duration = E.End - E.Start;
 
     // Only include sections longer or equal to TimeTraceGranularity msec.
-    if (duration_cast<microseconds>(Duration).count() >= TimeTraceGranularity)
+    if (duration_cast<nanoseconds>(Duration).count() >= TimeTraceGranularity)
----------------
markdewing wrote:

TimeTraceGranularity is in microseconds wherever timeTraceProfilerInitialize gets called.  Is there a plan to update the interface for compatibility (i.e. adjust microseconds to nanoseconds internally)?

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


More information about the llvm-commits mailing list