Add memory profiling events to the main areas of the engine
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#include "Engine/Core/Utilities.h"
|
||||
#include "Engine/Threading/Threading.h"
|
||||
#include "Engine/Profiler/ProfilerCPU.h"
|
||||
#include "Engine/Profiler/ProfilerMemory.h"
|
||||
#include "ManagedCLR/MAssembly.h"
|
||||
#include "ManagedCLR/MClass.h"
|
||||
#include "ManagedCLR/MMethod.h"
|
||||
@@ -762,6 +763,8 @@ ManagedBinaryModule* ManagedBinaryModule::GetModule(const MAssembly* assembly)
|
||||
|
||||
ScriptingObject* ManagedBinaryModule::ManagedObjectSpawn(const ScriptingObjectSpawnParams& params)
|
||||
{
|
||||
PROFILE_MEM(Scripting);
|
||||
|
||||
// Create native object
|
||||
ScriptingTypeHandle managedTypeHandle = params.Type;
|
||||
const ScriptingType* managedTypePtr = &managedTypeHandle.GetType();
|
||||
@@ -932,6 +935,7 @@ void ManagedBinaryModule::OnLoaded(MAssembly* assembly)
|
||||
{
|
||||
#if !COMPILE_WITHOUT_CSHARP
|
||||
PROFILE_CPU();
|
||||
PROFILE_MEM(Scripting);
|
||||
ASSERT(ClassToTypeIndex.IsEmpty());
|
||||
ScopeLock lock(Locker);
|
||||
|
||||
@@ -1028,6 +1032,7 @@ void ManagedBinaryModule::InitType(MClass* mclass)
|
||||
const StringAnsi& typeName = mclass->GetFullName();
|
||||
if (TypeNameToTypeIndex.ContainsKey(typeName))
|
||||
return;
|
||||
PROFILE_MEM(Scripting);
|
||||
|
||||
// Find first native base C++ class of this C# class
|
||||
MClass* baseClass = mclass->GetBaseClass();
|
||||
@@ -1057,9 +1062,13 @@ void ManagedBinaryModule::InitType(MClass* mclass)
|
||||
if (baseType.TypeIndex == -1 || baseType.Module == nullptr)
|
||||
{
|
||||
if (baseType.Module)
|
||||
{
|
||||
LOG(Error, "Missing base class for managed class {0} from assembly {1}.", String(baseClass->GetFullName()), baseType.Module->GetName().ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG(Error, "Missing base class for managed class {0} from unknown assembly.", String(baseClass->GetFullName()));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1183,6 +1192,7 @@ void ManagedBinaryModule::OnUnloading(MAssembly* assembly)
|
||||
void ManagedBinaryModule::OnUnloaded(MAssembly* assembly)
|
||||
{
|
||||
PROFILE_CPU();
|
||||
PROFILE_MEM(Scripting);
|
||||
|
||||
// Clear managed-only types
|
||||
Types.Resize(_firstManagedTypeIndex);
|
||||
@@ -1495,9 +1505,13 @@ bool ManagedBinaryModule::GetFieldValue(void* field, const Variant& instance, Va
|
||||
if (!instanceObject || !MCore::Object::GetClass(instanceObject)->IsSubClassOf(parentClass))
|
||||
{
|
||||
if (!instanceObject)
|
||||
{
|
||||
LOG(Error, "Failed to get '{0}.{1}' without object instance", String(parentClass->GetFullName()), String(name));
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG(Error, "Failed to get '{0}.{1}' with invalid object instance of type '{2}'", String(parentClass->GetFullName()), String(name), String(MUtils::GetClassFullname(instanceObject)));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1553,9 +1567,13 @@ bool ManagedBinaryModule::SetFieldValue(void* field, const Variant& instance, Va
|
||||
if (!instanceObject || !MCore::Object::GetClass(instanceObject)->IsSubClassOf(parentClass))
|
||||
{
|
||||
if (!instanceObject)
|
||||
{
|
||||
LOG(Error, "Failed to set '{0}.{1}' without object instance", String(parentClass->GetFullName()), String(name));
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG(Error, "Failed to set '{0}.{1}' with invalid object instance of type '{2}'", String(parentClass->GetFullName()), String(name), String(MUtils::GetClassFullname(instanceObject)));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user