Add memory profiling events to the main areas of the engine

This commit is contained in:
Wojtek Figat
2025-05-22 04:47:01 +02:00
parent 32bc73610f
commit c639a3103c
101 changed files with 502 additions and 17 deletions

View File

@@ -6,6 +6,7 @@
#include "Engine/Scripting/ManagedCLR/MClass.h"
#include "Engine/Scripting/ManagedCLR/MUtils.h"
#include "Engine/Serialization/Serialization.h"
#include "Engine/Profiler/ProfilerMemory.h"
#if COMPILE_WITHOUT_CSHARP
#define UICANVAS_INVOKE(event)
@@ -26,6 +27,7 @@ MMethod* UICanvas_ParentChanged = nullptr;
auto* managed = GetManagedInstance(); \
if (managed) \
{ \
PROFILE_MEM(UI); \
MObject* exception = nullptr; \
UICanvas_##event->Invoke(managed, nullptr, &exception); \
if (exception) \
@@ -77,6 +79,7 @@ void UICanvas::Serialize(SerializeStream& stream, const void* otherObj)
SERIALIZE_GET_OTHER_OBJ(UICanvas);
#if !COMPILE_WITHOUT_CSHARP
PROFILE_MEM(UI);
stream.JKEY("V");
void* params[1];
params[0] = other ? other->GetOrCreateManagedInstance() : nullptr;
@@ -109,6 +112,7 @@ void UICanvas::Deserialize(DeserializeStream& stream, ISerializeModifier* modifi
const auto dataMember = stream.FindMember("V");
if (dataMember != stream.MemberEnd())
{
PROFILE_MEM(UI);
rapidjson_flax::StringBuffer buffer;
rapidjson_flax::Writer<rapidjson_flax::StringBuffer> writer(buffer);
dataMember->value.Accept(writer);