wavelength 1.0.0
Loading...
Searching...
No Matches
blockstattable.h
Go to the documentation of this file.
1#pragma once
2
3#include <stddef.h>
4
5#include "os/prnstream.h"
6
8struct BlockStat {
9 const char *mName;
14};
15
22public:
24 static constexpr int kCapacity = 1024;
25
33 explicit BlockStatTable(int bSeparateSizes);
34
41 static void *operator new(size_t nSize);
42
46 static void operator delete(void *) noexcept {
47 }
48
55 void Clear();
56
65 BlockStat *GetStat(int nIndex);
66
78 void Update(const char *pszName, int nRequested, int nActual);
79
86 void SortBySize();
87
94 void SortByName();
95
107 static void PrintDelta(PrnStream &stream, BlockStatTable *pCurrent, BlockStatTable *pPrevious);
108
110 int GetCount() const {
111 return mCount;
112 }
113
114private:
115 // Order rows by bytes handed out, largest first, with equal rows in either order.
116 // NTSC-U/C: 0x0029c770, PAL: 0x002a6398
117 static bool SizeNotLess(const BlockStat &first, const BlockStat &second);
118
119 // Order rows by tag.
120 // NTSC-U/C: 0x0029c788, PAL: 0x002a63b0
121 static bool NameLess(const BlockStat &first, const BlockStat &second);
122
123 BlockStat mStats[kCapacity];
124 int mCapacity;
125 int mCount;
126 int mSeparateSizes;
127};
void SortBySize()
Sort the rows by bytes handed out, largest first.
BlockStatTable(int bSeparateSizes)
Construct an empty table.
static void PrintDelta(PrnStream &stream, BlockStatTable *pCurrent, BlockStatTable *pPrevious)
Write the differences between the rows of two tables sorted by tag.
void Update(const char *pszName, int nRequested, int nActual)
Add an allocation to the row of its tag, adding the row when the tag is new.
int GetCount() const
Definition blockstattable.h:110
BlockStat * GetStat(int nIndex)
Report a row.
void Clear()
Empty the table.
void SortByName()
Sort the rows by tag.
static constexpr int kCapacity
The rows a table has room for.
Definition blockstattable.h:24
Text output stream.
Definition prnstream.h:16
Totals of the tracked allocations of one tag.
Definition blockstattable.h:8
int mMaxRequested
Definition blockstattable.h:12
const char * mName
Definition blockstattable.h:9
int mSizeActual
Definition blockstattable.h:11
int mNumAllocs
Definition blockstattable.h:13
int mSizeRequested
Definition blockstattable.h:10