Add memory profiling events to the main areas of the engine
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
#include "Engine/Scripting/BinaryModule.h"
|
||||
#include "Engine/Engine/Globals.h"
|
||||
#include "Engine/Profiler/ProfilerCPU.h"
|
||||
#include "Engine/Profiler/ProfilerMemory.h"
|
||||
#include "Engine/Threading/Threading.h"
|
||||
#include "Engine/Debug/Exceptions/CLRInnerException.h"
|
||||
#if DOTNET_HOST_CORECLR
|
||||
@@ -281,6 +282,7 @@ void MCore::UnloadDomain(const StringAnsi& domainName)
|
||||
bool MCore::LoadEngine()
|
||||
{
|
||||
PROFILE_CPU();
|
||||
PROFILE_MEM(Scripting);
|
||||
|
||||
// Initialize hostfxr
|
||||
if (InitHostfxr())
|
||||
@@ -735,6 +737,7 @@ const MAssembly::ClassesDictionary& MAssembly::GetClasses() const
|
||||
if (_hasCachedClasses || !IsLoaded())
|
||||
return _classes;
|
||||
PROFILE_CPU();
|
||||
PROFILE_MEM(Scripting);
|
||||
Stopwatch stopwatch;
|
||||
|
||||
#if TRACY_ENABLE
|
||||
@@ -796,6 +799,7 @@ void GetAssemblyName(void* assemblyHandle, StringAnsi& name, StringAnsi& fullnam
|
||||
|
||||
DEFINE_INTERNAL_CALL(void) NativeInterop_CreateClass(NativeClassDefinitions* managedClass, void* assemblyHandle)
|
||||
{
|
||||
PROFILE_MEM(Scripting);
|
||||
ScopeLock lock(BinaryModule::Locker);
|
||||
MAssembly* assembly = GetAssembly(assemblyHandle);
|
||||
if (assembly == nullptr)
|
||||
@@ -831,6 +835,7 @@ bool MAssembly::LoadCorlib()
|
||||
if (IsLoaded())
|
||||
return false;
|
||||
PROFILE_CPU();
|
||||
PROFILE_MEM(Scripting);
|
||||
#if TRACY_ENABLE
|
||||
const StringAnsiView name("Corlib");
|
||||
ZoneText(*name, name.Length());
|
||||
@@ -1056,6 +1061,7 @@ const Array<MMethod*>& MClass::GetMethods() const
|
||||
{
|
||||
if (_hasCachedMethods)
|
||||
return _methods;
|
||||
PROFILE_MEM(Scripting);
|
||||
ScopeLock lock(BinaryModule::Locker);
|
||||
if (_hasCachedMethods)
|
||||
return _methods;
|
||||
@@ -1093,6 +1099,7 @@ const Array<MField*>& MClass::GetFields() const
|
||||
{
|
||||
if (_hasCachedFields)
|
||||
return _fields;
|
||||
PROFILE_MEM(Scripting);
|
||||
ScopeLock lock(BinaryModule::Locker);
|
||||
if (_hasCachedFields)
|
||||
return _fields;
|
||||
@@ -1119,6 +1126,7 @@ const Array<MEvent*>& MClass::GetEvents() const
|
||||
{
|
||||
if (_hasCachedEvents)
|
||||
return _events;
|
||||
PROFILE_MEM(Scripting);
|
||||
|
||||
// TODO: implement MEvent in .NET
|
||||
|
||||
@@ -1141,6 +1149,7 @@ const Array<MProperty*>& MClass::GetProperties() const
|
||||
{
|
||||
if (_hasCachedProperties)
|
||||
return _properties;
|
||||
PROFILE_MEM(Scripting);
|
||||
ScopeLock lock(BinaryModule::Locker);
|
||||
if (_hasCachedProperties)
|
||||
return _properties;
|
||||
@@ -1167,6 +1176,7 @@ const Array<MClass*>& MClass::GetInterfaces() const
|
||||
{
|
||||
if (_hasCachedInterfaces)
|
||||
return _interfaces;
|
||||
PROFILE_MEM(Scripting);
|
||||
ScopeLock lock(BinaryModule::Locker);
|
||||
if (_hasCachedInterfaces)
|
||||
return _interfaces;
|
||||
@@ -1206,6 +1216,7 @@ const Array<MObject*>& MClass::GetAttributes() const
|
||||
{
|
||||
if (_hasCachedAttributes)
|
||||
return _attributes;
|
||||
PROFILE_MEM(Scripting);
|
||||
ScopeLock lock(BinaryModule::Locker);
|
||||
if (_hasCachedAttributes)
|
||||
return _attributes;
|
||||
@@ -1388,6 +1399,7 @@ const Array<MObject*>& MField::GetAttributes() const
|
||||
{
|
||||
if (_hasCachedAttributes)
|
||||
return _attributes;
|
||||
PROFILE_MEM(Scripting);
|
||||
ScopeLock lock(BinaryModule::Locker);
|
||||
if (_hasCachedAttributes)
|
||||
return _attributes;
|
||||
@@ -1450,6 +1462,7 @@ void MMethod::CacheSignature() const
|
||||
ScopeLock lock(BinaryModule::Locker);
|
||||
if (_hasCachedSignature)
|
||||
return;
|
||||
PROFILE_MEM(Scripting);
|
||||
|
||||
static void* GetMethodReturnTypePtr = GetStaticMethodPointer(TEXT("GetMethodReturnType"));
|
||||
static void* GetMethodParameterTypesPtr = GetStaticMethodPointer(TEXT("GetMethodParameterTypes"));
|
||||
@@ -1550,6 +1563,7 @@ const Array<MObject*>& MMethod::GetAttributes() const
|
||||
{
|
||||
if (_hasCachedAttributes)
|
||||
return _attributes;
|
||||
PROFILE_MEM(Scripting);
|
||||
ScopeLock lock(BinaryModule::Locker);
|
||||
if (_hasCachedAttributes)
|
||||
return _attributes;
|
||||
@@ -1628,6 +1642,7 @@ const Array<MObject*>& MProperty::GetAttributes() const
|
||||
{
|
||||
if (_hasCachedAttributes)
|
||||
return _attributes;
|
||||
PROFILE_MEM(Scripting);
|
||||
ScopeLock lock(BinaryModule::Locker);
|
||||
if (_hasCachedAttributes)
|
||||
return _attributes;
|
||||
@@ -1658,6 +1673,7 @@ MClass* GetOrCreateClass(MType* typeHandle)
|
||||
{
|
||||
if (!typeHandle)
|
||||
return nullptr;
|
||||
PROFILE_MEM(Scripting);
|
||||
ScopeLock lock(BinaryModule::Locker);
|
||||
MClass* klass;
|
||||
if (!CachedClassHandles.TryGet(typeHandle, klass))
|
||||
@@ -1781,9 +1797,13 @@ bool InitHostfxr()
|
||||
if (hostfxr == nullptr)
|
||||
{
|
||||
if (FileSystem::FileExists(path))
|
||||
{
|
||||
LOG(Fatal, "Failed to load hostfxr library, possible platform/architecture mismatch with the library. See log for more information. ({0})", path);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG(Fatal, "Failed to load hostfxr library ({0})", path);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
hostfxr_initialize_for_runtime_config = (hostfxr_initialize_for_runtime_config_fn)Platform::GetProcAddress(hostfxr, "hostfxr_initialize_for_runtime_config");
|
||||
|
||||
Reference in New Issue
Block a user