1#ifndef MEMPROF_MIBMAP_H_
2#define MEMPROF_MIBMAP_H_
3
4#include <stdint.h>
5
6#include "profile/MemProfData.inc"
7#include "sanitizer_common/sanitizer_addrhashmap.h"
8#include "sanitizer_common/sanitizer_mutex.h"
9
10namespace __memprof {
11
12struct LockedMemInfoBlock {
13 __sanitizer::StaticSpinMutex mutex;
14 ::llvm::memprof::MemInfoBlock mib;
15};
16
17// The MIB map stores a mapping from stack ids to MemInfoBlocks.
18typedef __sanitizer::AddrHashMap<LockedMemInfoBlock *, 200003> MIBMapTy;
19
20// Insert a new MemInfoBlock or merge with an existing block identified by the
21// stack id.
22void InsertOrMerge(const uptr Id, const ::llvm::memprof::MemInfoBlock &Block,
23 MIBMapTy &Map);
24
25} // namespace __memprof
26
27#endif // MEMPROF_MIBMAP_H_
28