1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 03:28:20 +02:00
Beef/IDEHelper/HotHeap.h

46 lines
920 B
C
Raw Normal View History

2019-08-23 11:56:54 -07:00
#pragma once
#include "DebugCommon.h"
#include "BeefySysLib/util/Dictionary.h"
#include "BeefySysLib/util/Array.h"
NS_BF_DBG_BEGIN
class HotHeap
{
public:
enum HotUseFlags
{
HotUseFlags_None,
HotUseFlags_Allocated,
HotUseFlags_Referenced
};
public:
static const int BLOCK_SIZE = 4096;
2022-07-30 09:11:38 -04:00
2019-08-23 11:56:54 -07:00
addr_target mHotAreaStart;
int mHotAreaSize;
2022-07-30 09:11:38 -04:00
Beefy::Array<HotUseFlags> mHotAreaUsed;
2019-08-23 11:56:54 -07:00
int mCurBlockIdx;
int mBlockAllocIdx; // Total blocks allocated, doesn't decrease with frees
Beefy::Dictionary<addr_target, int> mTrackedMap;
public:
HotHeap(addr_target hotStart, int size);
HotHeap();
2022-07-30 09:11:38 -04:00
2019-08-23 11:56:54 -07:00
void AddTrackedRegion(addr_target hotStart, int size);
2022-07-30 09:11:38 -04:00
2019-08-23 11:56:54 -07:00
addr_target Alloc(int size);
void Release(addr_target addr, int size);
void MarkBlockReferenced(addr_target addr);
bool IsReferenced(addr_target addr, int size);
bool IsBlockUsed();
void ClearReferencedFlags();
intptr_target GetUsedSize();
};
NS_BF_DBG_END