2021-10-12 06:03:29 +08:00
|
|
|
#ifndef MEMPROF_MIBMAP_H_
|
|
|
|
#define MEMPROF_MIBMAP_H_
|
|
|
|
|
2021-12-30 07:31:11 +08:00
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
#include "profile/MemProfData.inc"
|
2021-10-12 06:03:29 +08:00
|
|
|
#include "sanitizer_common/sanitizer_addrhashmap.h"
|
|
|
|
#include "sanitizer_common/sanitizer_mutex.h"
|
|
|
|
|
|
|
|
namespace __memprof {
|
|
|
|
|
|
|
|
struct LockedMemInfoBlock {
|
|
|
|
__sanitizer::StaticSpinMutex mutex;
|
2021-12-30 07:31:11 +08:00
|
|
|
::llvm::memprof::MemInfoBlock mib;
|
2021-10-12 06:03:29 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
// 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.
|
2021-12-30 07:31:11 +08:00
|
|
|
void InsertOrMerge(const uptr Id, const ::llvm::memprof::MemInfoBlock &Block,
|
|
|
|
MIBMapTy &Map);
|
2021-10-12 06:03:29 +08:00
|
|
|
|
|
|
|
} // namespace __memprof
|
|
|
|
|
|
|
|
#endif // MEMPROF_MIBMAP_H_
|