diff options
author | Dean Michael Berris <dberris@google.com> | 2017-02-02 07:51:21 +0000 |
---|---|---|
committer | Dean Michael Berris <dberris@google.com> | 2017-02-02 07:51:21 +0000 |
commit | ee21d1338198a9eb2b15e0b48409752e69bd7901 (patch) | |
tree | ad0d848e60fb7428f709b81b9006ad2e9d6e263b /lib/xray/xray_inmemory_log.cc | |
parent | 7cebbf504deb1a07c7f99b69d8c8fb0f8f778d43 (diff) |
[XRay] Probe for CPU features that XRay needs
Summary:
In llvm.org/PR31756 it's pointed out that sometimes rdtscp isn't
available. We fix it here by checking first whether it's availble before
installing the logging handler. In future commits we can have
alternative implementations, maybe working around some of the
constraints on some systems.
This change enables us to make that determination, but report an error
instead when the features aren't available.
Reviewers: sdardis, javed.absar, rSerge
Subscribers: pelikan, llvm-commits
Differential Revision: https://reviews.llvm.org/D29438
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@293870 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/xray/xray_inmemory_log.cc')
-rw-r--r-- | lib/xray/xray_inmemory_log.cc | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/xray/xray_inmemory_log.cc b/lib/xray/xray_inmemory_log.cc index d25a61bdb..9decfc437 100644 --- a/lib/xray/xray_inmemory_log.cc +++ b/lib/xray/xray_inmemory_log.cc @@ -138,6 +138,11 @@ void __xray_InMemoryRawLog(int32_t FuncId, } static auto Unused = [] { + if (!probeRequiredCPUFeatures()) { + Report("Required CPU features missing for XRay instrumentation, not " + "installing instrumentation hooks.\n"); + return false; + } if (flags()->xray_naive_log) __xray_set_handler(__xray_InMemoryRawLog); return true; |