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

via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 4 06:15:29 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)
----------------
fel-cab wrote:

I didn't think about it, but I can do it. We need a easy way for users, to change it. Do you have an idea of how to do it?

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


More information about the llvm-commits mailing list