llvm-project/compiler-rt/lib/xray
Dean Michael Berris 504b0c28f3 [XRay][compiler-rt] Coalesce calls to mprotect to reduce patching overhead
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

llvm-svn: 320664
2017-12-14 02:51:20 +00:00
..
tests [XRay] Use optimistic logging model for FDR mode 2017-11-21 07:16:57 +00:00
CMakeLists.txt [compiler-rt][xray][cmake] Fix a build issue caused by set/item mixup 2017-12-06 14:03:41 +00:00
weak_symbols.txt [XRay][compiler-rt][Darwin] Minimal XRay build support in Darwin 2017-11-28 11:49:22 +00:00
xray_AArch64.cc [XRay][compiler-rt] Fix misspeling of XRaySledEntry 2017-05-12 01:33:55 +00:00
xray_always_instrument.txt [XRay][compiler-rt][NFC] Add example always/never instrument files. 2017-06-28 04:44:36 +00:00
xray_arm.cc [XRay][compiler-rt] Fix misspeling of XRaySledEntry 2017-05-12 01:33:55 +00:00
xray_buffer_queue.cc [XRay] Use optimistic logging model for FDR mode 2017-11-21 07:16:57 +00:00
xray_buffer_queue.h [XRay] Use optimistic logging model for FDR mode 2017-11-21 07:16:57 +00:00
xray_defs.h [XRay][compiler-rt] Disable XRay instrumentation of the XRay runtime. 2016-11-16 01:01:13 +00:00
xray_fdr_log_records.h [XRay] Use optimistic logging model for FDR mode 2017-11-21 07:16:57 +00:00
xray_fdr_logging.cc [XRay][compiler-rt] Implement logging implementation registration 2017-12-05 12:08:56 +00:00
xray_fdr_logging.h [XRay] [compiler-rt] FDR logging arg1 handler 2017-09-28 05:29:59 +00:00
xray_fdr_logging_impl.h [XRay] Use optimistic logging model for FDR mode 2017-11-21 07:16:57 +00:00
xray_flags.cc [XRay][compiler-rt] Allow for defining defaults at compile-time 2017-02-18 02:09:51 +00:00
xray_flags.h [XRay][compiler-rt] Coalesce calls to mprotect to reduce patching overhead 2017-12-14 02:51:20 +00:00
xray_flags.inc [XRay][compiler-rt] Coalesce calls to mprotect to reduce patching overhead 2017-12-14 02:51:20 +00:00
xray_init.cc [XRay][compiler-rt][Darwin] Use dynamic initialisation as an alternative 2017-11-29 22:06:12 +00:00
xray_inmemory_log.cc [XRay][compiler-rt] Use __sanitizer::Atexit() instead of atexit() 2017-12-05 13:40:01 +00:00
xray_inmemory_log.h [XRay][compiler-rt] Migrate basic mode logging to the XRay framework 2017-11-21 07:29:21 +00:00
xray_interface.cc [XRay][compiler-rt] Coalesce calls to mprotect to reduce patching overhead 2017-12-14 02:51:20 +00:00
xray_interface_internal.h [XRay][compiler-rt] Support sled versioning for custom event sleds 2017-08-23 04:42:37 +00:00
xray_log_interface.cc [XRay][compiler-rt] Implement logging implementation registration 2017-12-05 12:08:56 +00:00
xray_mips.cc [XRay][compiler-rt] Runtime changes to support custom event logging 2017-05-12 01:07:41 +00:00
xray_mips64.cc [XRay][compiler-rt] Runtime changes to support custom event logging 2017-05-12 01:07:41 +00:00
xray_never_instrument.txt [XRay][compiler-rt][NFC] Add example always/never instrument files. 2017-06-28 04:44:36 +00:00
xray_powerpc64.cc [XRay][compiler-rt] Runtime changes to support custom event logging 2017-05-12 01:07:41 +00:00
xray_powerpc64.inc Re-commit r295017, since we have a potential fix of the tests, r295248, landed. 2017-02-15 22:40:29 +00:00
xray_trampoline_AArch64.S Add NO_EXEC_STACK_DIRECTIVE to xray assembly files. 2017-03-15 21:18:47 +00:00
xray_trampoline_arm.S Add NO_EXEC_STACK_DIRECTIVE to xray assembly files. 2017-03-15 21:18:47 +00:00
xray_trampoline_mips.S [Compiler-rt][XRAY][MIPS] Support xray on mips/mipsel/mips64/mips64el 2017-02-15 10:54:09 +00:00
xray_trampoline_mips64.S [Compiler-rt][XRAY][MIPS] Support xray on mips/mipsel/mips64/mips64el 2017-02-15 10:54:09 +00:00
xray_trampoline_powerpc64.cc Re-commit r295017, since we have a potential fix of the tests, r295248, landed. 2017-02-15 22:40:29 +00:00
xray_trampoline_powerpc64_asm.S [XRay] Fix XRay PPC return value bug. 2017-05-10 16:28:21 +00:00
xray_trampoline_x86_64.S [sanitizer] Refactor how assembly files are handled 2017-11-29 19:27:25 +00:00
xray_tsc.h [XRay][compiler-rt] Support TSC emulation even for x86_64 2017-03-15 02:28:00 +00:00
xray_utils.cc [XRay][compiler-rt] Reduce XRay log spam 2017-12-13 06:37:13 +00:00
xray_utils.h [XRay] Refactor TSC related functions into a single header. NFC. 2017-02-10 20:30:43 +00:00
xray_x86_64.cc [XRay][compiler-rt] Fix rdtscp support check for x86_64 2017-10-10 12:44:20 +00:00
xray_x86_64.inc [XRay] Refactor TSC related functions into a single header. NFC. 2017-02-10 20:30:43 +00:00