aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/clang18-rt/lib/memprof/memprof_mibmap.h
blob: a7cd420464e8b57fa65b64049f3b762e357c95db (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#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_