llvm-project/compiler-rt/lib/xray
Dean Michael Berris 26e81209ef [XRay][profiler] Part 1: XRay Allocator and Array Implementations
Summary:
This change is part of the larger XRay Profiling Mode effort.

Here we implement an arena allocator, for fixed sized buffers used in a
segmented array implementation. This change adds the segmented array
data structure, which relies on the allocator to provide and maintain
the storage for the segmented array.

Key features of the `Allocator` type:

*  It uses cache-aligned blocks, intended to host the actual data. These
   blocks are cache-line-size multiples of contiguous bytes.

*  The `Allocator` has a maximum memory budget, set at construction
   time. This allows us to cap the amount of data each specific
   `Allocator` instance is responsible for.

*  Upon destruction, the `Allocator` will clean up the storage it's
   used, handing it back to the internal allocator used in
   sanitizer_common.

Key features of the `Array` type:

*  Each segmented array is always backed by an `Allocator`, which is
   either user-provided or uses a global allocator.

*  When an `Array` grows, it grows by appending a segment that's
   fixed-sized. The size of each segment is computed by the number of
   elements of type `T` that can fit into cache line multiples.

*  An `Array` does not return memory to the `Allocator`, but it can keep
   track of the current number of "live" objects it stores.

*  When an `Array` is destroyed, it will not return memory to the
   `Allocator`. Users should clean up the `Allocator` independently of
   the `Array`.

*  The `Array` type keeps a freelist of the chunks it's used before, so
   that trimming and growing will re-use previously allocated chunks.

These basic data structures are used by the XRay Profiling Mode
implementation to implement efficient and cache-aware storage for data
that's typically read-and-write heavy for tracking latency information.
We're relying on the cache line characteristics of the architecture to
provide us good data isolation and cache friendliness, when we're
performing operations like searching for elements and/or updating data
hosted in these cache lines.

Reviewers: echristo, pelikan, kpw

Subscribers: mgorny, llvm-commits

Differential Revision: https://reviews.llvm.org/D45756

llvm-svn: 331141
2018-04-29 13:46:30 +00:00
..
tests [XRay][profiler] Part 1: XRay Allocator and Array Implementations 2018-04-29 13:46:30 +00:00
CMakeLists.txt [XRay][profiler] Part 1: XRay Allocator and Array Implementations 2018-04-29 13:46:30 +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] Add noop patch functions for unsupported arches. 2018-04-17 23:19:23 +00:00
xray_allocator.h [XRay][profiler] Part 1: XRay Allocator and Array Implementations 2018-04-29 13:46:30 +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] Add noop patch functions for unsupported arches. 2018-04-17 23:19:23 +00:00
xray_buffer_queue.cc [XRay] Rename Buffer.Buffer to Buffer.Data 2018-02-10 09:07:34 +00:00
xray_buffer_queue.h [XRay] Rename Buffer.Buffer to Buffer.Data 2018-02-10 09:07:34 +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 Implement trampoline and handler for typed xray event tracing. 2018-04-17 21:28:53 +00:00
xray_fdr_logging.cc Implement trampoline and handler for typed xray event tracing. 2018-04-17 21:28:53 +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 Implement trampoline and handler for typed xray event tracing. 2018-04-17 21:28:53 +00:00
xray_flags.cc [scudo] Allow options to be defined at compile time 2018-02-08 16:29:48 +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 Add Xray instrumentation support to FreeBSD 2018-02-15 14:17:15 +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 Implement trampoline and handler for typed xray event tracing. 2018-04-17 21:28:53 +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 Remove 'noexcept's that do not match between header and source file. 2018-04-24 20:33:37 +00:00
xray_interface_internal.h Implement trampoline and handler for typed xray event tracing. 2018-04-17 21:28:53 +00:00
xray_log_interface.cc [XRay][compiler-rt] Add APIs for processing logs in memory 2018-03-07 02:45:14 +00:00
xray_mips.cc [XRay][compiler-rt] Add noop patch functions for unsupported arches. 2018-04-17 23:19:23 +00:00
xray_mips64.cc [XRay][compiler-rt] Add noop patch functions for unsupported arches. 2018-04-17 23:19:23 +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] Add noop patch functions for unsupported arches. 2018-04-17 23:19:23 +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_segmented_array.h [XRay][profiler] Part 1: XRay Allocator and Array Implementations 2018-04-29 13:46:30 +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 Implement trampoline and handler for typed xray event tracing. 2018-04-17 21:28:53 +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 Implement trampoline and handler for typed xray event tracing. 2018-04-17 21:28:53 +00:00
xray_x86_64.inc Add Xray instrumentation support to FreeBSD 2018-02-15 14:17:15 +00:00