@@ -129,8 +129,8 @@ void *OmptTracingBufferMgr::assignCursor(ompt_callbacks_t Type,
129
129
lck.unlock ();
130
130
131
131
// Schedule the full buffer for flushing till the corresponding cursor.
132
- if (ToBeFlushedCursor)
133
- setComplete (ToBeFlushedCursor, ToBeFlushedBuf);
132
+ if (OMPX_FlushOnBufferFull && ToBeFlushedCursor)
133
+ triggerFlushOnBufferFull (ToBeFlushedCursor, ToBeFlushedBuf);
134
134
135
135
DP (" Thread %lu: Assigned %lu bytes at %p in new buffer with id %lu for "
136
136
" device %ld\n " ,
@@ -148,10 +148,10 @@ void *OmptTracingBufferMgr::assignCursor(ompt_callbacks_t Type,
148
148
* called without holding any lock.
149
149
* Note lock order: buf_lock -> flush_lock
150
150
*/
151
- void OmptTracingBufferMgr::setComplete (void *cursor, BufPtr Buf) {
151
+ void OmptTracingBufferMgr::triggerFlushOnBufferFull (void *cursor, BufPtr Buf) {
152
152
std::unique_lock<std::mutex> buf_lock (BufferMgrMutex);
153
153
154
- // Between calling setComplete and this check, a flush-all may have
154
+ // Between calling this function and this check, a flush-all may have
155
155
// delivered this buffer to the tool and deleted it. So the buffer
156
156
// may not exist.
157
157
if (Id2BufferMap.find (Buf->Id ) == Id2BufferMap.end ())
@@ -729,7 +729,8 @@ void OmptTracingBufferMgr::shutdownHelperThreads() {
729
729
void OmptTracingBufferMgr::flushAndShutdownHelperThreads () {
730
730
std::unique_lock<std::mutex> Lock (llvm::omp::target::ompt::TraceControlMutex);
731
731
// Flush buffers for all devices.
732
- flushAllBuffers (MAX_NUM_DEVICES);
732
+ if (OMPX_FlushOnShutdown)
733
+ flushAllBuffers (MAX_NUM_DEVICES);
733
734
shutdownHelperThreads ();
734
735
}
735
736
@@ -747,9 +748,4 @@ void OmptTracingBufferMgr::destroyHelperThreads() {
747
748
CompletionThreads.clear ();
748
749
HelperThreadIdMap.clear ();
749
750
}
750
-
751
- OmptTracingBufferMgr::OmptTracingBufferMgr () {
752
- // no need to hold locks for init() since object is getting constructed here
753
- init ();
754
- }
755
751
#endif
0 commit comments