[PATCH] D55249: [XRay] Use preallocated memory for XRay profiling

Dean Michael Berris via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 3 21:12:52 PST 2018


dberris created this revision.
dberris added a reviewer: mboerger.
Herald added subscribers: jfb, dmgreen, mgorny, dschuff.

This change builds upon D54989 <https://reviews.llvm.org/D54989>, which removes memory allocation from the
critical path of the profiling implementation. This also changes the API
for the profile collection service, to take ownership of the memory and
associated data structures per-thread.

The consolidation of the memory allocation allows us to do two things:

- Limits the amount of memory used by the profiling implementation, associating preallocated buffers instead of allocating memory on-demand.

- Consolidate the memory initialisation and cleanup by relying on the buffer queue's reference counting implementation.

We find a number of places which also display some problematic
behaviour, including:

- Off-by-factor bug in the allocator implementation.

- Unrolling semantics in cases of "memory exhausted" situations, when managing the state of the function call trie.

We also add a few test cases which verify our understanding of the
behaviour of the system, with important edge-cases (especially for
memory-exhausted cases) in the segmented array and profile collector
unit tests.

Depends on D54989 <https://reviews.llvm.org/D54989>.


https://reviews.llvm.org/D55249

Files:
  compiler-rt/lib/xray/CMakeLists.txt
  compiler-rt/lib/xray/tests/unit/allocator_test.cc
  compiler-rt/lib/xray/tests/unit/profile_collector_test.cc
  compiler-rt/lib/xray/tests/unit/segmented_array_test.cc
  compiler-rt/lib/xray/xray_allocator.h
  compiler-rt/lib/xray/xray_function_call_trie.h
  compiler-rt/lib/xray/xray_profile_collector.cc
  compiler-rt/lib/xray/xray_profile_collector.h
  compiler-rt/lib/xray/xray_profiling.cc
  compiler-rt/lib/xray/xray_profiling_flags.inc
  compiler-rt/lib/xray/xray_segmented_array.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55249.176544.patch
Type: text/x-patch
Size: 43001 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181204/889a1c3b/attachment.bin>


More information about the llvm-commits mailing list