wavelength 1.0.0
Loading...
Searching...
No Matches
allocinfo.h
Go to the documentation of this file.
1#pragma once
2
3#include "os/prnstream.h"
4
11class AllocInfo {
12public:
14 static constexpr int kStackSize = 24;
15
23
31 void Print(PrnStream &stream) const;
32
44 static bool Less(const AllocInfo *pFirst, const AllocInfo *pSecond);
45
47 int GetSizeRequested() const {
48 return mSizeRequested;
49 }
50
52 void SetSizeRequested(int nSizeRequested) {
53 mSizeRequested = nSizeRequested;
54 }
55
57 int GetSizeActual() const {
58 return mSizeActual;
59 }
60
62 void SetSizeActual(int nSizeActual) {
63 mSizeActual = nSizeActual;
64 }
65
67 const char *GetTag() const {
68 return mTag;
69 }
70
72 void SetTag(const char *pszTag) {
73 mTag = pszTag;
74 }
75
77 const char *GetPoolTag() const {
78 return mPoolTag;
79 }
80
82 void SetPoolTag(const char *pszPoolTag) {
83 mPoolTag = pszPoolTag;
84 }
85
87 int GetPoolSize() const {
88 return mPoolSize;
89 }
90
92 void SetPoolSize(int nPoolSize) {
93 mPoolSize = nPoolSize;
94 }
95
96private:
97 int mSizeRequested;
98 int mSizeActual;
99 const char *mTag;
100 unsigned int mStack[kStackSize];
101 const char *mPoolTag;
102 int mPoolSize;
103};
Record of one tracked allocation: its sizes, its tags, and the call stack that made it.
Definition allocinfo.h:11
int GetSizeActual() const
Definition allocinfo.h:57
void SetTag(const char *pszTag)
Definition allocinfo.h:72
const char * GetPoolTag() const
Definition allocinfo.h:77
static constexpr int kStackSize
The return addresses a record stores.
Definition allocinfo.h:14
void SetSizeActual(int nSizeActual)
Definition allocinfo.h:62
void CaptureStack()
Record the return addresses of the caller's caller and the callers above it.
const char * GetTag() const
Definition allocinfo.h:67
void Print(PrnStream &stream) const
Write the tag, the size, and the call stack of the record.
void SetPoolTag(const char *pszPoolTag)
Definition allocinfo.h:82
void SetPoolSize(int nPoolSize)
Definition allocinfo.h:92
int GetSizeRequested() const
Definition allocinfo.h:47
int GetPoolSize() const
Definition allocinfo.h:87
static bool Less(const AllocInfo *pFirst, const AllocInfo *pSecond)
Order records by size, pool size, call stack, tag, and pool tag.
void SetSizeRequested(int nSizeRequested)
Definition allocinfo.h:52
Text output stream.
Definition prnstream.h:16