[PATCH] D140248: [OpenMP] Enable profiling on multiple threads
Mark Dewing via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 9 09:32:35 PST 2023
markdewing updated this revision to Diff 487478.
markdewing added a comment.
Add comment. Change variable name.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D140248/new/
https://reviews.llvm.org/D140248
Files:
openmp/libomptarget/src/rtl.cpp
Index: openmp/libomptarget/src/rtl.cpp
===================================================================
--- openmp/libomptarget/src/rtl.cpp
+++ openmp/libomptarget/src/rtl.cpp
@@ -44,6 +44,8 @@
static char *ProfileTraceFile = nullptr;
// List of TimeTraceProfiler instances on other threads
+// Needs to be pointer. If this is a file-scope object, the destructor
+// gets called before "deinit" is called.
std::vector<llvm::TimeTraceProfiler *> *profileInstancesOtherThreads = nullptr;
std::mutex profLock;
@@ -77,8 +79,8 @@
delete PM;
if (ProfileTraceFile) {
- for (auto prof : *profileInstancesOtherThreads)
- timeTraceProfilerFinishThreadExternal(prof);
+ for (auto Prof : *profileInstancesOtherThreads)
+ timeTraceProfilerFinishThreadExternal(Prof);
// TODO: add env var for file output
if (auto E = timeTraceProfilerWrite(ProfileTraceFile, "-"))
fprintf(stderr, "Error writing out the time trace\n");
@@ -96,9 +98,9 @@
if (llvm::getTimeTraceProfilerInstance() == nullptr) {
DP("initializing profiler on thread");
llvm::timeTraceProfilerInitialize(500, "libomptarget");
- llvm::TimeTraceProfiler *prof = llvm::getTimeTraceProfilerInstance();
+ llvm::TimeTraceProfiler *Prof = llvm::getTimeTraceProfilerInstance();
std::lock_guard<std::mutex> Lock(profLock);
- profileInstancesOtherThreads->push_back(prof);
+ profileInstancesOtherThreads->push_back(Prof);
}
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D140248.487478.patch
Type: text/x-patch
Size: 1473 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230109/189cd5ff/attachment.bin>
More information about the llvm-commits
mailing list