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

@@ -4,6 +4,7 @@
#include "INetworkSerializable.h"
#include "Engine/Core/Math/Quaternion.h"
#include "Engine/Core/Math/Transform.h"
#include "Engine/Profiler/ProfilerMemory.h"
// Quaternion quantized for optimized network data size.
struct NetworkQuaternion
@@ -119,6 +120,7 @@ void NetworkStream::Initialize(uint32 minCapacity)
Allocator::Free(_buffer);
// Allocate new one
PROFILE_MEM(Networking);
_buffer = (byte*)Allocator::Allocate(minCapacity);
_length = minCapacity;
_allocated = true;
@@ -246,6 +248,7 @@ void NetworkStream::WriteBytes(const void* data, uint32 bytes)
uint32 newLength = _length != 0 ? _length * 2 : 256;
while (newLength < position + bytes)
newLength *= 2;
PROFILE_MEM(Networking);
byte* newBuf = (byte*)Allocator::Allocate(newLength);
if (_buffer && _length)
Platform::MemoryCopy(newBuf, _buffer, _length);