diff options
author | Dean Michael Berris <dberris@google.com> | 2017-11-28 11:49:22 +0000 |
---|---|---|
committer | Dean Michael Berris <dberris@google.com> | 2017-11-28 11:49:22 +0000 |
commit | 22f6aeecb2122630e4b27e7018c9fb47d17edda5 (patch) | |
tree | 65348c05663de849a391f71704c8071159f2c422 /lib/xray/xray_fdr_logging.cc | |
parent | dc94bef4e936c15e096cb2a65163dc3cda3bb34d (diff) |
[XRay][compiler-rt][Darwin] Minimal XRay build support in Darwin
This change is the first in a series of changes to get the XRay runtime
building on macOS. This first allows us to build the minimal parts of
XRay to get us started on supporting macOS development. These include:
- CMake changes to allow targeting x86_64 initially.
- Allowing for building the initialisation routines without
`.preinit_array` support.
- Use __sanitizer::SleepForMillis() to work around the lack of
clock_nanosleep on macOS.
- Deprecate the xray_fdr_log_grace_period_us flag, and introduce
the xray_fdr_log_grace_period_ms flag instead, to use
milliseconds across platforms.
Reviewers: kubamracek
Subscribers: llvm-commits, krytarowski, nglevin, mgorny
Differential Review: https://reviews.llvm.org/D39114
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@319165 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/xray/xray_fdr_logging.cc')
-rw-r--r-- | lib/xray/xray_fdr_logging.cc | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/lib/xray/xray_fdr_logging.cc b/lib/xray/xray_fdr_logging.cc index 035fc4061..ca764022f 100644 --- a/lib/xray/xray_fdr_logging.cc +++ b/lib/xray/xray_fdr_logging.cc @@ -70,15 +70,9 @@ XRayLogFlushStatus fdrLoggingFlush() XRAY_NEVER_INSTRUMENT { return XRayLogFlushStatus::XRAY_LOG_NOT_FLUSHING; } - // We wait a number of microseconds to allow threads to see that we've + // We wait a number of milliseconds to allow threads to see that we've // finalised before attempting to flush the log. - struct timespec TS; - TS.tv_sec = flags()->xray_fdr_log_grace_period_us / 1000000; - TS.tv_nsec = (flags()->xray_fdr_log_grace_period_us % 1000000) * 1000; - struct timespec Rem; - while (clock_nanosleep(CLOCK_REALTIME, 0, &TS, &Rem) && - (Rem.tv_sec != 0 || Rem.tv_nsec != 0)) - TS = Rem; + __sanitizer::SleepForMillis(flags()->xray_fdr_log_grace_period_ms); // We write out the file in the following format: // @@ -374,9 +368,7 @@ static auto UNUSED Unused = [] { using namespace __xray; if (flags()->xray_fdr_log) { XRayLogImpl Impl{ - fdrLoggingInit, - fdrLoggingFinalize, - fdrLoggingHandleArg0, + fdrLoggingInit, fdrLoggingFinalize, fdrLoggingHandleArg0, fdrLoggingFlush, }; __xray_set_log_impl(Impl); |