forked from OSchip/llvm-project
Fix xray fdr mode to allow multiple flushes
Reviewed By: dberris Differential Revision: https://reviews.llvm.org/D96382
This commit is contained in:
parent
483ec136da
commit
5dd29d9922
|
@ -284,13 +284,12 @@ XRayLogFlushStatus fdrLoggingFlush() XRAY_NEVER_INSTRUMENT {
|
|||
return XRayLogFlushStatus::XRAY_LOG_NOT_FLUSHING;
|
||||
}
|
||||
|
||||
s32 Result = XRayLogFlushStatus::XRAY_LOG_NOT_FLUSHING;
|
||||
if (!atomic_compare_exchange_strong(&LogFlushStatus, &Result,
|
||||
XRayLogFlushStatus::XRAY_LOG_FLUSHING,
|
||||
memory_order_release)) {
|
||||
if (atomic_exchange(&LogFlushStatus, XRayLogFlushStatus::XRAY_LOG_FLUSHING,
|
||||
memory_order_release) ==
|
||||
XRayLogFlushStatus::XRAY_LOG_FLUSHING) {
|
||||
if (Verbosity())
|
||||
Report("Not flushing log, implementation is still finalizing.\n");
|
||||
return static_cast<XRayLogFlushStatus>(Result);
|
||||
Report("Not flushing log, implementation is still flushing.\n");
|
||||
return XRayLogFlushStatus::XRAY_LOG_NOT_FLUSHING;
|
||||
}
|
||||
|
||||
if (BQ == nullptr) {
|
||||
|
|
|
@ -49,21 +49,23 @@ int main(int argc, char *argv[]) {
|
|||
auto flush_status = __xray_log_flushLog();
|
||||
assert(flush_status == XRayLogFlushStatus::XRAY_LOG_FLUSHED);
|
||||
|
||||
// Without doing anything else, we should re-initialize.
|
||||
init_status = __xray_log_init_mode("xray-fdr", kConfig);
|
||||
assert(init_status == XRayLogInitStatus::XRAY_LOG_INITIALIZED);
|
||||
for (auto trial = 0; trial < 3; trial++) {
|
||||
// Without doing anything else, we should re-initialize.
|
||||
init_status = __xray_log_init_mode("xray-fdr", kConfig);
|
||||
assert(init_status == XRayLogInitStatus::XRAY_LOG_INITIALIZED);
|
||||
|
||||
// Then we spin for a bit again calling func() enough times.
|
||||
for (auto i = 0; i < 1 << 20; ++i)
|
||||
func();
|
||||
// Then we spin for a bit again calling func() enough times.
|
||||
for (auto i = 0; i < 1 << 20; ++i)
|
||||
func();
|
||||
|
||||
// Then immediately finalize the implementation.
|
||||
finalize_status = __xray_log_finalize();
|
||||
assert(finalize_status == XRayLogInitStatus::XRAY_LOG_FINALIZED);
|
||||
// Then immediately finalize the implementation.
|
||||
finalize_status = __xray_log_finalize();
|
||||
assert(finalize_status == XRayLogInitStatus::XRAY_LOG_FINALIZED);
|
||||
|
||||
// Once we're here, we should then flush.
|
||||
flush_status = __xray_log_flushLog();
|
||||
assert(flush_status == XRayLogFlushStatus::XRAY_LOG_FLUSHED);
|
||||
// Once we're here, we should then flush.
|
||||
flush_status = __xray_log_flushLog();
|
||||
assert(flush_status == XRayLogFlushStatus::XRAY_LOG_FLUSHED);
|
||||
}
|
||||
|
||||
// Finally, we should signal the sibling thread to stop.
|
||||
keep_going.clear(std::memory_order_release);
|
||||
|
|
Loading…
Reference in New Issue