[all-commits] [llvm/llvm-project] 3d4bba: [MemProf] Memory profiling runtime support

Teresa Johnson via All-commits all-commits at lists.llvm.org
Fri Oct 16 09:47:30 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 3d4bba302d2460b9ac6463ef920c301f1f40fb41
      https://github.com/llvm/llvm-project/commit/3d4bba302d2460b9ac6463ef920c301f1f40fb41
  Author: Teresa Johnson <tejohnson at google.com>
  Date:   2020-10-16 (Fri, 16 Oct 2020)

  Changed paths:
    M compiler-rt/CMakeLists.txt
    M compiler-rt/cmake/config-ix.cmake
    M compiler-rt/include/CMakeLists.txt
    A compiler-rt/include/sanitizer/memprof_interface.h
    M compiler-rt/lib/CMakeLists.txt
    A compiler-rt/lib/memprof/CMakeLists.txt
    A compiler-rt/lib/memprof/README.txt
    A compiler-rt/lib/memprof/memprof.syms.extra
    A compiler-rt/lib/memprof/memprof_allocator.cpp
    A compiler-rt/lib/memprof/memprof_allocator.h
    A compiler-rt/lib/memprof/memprof_descriptions.cpp
    A compiler-rt/lib/memprof/memprof_descriptions.h
    A compiler-rt/lib/memprof/memprof_flags.cpp
    A compiler-rt/lib/memprof/memprof_flags.h
    A compiler-rt/lib/memprof/memprof_flags.inc
    A compiler-rt/lib/memprof/memprof_init_version.h
    A compiler-rt/lib/memprof/memprof_interceptors.cpp
    A compiler-rt/lib/memprof/memprof_interceptors.h
    A compiler-rt/lib/memprof/memprof_interceptors_memintrinsics.cpp
    A compiler-rt/lib/memprof/memprof_interceptors_memintrinsics.h
    A compiler-rt/lib/memprof/memprof_interface_internal.h
    A compiler-rt/lib/memprof/memprof_internal.h
    A compiler-rt/lib/memprof/memprof_linux.cpp
    A compiler-rt/lib/memprof/memprof_malloc_linux.cpp
    A compiler-rt/lib/memprof/memprof_mapping.h
    A compiler-rt/lib/memprof/memprof_new_delete.cpp
    A compiler-rt/lib/memprof/memprof_posix.cpp
    A compiler-rt/lib/memprof/memprof_preinit.cpp
    A compiler-rt/lib/memprof/memprof_rtl.cpp
    A compiler-rt/lib/memprof/memprof_shadow_setup.cpp
    A compiler-rt/lib/memprof/memprof_stack.cpp
    A compiler-rt/lib/memprof/memprof_stack.h
    A compiler-rt/lib/memprof/memprof_stats.cpp
    A compiler-rt/lib/memprof/memprof_stats.h
    A compiler-rt/lib/memprof/memprof_thread.cpp
    A compiler-rt/lib/memprof/memprof_thread.h
    A compiler-rt/lib/memprof/weak_symbols.txt
    M compiler-rt/lib/sanitizer_common/sanitizer_allocator_report.cpp
    M compiler-rt/lib/sanitizer_common/sanitizer_allocator_report.h
    M compiler-rt/lib/sanitizer_common/sanitizer_flags.inc
    M compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h
    M compiler-rt/test/CMakeLists.txt
    M compiler-rt/test/lit.common.cfg.py
    M compiler-rt/test/lit.common.configured.in
    A compiler-rt/test/memprof/CMakeLists.txt
    A compiler-rt/test/memprof/TestCases/atexit_stats.cpp
    A compiler-rt/test/memprof/TestCases/default_options.cpp
    A compiler-rt/test/memprof/TestCases/dump_process_map.cpp
    A compiler-rt/test/memprof/TestCases/free_hook_realloc.cpp
    A compiler-rt/test/memprof/TestCases/interface_test.cpp
    A compiler-rt/test/memprof/TestCases/log_path_test.cpp
    A compiler-rt/test/memprof/TestCases/malloc-size-too-big.cpp
    A compiler-rt/test/memprof/TestCases/malloc_hook.cpp
    A compiler-rt/test/memprof/TestCases/mem_info_cache_entries.cpp
    A compiler-rt/test/memprof/TestCases/memprof_options-help.cpp
    A compiler-rt/test/memprof/TestCases/print_miss_rate.cpp
    A compiler-rt/test/memprof/TestCases/realloc.cpp
    A compiler-rt/test/memprof/TestCases/stress_dtls.c
    A compiler-rt/test/memprof/TestCases/test_malloc_load_store.c
    A compiler-rt/test/memprof/TestCases/test_memintrin.cpp
    A compiler-rt/test/memprof/TestCases/test_new_load_store.cpp
    A compiler-rt/test/memprof/TestCases/test_terse.cpp
    A compiler-rt/test/memprof/TestCases/unaligned_loads_and_stores.cpp
    A compiler-rt/test/memprof/lit.cfg.py
    A compiler-rt/test/memprof/lit.site.cfg.py.in

  Log Message:
  -----------
  [MemProf] Memory profiling runtime support

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
and committed earlier.

This patch adds the compiler-rt runtime support for the memory
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 memory profiling specific code can be found in the
MemInfoBlock, MemInfoBlockCache, and related classes defined and used
in memprof_allocator.cpp.

For now, the memory 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.

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

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




More information about the All-commits mailing list