[lld] Changing TimeProfiler.cpp clock from microseconds to nanoseconds (PR #68096)
Mark Dewing via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 6 08:31:28 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:
This silently changes the meaning of TimeTraceGranularity from microseconds to nanoseconds, and there are users of the code besides OpenMP, and it changes the meaning for them, too.
I usually add an environment variable (LIBOMPTARGET_PROFILE_GRANULARITY) to change the granularity, and set it to zero for profiling. I thought there was a review adding such a variable, but I can't find it now.
https://github.com/llvm/llvm-project/pull/68096
More information about the llvm-commits
mailing list