UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
MallocTimer.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4#include "CoreTypes.h"
6#include "HAL/PlatformTime.h"
7
8#ifndef UE_TIME_VIRTUALMALLOC
9#define UE_TIME_VIRTUALMALLOC 0
10#endif
11
13{
24
26 {
27 OrdinaryCPU, // General memory
28 GPU_WriteCombine, // XALLOC_MEMTYPE_GRAPHICS_COMMAND_BUFFER_WRITECOMBINE and XALLOC_MEMTYPE_GRAPHICS_WRITECOMBINE
29 GPU_Cacheable, // XALLOC_MEMTYPE_GRAPHICS_CACHEABLE
30 GPU_WriteCombineRenderTarget, // Similar to GPU_WriteCombine, but with 4MB pages and up to 128K alignment, no small block allocator
32 };
33
34#if UE_TIME_VIRTUALMALLOC
37
40 uint64 Cycles;
41
43 : Index(InIndex)
45 , Cycles(FPlatformTime::Cycles64())
46 {
47 FPlatformAtomics::InterlockedIncrement((volatile int64*)&GTotalCounts[InIndex][InPlatformTypeIndex]);
48 }
50 {
52 FPlatformAtomics::InterlockedAdd((volatile int64*)&GTotalCycles[Index][PlatformTypeIndex], Add);
53 }
54
55 static CORE_API void UpdateStats();
56#else //UE_TIME_VIRTUALMALLOC
64 {
65 }
66#endif //UE_TIME_VIRTUALMALLOC
67};
FPlatformTypes::int64 int64
A 64-bit signed integer.
Definition Platform.h:1127
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
#define UE_FORCEINLINE_HINT
Definition Platform.h:723
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
U16 Index
Definition radfft.cpp:71
Definition AndroidPlatformTime.h:18
static uint64 Cycles64()
Definition AndroidPlatformTime.h:34
Definition MallocTimer.h:13
PlatormIndexType
Definition MallocTimer.h:26
@ OrdinaryCPU
Definition MallocTimer.h:27
@ PlatormIndexTypeMax
Definition MallocTimer.h:31
@ GPU_WriteCombineRenderTarget
Definition MallocTimer.h:30
@ GPU_Cacheable
Definition MallocTimer.h:29
@ GPU_WriteCombine
Definition MallocTimer.h:28
static UE_FORCEINLINE_HINT void UpdateStats()
Definition MallocTimer.h:63
IndexType
Definition MallocTimer.h:15
@ Free
Definition MallocTimer.h:20
@ Max
Definition MallocTimer.h:22
@ Combined
Definition MallocTimer.h:18
@ Commit
Definition MallocTimer.h:17
@ DeCommit
Definition MallocTimer.h:19
@ Reserve
Definition MallocTimer.h:16
UE_FORCEINLINE_HINT ~FScopedVirtualMallocTimer()
Definition MallocTimer.h:60
UE_FORCEINLINE_HINT FScopedVirtualMallocTimer(int32 InIndex=0, int32 InPlatformTypeIndex=0)
Definition MallocTimer.h:57