alloc tracking

This commit is contained in:
2025-12-18 14:09:39 +02:00
parent 43e1acacce
commit e4cd76fdaf
3 changed files with 27 additions and 21 deletions

View File

@@ -13,8 +13,8 @@
#define NEW_VERSION 1
#if BUILD_DEBUG
#define LONGER 1
#define CHUNK_TIMES 10
#define LONGER 3
#define CHUNK_TIMES 100
#else
#define LONGER 10
#define CHUNK_TIMES 1000
@@ -246,9 +246,9 @@ void MyScript::OnStart()
if (scriptTwo == nullptr)
return;
bool otherTests = true;
bool arrayTests = true;
bool asRefTests = true;
bool otherTests = false;
bool arrayTests = false;
bool asRefTests = false;
Array<uint64> results(TIMES);
auto CyclesToSeconds = 1.0 / static_cast<double>(Platform::GetClockFrequency());
@@ -266,6 +266,11 @@ void MyScript::OnStart()
TestStruct testStruct; testStruct.Object = actor; testStruct.SceneRef = sceneRef;
Array<TestStruct> complexArray; for (int i=0; i<10; i++) complexArray.Add(testStruct);
#if NEW_VERSION
int64 allocationsBefore, deallocationsBefore;
scriptTwo->GetStats(allocationsBefore, deallocationsBefore);
#endif
if (otherTests)
{
BENCHMARK_CALL_ARGS0(TIMES2, SimpleCall);
@@ -449,7 +454,7 @@ void MyScript::OnStart()
}
if (arrayTests)
if (true || arrayTests)
{
BENCHMARK_CALL_ARGS1(TIMES4, SimpleArrayParam, simpleArray);
BENCHMARK_THUNK_BEGIN_ARGS1(TIMES3, SimpleArrayParam);
@@ -534,6 +539,12 @@ void MyScript::OnStart()
#endif
BENCHMARK_THUNK_END();*/
}
#if NEW_VERSION
int64 allocationsAfter, deallocationsAfter;
scriptTwo->GetStats(allocationsAfter, deallocationsAfter);
LOG(Info, "Total ManagedHandle allocations: {}, deallocations: {}", allocationsAfter-allocationsBefore, deallocationsAfter-deallocationsBefore);
#endif
}
void MyScript::OnEnable()