Add Emscripten heap memory size and max limit stats to profiler
This commit is contained in:
@@ -175,6 +175,7 @@ void SDLPlatform::LogInfo()
|
||||
|
||||
void SDLPlatform::Tick()
|
||||
{
|
||||
SDLPlatformBase::Tick();
|
||||
SDLInput::Update();
|
||||
|
||||
PreHandleEvents();
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "Engine/Platform/MemoryStats.h"
|
||||
#include "Engine/Platform/MessageBox.h"
|
||||
#include "Engine/Profiler/ProfilerCPU.h"
|
||||
#include "Engine/Profiler/ProfilerMemory.h"
|
||||
#include "Engine/Engine/Engine.h"
|
||||
#include "Engine/Engine/Web/WebGame.h"
|
||||
#include "Engine/Utilities/StringConverter.h"
|
||||
@@ -219,6 +220,12 @@ bool WebPlatform::Init()
|
||||
if (PlatformBase::Init())
|
||||
return true;
|
||||
|
||||
#if COMPILE_WITH_PROFILER
|
||||
// Setup platform-specific memory profiler tags
|
||||
ProfilerMemory::RenameGroup(ProfilerMemory::Groups::WEB_MEM_TAG_HEAP_SIZE, TEXT("Emscripten/HeapSize"));
|
||||
ProfilerMemory::RenameGroup(ProfilerMemory::Groups::WEB_MEM_TAG_HEAP_MAX, TEXT("Emscripten/HeapMax"));
|
||||
#endif
|
||||
|
||||
// Set info about the CPU
|
||||
Platform::MemoryClear(&Cpu, sizeof(Cpu));
|
||||
Cpu.ProcessorPackageCount = 1;
|
||||
@@ -249,6 +256,10 @@ void WebPlatform::LogInfo()
|
||||
|
||||
void WebPlatform::Tick()
|
||||
{
|
||||
#if COMPILE_WITH_PROFILER
|
||||
ProfilerMemory::OnGroupSet(ProfilerMemory::Groups::WEB_MEM_TAG_HEAP_SIZE, (int64)emscripten_get_heap_size(), 1);
|
||||
ProfilerMemory::OnGroupSet(ProfilerMemory::Groups::WEB_MEM_TAG_HEAP_MAX, (int64)emscripten_get_heap_max(), 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
void WebPlatform::Exit()
|
||||
|
||||
@@ -9,6 +9,10 @@
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
|
||||
// Platform memory profiler categories mapping
|
||||
#define WEB_MEM_TAG_HEAP_SIZE CustomPlatform0
|
||||
#define WEB_MEM_TAG_HEAP_MAX CustomPlatform1
|
||||
|
||||
/// <summary>
|
||||
/// The Web platform implementation and application management utilities.
|
||||
/// </summary>
|
||||
|
||||
@@ -489,4 +489,11 @@ void ProfilerMemory::OnGroupUpdate(Groups group, int64 sizeDelta, int64 countDel
|
||||
UPDATE_PEEK(group);
|
||||
}
|
||||
|
||||
void ProfilerMemory::OnGroupSet(Groups group, int64 size, int64 count)
|
||||
{
|
||||
Platform::AtomicStore(&GroupMemory[(int32)group], size);
|
||||
Platform::AtomicStore(&GroupMemoryCount[(int32)group], count);
|
||||
UPDATE_PEEK(group);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -265,6 +265,7 @@ public:
|
||||
static void OnMemoryAlloc(void* ptr, uint64 size);
|
||||
static void OnMemoryFree(void* ptr);
|
||||
static void OnGroupUpdate(Groups group, int64 sizeDelta, int64 countDelta);
|
||||
static void OnGroupSet(Groups group, int64 size, int64 count);
|
||||
|
||||
public:
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user