alloc tracking
This commit is contained in:
@@ -13,8 +13,8 @@
|
|||||||
#define NEW_VERSION 1
|
#define NEW_VERSION 1
|
||||||
|
|
||||||
#if BUILD_DEBUG
|
#if BUILD_DEBUG
|
||||||
#define LONGER 1
|
#define LONGER 3
|
||||||
#define CHUNK_TIMES 10
|
#define CHUNK_TIMES 100
|
||||||
#else
|
#else
|
||||||
#define LONGER 10
|
#define LONGER 10
|
||||||
#define CHUNK_TIMES 1000
|
#define CHUNK_TIMES 1000
|
||||||
@@ -246,9 +246,9 @@ void MyScript::OnStart()
|
|||||||
if (scriptTwo == nullptr)
|
if (scriptTwo == nullptr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool otherTests = true;
|
bool otherTests = false;
|
||||||
bool arrayTests = true;
|
bool arrayTests = false;
|
||||||
bool asRefTests = true;
|
bool asRefTests = false;
|
||||||
|
|
||||||
Array<uint64> results(TIMES);
|
Array<uint64> results(TIMES);
|
||||||
auto CyclesToSeconds = 1.0 / static_cast<double>(Platform::GetClockFrequency());
|
auto CyclesToSeconds = 1.0 / static_cast<double>(Platform::GetClockFrequency());
|
||||||
@@ -266,6 +266,11 @@ void MyScript::OnStart()
|
|||||||
TestStruct testStruct; testStruct.Object = actor; testStruct.SceneRef = sceneRef;
|
TestStruct testStruct; testStruct.Object = actor; testStruct.SceneRef = sceneRef;
|
||||||
Array<TestStruct> complexArray; for (int i=0; i<10; i++) complexArray.Add(testStruct);
|
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)
|
if (otherTests)
|
||||||
{
|
{
|
||||||
BENCHMARK_CALL_ARGS0(TIMES2, SimpleCall);
|
BENCHMARK_CALL_ARGS0(TIMES2, SimpleCall);
|
||||||
@@ -449,7 +454,7 @@ void MyScript::OnStart()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (arrayTests)
|
if (true || arrayTests)
|
||||||
{
|
{
|
||||||
BENCHMARK_CALL_ARGS1(TIMES4, SimpleArrayParam, simpleArray);
|
BENCHMARK_CALL_ARGS1(TIMES4, SimpleArrayParam, simpleArray);
|
||||||
BENCHMARK_THUNK_BEGIN_ARGS1(TIMES3, SimpleArrayParam);
|
BENCHMARK_THUNK_BEGIN_ARGS1(TIMES3, SimpleArrayParam);
|
||||||
@@ -534,6 +539,12 @@ void MyScript::OnStart()
|
|||||||
#endif
|
#endif
|
||||||
BENCHMARK_THUNK_END();*/
|
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()
|
void MyScript::OnEnable()
|
||||||
|
|||||||
@@ -10,20 +10,6 @@
|
|||||||
#include "Engine/Scripting/SoftTypeReference.h"
|
#include "Engine/Scripting/SoftTypeReference.h"
|
||||||
#include "Engine/Content/SceneReference.h"
|
#include "Engine/Content/SceneReference.h"
|
||||||
|
|
||||||
API_ENUM() enum TestTypeEnum
|
|
||||||
{
|
|
||||||
None,
|
|
||||||
Value1,
|
|
||||||
Value22,
|
|
||||||
};
|
|
||||||
|
|
||||||
/*template<typename T>
|
|
||||||
API_STRUCT() struct GAME_API MyThinger
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
T fieldo;
|
|
||||||
};*/
|
|
||||||
|
|
||||||
API_STRUCT(NoDefault) struct TestStruct : public ISerializable
|
API_STRUCT(NoDefault) struct TestStruct : public ISerializable
|
||||||
{
|
{
|
||||||
API_AUTO_SERIALIZATION();
|
API_AUTO_SERIALIZATION();
|
||||||
@@ -52,8 +38,10 @@ API_CLASS() class GAME_API MyScript2 : public Script
|
|||||||
API_AUTO_SERIALIZATION();
|
API_AUTO_SERIALIZATION();
|
||||||
DECLARE_SCRIPTING_TYPE(MyScript2);
|
DECLARE_SCRIPTING_TYPE(MyScript2);
|
||||||
|
|
||||||
|
API_FUNCTION() virtual void GetStats(API_PARAM(Ref) int64& allocations, API_PARAM(Ref) int64& deallocations) {};
|
||||||
|
|
||||||
API_FUNCTION() virtual void SimpleCall() {};
|
API_FUNCTION() virtual void SimpleCall() {};
|
||||||
API_FUNCTION() virtual void SimpleParams(int a, float b, char c, double d, long e) {};
|
API_FUNCTION() virtual void SimpleParams(int32 a, float b, char c, double d, int64 e) {};
|
||||||
API_FUNCTION() virtual void StringParamAnsi(StringAnsi str) {};
|
API_FUNCTION() virtual void StringParamAnsi(StringAnsi str) {};
|
||||||
API_FUNCTION() virtual void StringParam(String str) {};
|
API_FUNCTION() virtual void StringParam(String str) {};
|
||||||
API_FUNCTION() virtual void StringParamRef(String& str) {};
|
API_FUNCTION() virtual void StringParamRef(String& str) {};
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using FlaxEngine;
|
using FlaxEngine;
|
||||||
|
using FlaxEngine.Interop;
|
||||||
|
|
||||||
namespace Game;
|
namespace Game;
|
||||||
|
|
||||||
@@ -32,6 +33,12 @@ public class MyScriptTwo : MyScript2
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void GetStats(ref long allocations, ref long deallocations)
|
||||||
|
{
|
||||||
|
allocations = ManagedHandle.Allocations;
|
||||||
|
deallocations = ManagedHandle.Deallocations;
|
||||||
|
}
|
||||||
|
|
||||||
public override void SimpleCall() {}
|
public override void SimpleCall() {}
|
||||||
public override void SimpleParams(int a, float b, sbyte c, double d, long e) {}
|
public override void SimpleParams(int a, float b, sbyte c, double d, long e) {}
|
||||||
public override void StringParamAnsi(string str) {}
|
public override void StringParamAnsi(string str) {}
|
||||||
|
|||||||
Reference in New Issue
Block a user