| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
Reapply "[MemProf] Change histogram storage from uint64_t to uint16_t… (#151431) Reapply #147854 after fixes merged in #151398. Change memory access histogram storage from uint64_t to uint16_t to reduce profile size on disk. This change updates the raw profile format to v5. Also add a histogram test in compiler-rt since we didn't have one before. With this change the histogram memprof raw for the basic test reduces from 75KB -> 20KB. | 1 年前 | |
[compiler-rt] Remove 'memprof_meminfoblock.h' from MEMPROF_HEADERS (NFC) (#95334) Commit 8306968b592d942cc49bde2e387061e673a9fbb7 deleted file compiler-rt/lib/memprof/memprof_meminfoblock.h, but didn't remove it from MEMPROF_HEADERS in compiler-rt/lib/memprof/CMakeLists.txt. Remove unneeded leftover line in compiler-rt/lib/memprof/CMakeLists.txt. p.s. GH #54777 reported a llvm14 build failure due to the existence of the leftover line, but I'm unable to reproduce the build failure with llvm19 trunk. | 2 年前 | |
[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 | 5 年前 | |
[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 | 5 年前 | |
[MemProf] Use correct print_text value (#125793) | 1 年前 | |
[memprof] Switch allocator to dynamic base address (#98510) memprof_rtl.cpp calls InitializeShadowMemory() - which dynamically/"randomly" chooses a base address for the shadow mapping - prior to InitializeAllocator(). If we are unlucky, the shadow memory may be mapped in the same region where the allocator wants to be. This patch fixes the issue by changing the allocator to dynamically choosing a base address, as suggested by Vitaly. For comparison, HWASan already dynamically chooses the base addresses for the shadow mapping and allocator. The "unlucky" failure was observed on a new buildbot: https://lab.llvm.org/buildbot/#/builders/66/builds/1361/steps/17/logs/stdio --------- Co-authored-by: Vitaly Buka <vitalybuka@gmail.com> | 2 年前 | |
[Sanitizer][NFC] Replaces a few InternalScopedString::AppendF with InternalScopedString::Append (#80574) | 2 年前 | |
[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 | 5 年前 | |
[memprof] Use -memprof-runtime-default-options to set options during compile time (#118874) Add the __memprof_default_options_str variable, initialized via the -memprof-runtime-default-options LLVM flag, to hold the default options string for memprof. This allows us to set these options during compile time in the clang invocation. Also update the docs to describe the various ways to set these options. | 1 年前 | |
Fix some small typos in compiler-rt. NFC (#133388) | 1 年前 | |
[memprof] Add flag to control profile dump at exit (#119452) Add the dump_at_exit flag to control whether or not profiles should be dumped when the program exits. Since we can call __memprof_profile_dump() directly, we don't necessarily need to dump profiles at exit. | 1 年前 | |
[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 | 5 年前 | |
| 1 年前 | ||
[sanitizer] Replace uptr by usize/SIZE_T in interfaces For some targets uptr is mapped to unsigned int and size_t to unsigned long and sizeof(int)==sizeof(long) holds. Still, these are distinct types and type checking may fail. Therefore, replace uptr by usize/SIZE_T wherever a size_t is expected. Part of #116957 | 1 年前 | |
[compiler-rt] Avoid memintrinsic calls inserted by the compiler D135716 introduced -ftrivial-auto-var-init=pattern where supported. Unfortunately this introduces unwanted memset() for large stack arrays, as shown by the new tests added for asan and msan (tsan already had this test). In general, the problem of compiler-inserted memintrinsic calls (memset/memcpy/memmove) is not new to compiler-rt, and has been a problem before. To avoid introducing unwanted memintrinsic calls, we redefine memintrinsics as __sanitizer_internal_mem* at the assembly level for most source files automatically (where sanitizer_common_internal_defs.h is included). In few cases, redefining a symbol in this way causes issues for interceptors, namely the memintrinsic interceptor themselves. For such source files we have to selectively disable the redefinition. Other alternatives have been considered, but simply do not work well in the context of compiler-rt: 1. Linker --wrap: this does not work because --wrap only applies to the final link, and would not apply when building sanitizer static libraries. 2. Changing references to memset() via objcopy: this may work, but due to the complexities of the build system, introducing such a post-processing step for the right object files (in particular object files defining memset cannot be touched) seems infeasible. The chosen solution works well (as shown by the tests). Other libraries have chosen the same solution where nothing else works (see e.g. glibc's "symbol-hacks.h"). v4: - Add interface attribute to __sanitizer_internal_mem* declarations as well, as otherwise some compilers (MSVC) will complain. - Add SANITIZER_COMMON_NO_REDEFINE_BUILTINS to source files using C++STL, since this could lead to ODR violations (see added comment). v3: - Don't use ALIAS() to alias internal_mem*() functions to __sanitizer_internal_mem*() functions, but just define them as ALWAYS_INLINE functions instead. This will work on darwin and windows. v2: - Fix ubsan_minimal build where compiler decides to insert memset/memcpy: ubsan_minimal has work without RTSanitizerCommonLibc, therefore do not redefine the builtins. - Fix definition of internal_mem* functions with compilers that want the aliased function to already be defined before. - Fix definition of __sanitizer_internal_mem* functions with compilers more pedantic about attribute placement around extern "C". Reviewed By: vitalybuka, dvyukov Differential Revision: https://reviews.llvm.org/D151152 | 3 年前 | |
[sanitizer] Replace uptr by usize/SIZE_T in interfaces For some targets uptr is mapped to unsigned int and size_t to unsigned long and sizeof(int)==sizeof(long) holds. Still, these are distinct types and type checking may fail. Therefore, replace uptr by usize/SIZE_T wherever a size_t is expected. Part of #116957 | 1 年前 | |
[MemProf] Add sanitizer interface decls for histogram funcs. (#151398) Add the necessary sanitizer interface decls required when the memprof runtime is built in dynamic mode. This was a latent issue since we didn't add tests for the histogram feature in compiler-rt. These tests are run with ninja check-memprof-dynamic. I discovered this after the CI failures for #147854. | 1 年前 | |
[sanitizer] Lift AsanDoesNotSupportStaticLinkage to sanitizer_common.h. NFC (#80948) The _DYNAMIC reference from AsanDoesNotSupportStaticLinkage ensures that clang++ -fsanitize=address -static gets a linker error. MemprofDoesNotSupportStaticLinkage is similar for -fmemory-profile. Move the functions to sanitizer_common.h to be used by more sanitizers on ELF platforms. Fuchsia does not use interposition and opts out the check (its AsanDoesNotSupportStaticLinkage is a no-op). | 2 年前 | |
Reapply "[HWASan] [compiler-rt] support non-4k pages on Android" (#95853) Updated MapDynamicShadow callsite in asan_win. | 2 年前 | |
[compiler-rt][memprof] adding free_sized/free_aligned_sized intercept… (#154011) …ions. | 11 个月前 | |
[Memprof] Changes HISTOGRAM_GRANULARITY from 8U to 8ULL. (#100949) This changes a bug in memprofiling with histogram where the shadow mask would be 0xFFFFFFF8 instead of 0xFFFFFFFFFFFFFFF8, essentially discarding the upper 32 bits of the address. This can cause different addresses to be mapped to the same shadow address. | 2 年前 | |
[Memprof] Adds the option to collect AccessCountHistograms for memprof. (#94264) Adds compile time flag -mllvm -memprof-histogram and runtime flag histogram=true|false to turn Histogram collection on and off. The -memprof-histogram flag relies on -memprof-use-callbacks=true to work. Updates shadow mapping logic in histogram mode from having one 8 byte counter for 64 bytes, to 1 byte for 8 bytes, capped at 255. Only supports this granularity as of now. Updates the RawMemprofReader and serializing MemoryInfoBlocks to binary format, including changing to a new version of the raw binary format from version 3 to version 4. Updates creating MemoryInfoBlocks with and without Histograms. When two MemoryInfoBlocks are merged, AccessCounts are summed up and the shorter Histogram is removed. Adds a memprof_histogram test case. Initial commit for adding AccessCountHistograms up until RawProfile for memprof | 2 年前 | |
[memprof] Move the meminfo block struct to MemProfData.inc. The definition of the MemInfoBlock is shared between the memprof compiler-rt runtime and llvm/lib/ProfileData/. This change removes the memprof_meminfoblock header and moves the struct to the shared include file. To enable this sharing, the Print method is moved to the memprof_allocator (the only place it is used) and the remaining uses are updated to refer to the MemInfoBlock defined in the MemProfData.inc file. Also a couple of other minor changes which improve usability of the types in MemProfData.inc. * Update the PACKED macro to handle commas. * Add constructors and equality operators. * Don't initialize the buildid field. Differential Revision: https://reviews.llvm.org/D116780 | 4 年前 | |
[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 | 5 年前 | |
[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 | 5 年前 | |
[sanitizer] Internalize .preinit_array variables We can use an internal linkage variable to make it clear the variable is not exported. The special section .preinit_array is a GC root. Pull Request: https://github.com/llvm/llvm-project/pull/98584 | 2 年前 | |
[MemProf] Write out raw profile bytes in little endian. (#150375) Instead of writing out in native endian, write out the raw profile bytes in little endian. Also update the MIB data in little endian. Also clean up some lint and unused includes in rawprofile.cpp. | 1 年前 | |
[NFC][sanitizer] Move ArrayRef into own header | 3 年前 | |
[sanitizer_common] Drop remaining support for Android 5 or older (#146187) Dependent on https://github.com/llvm/llvm-project/pull/145227 | 1 年前 | |
| 11 个月前 | ||
[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 | 5 年前 | |
[compiler-rt] [Memprof] leave BufferedStackTrace uninit Otherwise we have to memset 2040 bytes (255 * 8) for each call Pull Request: https://github.com/llvm/llvm-project/pull/102256 | 2 年前 | |
[NFC][sanitizer] Return StackDepotStats by value Differential Revision: https://reviews.llvm.org/D110644 | 4 年前 | |
[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 | 5 年前 | |
[sanitizer_common][nfc] Rename tid_t to avoid conflicting declarations (#149011) tid_t is also defined in the AIX header /usr/include/sys/types.h which is included by system pthread.h. The use of tid_t by AIX is conforming according to [POSIX](https://pubs.opengroup.org/onlinepubs/9799919799/functions/V2_chap02.html): > Implementations may add symbols to the headers shown in the following table [ ... ] | 1 年前 | |
[sanitizer_common][nfc] Rename tid_t to avoid conflicting declarations (#149011) tid_t is also defined in the AIX header /usr/include/sys/types.h which is included by system pthread.h. The use of tid_t by AIX is conforming according to [POSIX](https://pubs.opengroup.org/onlinepubs/9799919799/functions/V2_chap02.html): > Implementations may add symbols to the headers shown in the following table [ ... ] | 1 年前 | |
[memprof] Use -memprof-runtime-default-options to set options during compile time (#118874) Add the __memprof_default_options_str variable, initialized via the -memprof-runtime-default-options LLVM flag, to hold the default options string for memprof. This allows us to set these options during compile time in the clang invocation. Also update the docs to describe the various ways to set these options. | 1 年前 |
MemProfiling RT
This directory contains sources of the MemProfiling (MemProf) runtime library.
Directory structure: README.txt : This file. CMakeLists.txt : File for cmake-based build. memprof_*.{cc,h} : Sources of the memprof runtime library.
Also MemProf runtime needs the following libraries: lib/interception/ : Machinery used to intercept function calls. lib/sanitizer_common/ : Code shared between various sanitizers.
MemProf runtime can only be built by CMake. You can run MemProf tests from the root of your CMake build tree:
make check-memprof