From 089c958f36cf198c6e9ca431b5abd3ea1e597827 Mon Sep 17 00:00:00 2001 From: Dean Michael Berris Date: Thu, 14 Dec 2017 02:51:20 +0000 Subject: [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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@320664 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/xray/xray_flags.h | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/xray/xray_flags.h') diff --git a/lib/xray/xray_flags.h b/lib/xray/xray_flags.h index f4e30283b..3ed5b8844 100644 --- a/lib/xray/xray_flags.h +++ b/lib/xray/xray_flags.h @@ -16,6 +16,7 @@ #define XRAY_FLAGS_H #include "sanitizer_common/sanitizer_flag_parser.h" +#include "sanitizer_common/sanitizer_internal_defs.h" namespace __xray { -- cgit v1.2.3