diff options
| author | Stefan Boberg <[email protected]> | 2024-12-02 12:21:53 +0100 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2024-12-02 12:21:53 +0100 |
| commit | e6f44577f469e891ed8dab1492a4c53224e0b765 (patch) | |
| tree | 47334606ce62fb6bf1975cdc09276ced335599f4 /src/zencore/memtrack | |
| parent | 5.5.15-pre0 (diff) | |
| download | zen-e6f44577f469e891ed8dab1492a4c53224e0b765.tar.xz zen-e6f44577f469e891ed8dab1492a4c53224e0b765.zip | |
added support for dynamic LLM tags (#245)
* added FLLMTag which can be used to register memory tags outside of core
* changed `UE_MEMSCOPE` -> `ZEN_MEMSCOPE` for consistency
* instrumented some subsystems with dynamic tags
Diffstat (limited to 'src/zencore/memtrack')
| -rw-r--r-- | src/zencore/memtrack/memorytrace.cpp | 4 | ||||
| -rw-r--r-- | src/zencore/memtrack/moduletrace.cpp | 2 | ||||
| -rw-r--r-- | src/zencore/memtrack/tagtrace.cpp | 11 |
3 files changed, 12 insertions, 5 deletions
diff --git a/src/zencore/memtrack/memorytrace.cpp b/src/zencore/memtrack/memorytrace.cpp index b147aee91..7089c356a 100644 --- a/src/zencore/memtrack/memorytrace.cpp +++ b/src/zencore/memtrack/memorytrace.cpp @@ -755,7 +755,7 @@ FTraceMalloc::Malloc(SIZE_T Count, uint32_t Alignment) { #if UE_MEMORY_TRACE_ENABLED // UE_TRACE_METADATA_CLEAR_SCOPE(); - UE_MEMSCOPE(TRACE_TAG); + ZEN_MEMSCOPE(TRACE_TAG); void* NewPtr; { @@ -783,7 +783,7 @@ FTraceMalloc::Realloc(void* Original, SIZE_T Count, uint32_t Alignment) { #if UE_MEMORY_TRACE_ENABLED // UE_TRACE_METADATA_CLEAR_SCOPE(); - UE_MEMSCOPE(TRACE_TAG); + ZEN_MEMSCOPE(TRACE_TAG); UE_TRACE_LOG(Memory, ReallocFree, MemAllocChannel) << ReallocFree.Address(uint64_t(Original)) << ReallocFree.RootHeap(uint8(EMemoryTraceRootHeap::SystemMemory)); diff --git a/src/zencore/memtrack/moduletrace.cpp b/src/zencore/memtrack/moduletrace.cpp index 51280ff3a..cf37c5932 100644 --- a/src/zencore/memtrack/moduletrace.cpp +++ b/src/zencore/memtrack/moduletrace.cpp @@ -228,7 +228,7 @@ FModuleTrace::OnDllLoaded(const UNICODE_STRING& Name, UPTRINT Base) # if UE_MEMORY_TRACE_ENABLED { - UE_MEMSCOPE(ELLMTag::ProgramSize); + ZEN_MEMSCOPE(ELLMTag::ProgramSize); MemoryTrace_Alloc(Base, OptionalHeader.SizeOfImage, 4 * 1024, EMemoryTraceRootHeap::SystemMemory); MemoryTrace_MarkAllocAsHeap(Base, ProgramHeapId); MemoryTrace_Alloc(Base, OptionalHeader.SizeOfImage, 4 * 1024, EMemoryTraceRootHeap::SystemMemory); diff --git a/src/zencore/memtrack/tagtrace.cpp b/src/zencore/memtrack/tagtrace.cpp index 15ba78ae4..797da0fab 100644 --- a/src/zencore/memtrack/tagtrace.cpp +++ b/src/zencore/memtrack/tagtrace.cpp @@ -51,7 +51,15 @@ FMemScope::FMemScope(ELLMTag InTag, bool bShouldActivate /*= true*/) { if (UE_TRACE_CHANNELEXPR_IS_ENABLED(MemAllocChannel) & bShouldActivate) { - ActivateScope(static_cast<int32>(InTag)); + ActivateScope(static_cast<int32_t>(InTag)); + } +} + +FMemScope::FMemScope(FLLMTag InTag, bool bShouldActivate /*= true*/) +{ + if (UE_TRACE_CHANNELEXPR_IS_ENABLED(MemAllocChannel) & bShouldActivate) + { + ActivateScope(static_cast<int32_t>(InTag.GetTag())); } } @@ -212,7 +220,6 @@ int32_t MemoryTrace_AnnounceCustomTag(int32_t Tag, int32_t ParentTag, const char* Display) { #if UE_MEMORY_TAGS_TRACE_ENABLED && UE_TRACE_ENABLED - // todo: How do we check if tag trace is active? if (GTagTrace) { return GTagTrace->AnnounceCustomTag(Tag, ParentTag, Display); |