[PATCH] D87120: [HeapProf] Heap profiling runtime support

Teresa Johnson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 3 17:26:16 PDT 2020


tejohnson created this revision.
tejohnson added reviewers: davidxl, vitalybuka, kcc, eugenis.
Herald added subscribers: Sanitizers, jfb, krytarowski, mgorny.
Herald added a project: Sanitizers.
tejohnson requested review of this revision.

See RFC for background:
http://lists.llvm.org/pipermail/llvm-dev/2020-June/142744.html

Follow on companion to the clang/llvm instrumentation support in D85948 <https://reviews.llvm.org/D85948>
and committed earlier.

This patch adds the compiler-rt runtime support for the heap profiling.

Note that much of this support was cloned from asan (and then greatly
simplified and renamed). For example the interactions with the
sanitizer_common allocators, error handling, interception, etc.

The bulk of the heap profiling specific code can be found in the
HeapInfoBlock, HeapInfoBlockCache, and related classes defined and used
in heapprof_allocator.cpp.

For now, the heap profile is dumped to text (stderr by default, but
honors the sanitizer_common log_path flag). It is dumped in either a
default verbose format, or an optional terse format.

I have kept some of the same error handling as in asan, such as for
general memory allocation issues like OOM, but removed the error
handling relating to asan specific errors.

This patch also adds a set of tests for the core functionality.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D87120

Files:
  compiler-rt/CMakeLists.txt
  compiler-rt/cmake/config-ix.cmake
  compiler-rt/include/CMakeLists.txt
  compiler-rt/include/sanitizer/heapprof_interface.h
  compiler-rt/lib/CMakeLists.txt
  compiler-rt/lib/heapprof/CMakeLists.txt
  compiler-rt/lib/heapprof/README.txt
  compiler-rt/lib/heapprof/heapprof.syms.extra
  compiler-rt/lib/heapprof/heapprof_allocator.cpp
  compiler-rt/lib/heapprof/heapprof_allocator.h
  compiler-rt/lib/heapprof/heapprof_descriptions.cpp
  compiler-rt/lib/heapprof/heapprof_descriptions.h
  compiler-rt/lib/heapprof/heapprof_errors.cpp
  compiler-rt/lib/heapprof/heapprof_errors.h
  compiler-rt/lib/heapprof/heapprof_flags.cpp
  compiler-rt/lib/heapprof/heapprof_flags.h
  compiler-rt/lib/heapprof/heapprof_flags.inc
  compiler-rt/lib/heapprof/heapprof_init_version.h
  compiler-rt/lib/heapprof/heapprof_interceptors.cpp
  compiler-rt/lib/heapprof/heapprof_interceptors.h
  compiler-rt/lib/heapprof/heapprof_interceptors_memintrinsics.cpp
  compiler-rt/lib/heapprof/heapprof_interceptors_memintrinsics.h
  compiler-rt/lib/heapprof/heapprof_interface.inc
  compiler-rt/lib/heapprof/heapprof_interface_internal.h
  compiler-rt/lib/heapprof/heapprof_internal.h
  compiler-rt/lib/heapprof/heapprof_linux.cpp
  compiler-rt/lib/heapprof/heapprof_malloc_linux.cpp
  compiler-rt/lib/heapprof/heapprof_mapping.h
  compiler-rt/lib/heapprof/heapprof_new_delete.cpp
  compiler-rt/lib/heapprof/heapprof_posix.cpp
  compiler-rt/lib/heapprof/heapprof_preinit.cpp
  compiler-rt/lib/heapprof/heapprof_report.cpp
  compiler-rt/lib/heapprof/heapprof_report.h
  compiler-rt/lib/heapprof/heapprof_rtl.cpp
  compiler-rt/lib/heapprof/heapprof_shadow_setup.cpp
  compiler-rt/lib/heapprof/heapprof_stack.cpp
  compiler-rt/lib/heapprof/heapprof_stack.h
  compiler-rt/lib/heapprof/heapprof_stats.cpp
  compiler-rt/lib/heapprof/heapprof_stats.h
  compiler-rt/lib/heapprof/heapprof_thread.cpp
  compiler-rt/lib/heapprof/heapprof_thread.h
  compiler-rt/lib/heapprof/weak_symbols.txt
  compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h
  compiler-rt/lib/sanitizer_common/sanitizer_libc.h
  compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp
  compiler-rt/lib/sanitizer_common/sanitizer_stackdepot.cpp
  compiler-rt/lib/sanitizer_common/sanitizer_stackdepot.h
  compiler-rt/lib/sanitizer_common/sanitizer_stackdepotbase.h
  compiler-rt/test/CMakeLists.txt
  compiler-rt/test/heapprof/CMakeLists.txt
  compiler-rt/test/heapprof/TestCases/atexit_stats.cpp
  compiler-rt/test/heapprof/TestCases/default_options.cpp
  compiler-rt/test/heapprof/TestCases/dump_process_map.cpp
  compiler-rt/test/heapprof/TestCases/free_hook_realloc.cpp
  compiler-rt/test/heapprof/TestCases/function-sections-are-bad.cpp
  compiler-rt/test/heapprof/TestCases/heap_info_cache_entries.cpp
  compiler-rt/test/heapprof/TestCases/heapprof_options-help.cpp
  compiler-rt/test/heapprof/TestCases/interface_test.cpp
  compiler-rt/test/heapprof/TestCases/log_path_test.cpp
  compiler-rt/test/heapprof/TestCases/malloc-size-too-big.cpp
  compiler-rt/test/heapprof/TestCases/on_error_callback.cpp
  compiler-rt/test/heapprof/TestCases/print_miss_rate.cpp
  compiler-rt/test/heapprof/TestCases/realloc.cpp
  compiler-rt/test/heapprof/TestCases/sleep_after_init.c
  compiler-rt/test/heapprof/TestCases/sleep_before_dying.c
  compiler-rt/test/heapprof/TestCases/test_malloc_load_store.c
  compiler-rt/test/heapprof/TestCases/test_memintrin.cpp
  compiler-rt/test/heapprof/TestCases/test_new_load_store.cpp
  compiler-rt/test/heapprof/TestCases/test_terse.cpp
  compiler-rt/test/heapprof/lit.cfg.py
  compiler-rt/test/heapprof/lit.site.cfg.py.in
  compiler-rt/test/lit.common.cfg.py
  compiler-rt/test/lit.common.configured.in

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87120.289838.patch
Type: text/x-patch
Size: 223323 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200904/711886b0/attachment-0001.bin>


More information about the llvm-commits mailing list