UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
NetworkGranularMemoryLogging.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
6
7#ifndef UE_WITH_NETWORK_GRANULAR_MEM_TRACKING
8#define UE_WITH_NETWORK_GRANULAR_MEM_TRACKING !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
9#endif // UE_WITH_NETWORK_GRANULAR_MEM_TRACKING
10
11#if UE_WITH_NETWORK_GRANULAR_MEM_TRACKING
12
14{
16 {
19
21
22 ENGINE_API void EndWork(const FString& WorkName);
23
24 ENGINE_API void LogCustomWork(const FString& WorkName, const uint64 Bytes) const;
25
26 const bool IsEnabled() const
27 {
28 return ScopeStack != nullptr;
29 }
30
31 const FString& GetScopeName()
32 {
33 return ScopeName;
34 }
35
36 private:
37
39
40 uint64 PreWorkPos = 0;
41
42 const FArchive& Ar;
43 const FString ScopeName;
44 struct FNetworkMemoryTrackingScopeStack* ScopeStack;
45 };
46}
47
48#define GRANULAR_NETWORK_MEMORY_TRACKING_INIT(Archive, ScopeName) UE::Net::Private::GranularMemoryTracking::FScopeMarker GranularNetworkMemoryScope(Archive, ScopeName);
49#define GRANULAR_NETWORK_MEMORY_TRACKING_TRACK(Id, Work) \
50 { \
51 GranularNetworkMemoryScope.BeginWork(); \
52 Work; \
53 GranularNetworkMemoryScope.EndWork(Id); \
54 }
55#define GRANULAR_NETWORK_MEMORY_TRACKING_CUSTOM_WORK(Id, Value) GranularNetworkMemoryScope.LogCustomWork(Id, Value);
56
57#else // UE_WITH_NETWORK_GRANULAR_MEM_TRACKING
58
59#define GRANULAR_NETWORK_MEMORY_TRACKING_INIT(Archive, ScopeName)
60#define GRANULAR_NETWORK_MEMORY_TRACKING_TRACK(Id, Work) { Work; }
61#define GRANULAR_NETWORK_MEMORY_TRACKING_CUSTOM_WORK(Id, Work)
62
63#endif // UE_WITH_NETWORK_GRANULAR_MEM_TRACKING
FPlatformTypes::uint64 uint64
A 64-bit unsigned integer.
Definition Platform.h:1117
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
Definition Archive.h:1208
Definition NetworkGranularMemoryLogging.h:14
Definition NetworkGranularMemoryLogging.h:16
const FString & GetScopeName()
Definition NetworkGranularMemoryLogging.h:31
ENGINE_API void LogCustomWork(const FString &WorkName, const uint64 Bytes) const
ENGINE_API void EndWork(const FString &WorkName)
const bool IsEnabled() const
Definition NetworkGranularMemoryLogging.h:26
ENGINE_API FScopeMarker(FArchive &InAr, FString &&InScopeName)
friend struct FNetworkMemoryTrackingScopeStack
Definition NetworkGranularMemoryLogging.h:38