[PATCH] D133153: [support] Prepare TimeProfiler for cross-thread support
Mark Shields via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 1 15:32:23 PDT 2022
mbs-modular updated this revision to Diff 457426.
mbs-modular added a comment.
- woops, BeginningOfTime must always capture now according to the system clock, irrespective of what we use for the profiling clock.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D133153/new/
https://reviews.llvm.org/D133153
Files:
llvm/lib/Support/TimeProfiler.cpp
Index: llvm/lib/Support/TimeProfiler.cpp
===================================================================
--- llvm/lib/Support/TimeProfiler.cpp
+++ llvm/lib/Support/TimeProfiler.cpp
@@ -32,6 +32,7 @@
using std::chrono::duration_cast;
using std::chrono::microseconds;
using std::chrono::steady_clock;
+using std::chrono::system_clock;
using std::chrono::time_point;
using std::chrono::time_point_cast;
@@ -102,7 +103,7 @@
struct llvm::TimeTraceProfiler {
TimeTraceProfiler(unsigned TimeTraceGranularity = 0, StringRef ProcName = "")
- : BeginningOfTime(ClockType::now()), StartTime(ClockType::now()),
+ : BeginningOfTime(system_clock::now()), StartTime(ClockType::now()),
ProcName(ProcName), Pid(sys::Process::getProcessId()),
Tid(llvm::get_threadid()), TimeTraceGranularity(TimeTraceGranularity) {
llvm::get_thread_name(ThreadName);
@@ -275,7 +276,9 @@
SmallVector<TimeTraceProfilerEntry, 16> Stack;
SmallVector<TimeTraceProfilerEntry, 128> Entries;
StringMap<CountAndDurationType> CountAndTotalPerName;
- const TimePointType BeginningOfTime;
+ // System clock time when the session was begun.
+ const time_point<system_clock> BeginningOfTime;
+ // Profiling clock time when the session was begun.
const TimePointType StartTime;
const std::string ProcName;
const sys::Process::Pid Pid;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D133153.457426.patch
Type: text/x-patch
Size: 1357 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220901/b5bb4404/attachment.bin>
More information about the llvm-commits
mailing list