[lld] Changing TimeProfiler.cpp clock from microseconds to nanoseconds (PR #68096)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 6 07:52:10 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:
Hi Mark, I've been looking at this, but now I'm not sure what you mean. After looking at the tracing format ( Perfetto/chronium ) I see that it requires that the events duration have to be passed in microseconds. I made this change because I thought it was possible to provide trace duration in nanoseconds. I can obtain basically the same behavior on on the libomptarget trace by changing the TimeTraceGranularity at the construction of the trace, to 0. Given this, at this point I think that this patch is not necessary. But maybe I'm missing something, what do you mean with "update the interface for compatibility".
https://github.com/llvm/llvm-project/pull/68096
More information about the llvm-commits
mailing list