[memprof] Add a raw binary format to serialize memprof profiles.
authorSnehasish Kumar <snehasishk@google.com>
Tue, 12 Oct 2021 18:30:23 +0000 (11:30 -0700)
committerSnehasish Kumar <snehasishk@google.com>
Thu, 11 Nov 2021 19:29:36 +0000 (11:29 -0800)
commit545866cb05b90329fc61f361c6afffedb3aaf938
tree219802131a140b3c9efe95b603dd35f8a368f103
parent1243cef245f6131c093d65235e87319e8e124e7f
[memprof] Add a raw binary format to serialize memprof profiles.

This change implements the raw binary format discussed in
https://lists.llvm.org/pipermail/llvm-dev/2021-September/153007.html

Summary of changes
* Add a new memprof option to choose binary or text (default) format.
* Add a rawprofile library which serializes the MIB map to profile.
* Add a unit test for rawprofile.
* Mark sanitizer procmaps methods as virtual to be able to mock them.
* Extend memprof_profile_dump regression test.

Differential Revision: https://reviews.llvm.org/D113317
compiler-rt/lib/memprof/CMakeLists.txt
compiler-rt/lib/memprof/memprof_allocator.cpp
compiler-rt/lib/memprof/memprof_flags.inc
compiler-rt/lib/memprof/memprof_rawprofile.cpp [new file with mode: 0644]
compiler-rt/lib/memprof/memprof_rawprofile.h [new file with mode: 0644]
compiler-rt/lib/memprof/tests/CMakeLists.txt [new file with mode: 0644]
compiler-rt/lib/memprof/tests/driver.cpp [new file with mode: 0644]
compiler-rt/lib/memprof/tests/rawprofile.cpp [new file with mode: 0644]
compiler-rt/lib/sanitizer_common/sanitizer_procmaps.h
compiler-rt/test/memprof/TestCases/memprof_profile_dump.cpp