summaryrefslogtreecommitdiff
path: root/lib/xray/xray_flags.h
AgeCommit message (Collapse)Author
2017-12-14[XRay][compiler-rt] Coalesce calls to mprotect to reduce patching overheadDean Michael Berris
Summary: Before this change, XRay would conservatively patch sections of the code one sled at a time. Upon testing/profiling, this turns out to take an inordinate amount of time and cycles. For an instrumented clang binary, the cycles spent both in the patching/unpatching routine constituted 4% of the cycles -- this didn't count the time spent in the kernel while performing the mprotect calls in quick succession. With this change, we're coalescing the number of calls to mprotect from being linear to the number of instrumentation points, to now being a lower constant when patching all the sleds through `__xray_patch()` or `__xray_unpatch()`. In the case of calling `__xray_patch_function()` or `__xray_unpatch_function()` we're now doing an mprotect call once for all the sleds for that function (reduction of at least 2x calls to mprotect). Reviewers: kpw, eizan Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D41153 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@320664 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-07[XRay][compiler-rt][NFC] Turn ProudCase functions to humbleCase functionsDean Michael Berris
Summary: As pointed out in casual reading of the XRay codebase, that we had some interesting named functions that didn't quite follow the LLVM coding conventions. Reviewers: chandlerc, dblaikie Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D29625 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@294373 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-21[compiler-rt][XRay] re-submitting r276117, with fixes for build breakage due ↵Dean Michael Berris
to extraneous and missing dependencies and attempts to build on unsupported OSes Summary: This is a fixed-up version of D21612, to address failure identified post-commit. Original commit description: This patch implements the initialisation and patching routines for the XRay runtime, along with the necessary trampolines for function entry/exit handling. For now we only define the basic hooks for allowing an implementation to define a handler that gets run on function entry/exit. We expose a minimal API for controlling the behaviour of the runtime (patching, cleanup, and setting the handler to invoke when instrumenting). Fixes include: - Gating XRay build to only Linux x86_64 and with the right dependencies in case it is the only library being built - Including <cstddef> to fix std::size_t issue Reviewers: kcc, rnk, echristo Subscribers: mehdi_amini, llvm-commits Differential Revision: https://reviews.llvm.org/D22611 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@276251 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-20Revert r276117 "[XRay] Basic initialization and flag definition for XRay ↵Hans Wennborg
runtime" and also the follow-up "[xray] Only build xray on Linux for now" Two build errors were reported on the llvm-commits list: [ 88%] Building CXX object lib/xray/CMakeFiles/clang_rt.xray-x86_64.dir/xray_flags.cc.o /mnt/b/sanitizer-buildbot1/sanitizer-x86_64-linux/build/llvm/projects/compiler-rt/lib/xray/xray_init.cc:23:10: fatal error: 'llvm/Support/ELF.h' file not found #include "llvm/Support/ELF.h" ^ and In file included from /w/src/llvm.org/projects/compiler-rt/lib/xray/xray_interface.cc:16: /w/src/llvm.org/projects/compiler-rt/lib/xray/xray_interface_internal.h:36:8: error: no type named 'size_t' in namespace 'std' std::size_t Entries; ~~~~~^ git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@276186 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-20[compiler-rt] [XRay] Basic initialization and flag definition for XRay runtimeDean Michael Berris
Summary: This patch implements the initialisation and patching routines for the XRay runtime, along with the necessary trampolines for function entry/exit handling. For now we only define the basic hooks for allowing an implementation to define a handler that gets run on function entry/exit. We expose a minimal API for controlling the behaviour of the runtime (patching, cleanup, and setting the handler to invoke when instrumenting). Depends on D19904 Reviewers: echristo, kcc, rnk Subscribers: rnk, mehdi_amini, llvm-commits Differential Revision: https://reviews.llvm.org/D21612 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@276117 91177308-0d34-0410-b5e6-96231b3b80d8