8306968b59
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
28 lines
737 B
C++
28 lines
737 B
C++
#ifndef MEMPROF_MIBMAP_H_
|
|
#define MEMPROF_MIBMAP_H_
|
|
|
|
#include <stdint.h>
|
|
|
|
#include "profile/MemProfData.inc"
|
|
#include "sanitizer_common/sanitizer_addrhashmap.h"
|
|
#include "sanitizer_common/sanitizer_mutex.h"
|
|
|
|
namespace __memprof {
|
|
|
|
struct LockedMemInfoBlock {
|
|
__sanitizer::StaticSpinMutex mutex;
|
|
::llvm::memprof::MemInfoBlock mib;
|
|
};
|
|
|
|
// The MIB map stores a mapping from stack ids to MemInfoBlocks.
|
|
typedef __sanitizer::AddrHashMap<LockedMemInfoBlock *, 200003> MIBMapTy;
|
|
|
|
// Insert a new MemInfoBlock or merge with an existing block identified by the
|
|
// stack id.
|
|
void InsertOrMerge(const uptr Id, const ::llvm::memprof::MemInfoBlock &Block,
|
|
MIBMapTy &Map);
|
|
|
|
} // namespace __memprof
|
|
|
|
#endif // MEMPROF_MIBMAP_H_
|