Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
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"
5
#
include
"HAL/CriticalSection.h"
6
#
include
"HAL/PlatformTime.h"
7
8
#
ifndef
UE_TIME_VIRTUALMALLOC
9
#
define
UE_TIME_VIRTUALMALLOC
0
10
#
endif
11
12
struct
FScopedVirtualMallocTimer
13
{
14
enum
IndexType
:
int32
15
{
16
Reserve
,
17
Commit
,
18
Combined
,
19
DeCommit
,
20
Free
,
21
22
Max
23
};
24
25
enum
PlatormIndexType
:
int32
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
31
PlatormIndexTypeMax
32
};
33
34
#
if
UE_TIME_VIRTUALMALLOC
35
static
uint64
GTotalCycles
[
IndexType
::
Max
][
PlatormIndexType
::
PlatormIndexTypeMax
];
36
static
uint64
GTotalCounts
[
IndexType
::
Max
][
PlatormIndexType
::
PlatormIndexTypeMax
];
37
38
int32
Index
;
39
int32
PlatformTypeIndex
;
40
uint64
Cycles
;
41
42
FORCEINLINE
FScopedVirtualMallocTimer
(
int32
InIndex
= 0,
int32
InPlatformTypeIndex
= 0)
43
:
Index
(
InIndex
)
44
,
PlatformTypeIndex
(
InPlatformTypeIndex
)
45
,
Cycles
(
FPlatformTime
::
Cycles64
())
46
{
47
FPlatformAtomics
::
InterlockedIncrement
((
volatile
int64
*)&
GTotalCounts
[
InIndex
][
InPlatformTypeIndex
]);
48
}
49
FORCEINLINE
~
FScopedVirtualMallocTimer
()
50
{
51
uint64
Add
=
uint64
(
FPlatformTime
::
Cycles64
() -
Cycles
);
52
FPlatformAtomics
::
InterlockedAdd
((
volatile
int64
*)&
GTotalCycles
[
Index
][
PlatformTypeIndex
],
Add
);
53
}
54
55
static
void
UpdateStats
();
56
#
else
//UE_TIME_VIRTUALMALLOC
57
FORCEINLINE
FScopedVirtualMallocTimer
(int32 InIndex = 0, int32 InPlatformTypeIndex = 0)
58
{
59
}
60
FORCEINLINE
~
FScopedVirtualMallocTimer
()
61
{
62
}
63
static
FORCEINLINE
void
UpdateStats
()
64
{
65
}
66
#
endif
//UE_TIME_VIRTUALMALLOC
67
};
UE_TIME_VIRTUALMALLOC
#define UE_TIME_VIRTUALMALLOC
Definition
MallocTimer.h:9
FORCEINLINE
#define FORCEINLINE
Definition
Platform.h:644
FScopedVirtualMallocTimer
Definition
MallocTimer.h:13
FScopedVirtualMallocTimer::UpdateStats
static FORCEINLINE void UpdateStats()
Definition
MallocTimer.h:63
FScopedVirtualMallocTimer::PlatormIndexType
PlatormIndexType
Definition
MallocTimer.h:26
FScopedVirtualMallocTimer::OrdinaryCPU
@ OrdinaryCPU
Definition
MallocTimer.h:27
FScopedVirtualMallocTimer::PlatormIndexTypeMax
@ PlatormIndexTypeMax
Definition
MallocTimer.h:31
FScopedVirtualMallocTimer::GPU_WriteCombineRenderTarget
@ GPU_WriteCombineRenderTarget
Definition
MallocTimer.h:30
FScopedVirtualMallocTimer::GPU_Cacheable
@ GPU_Cacheable
Definition
MallocTimer.h:29
FScopedVirtualMallocTimer::GPU_WriteCombine
@ GPU_WriteCombine
Definition
MallocTimer.h:28
FScopedVirtualMallocTimer::FScopedVirtualMallocTimer
FORCEINLINE FScopedVirtualMallocTimer(int32 InIndex=0, int32 InPlatformTypeIndex=0)
Definition
MallocTimer.h:57
FScopedVirtualMallocTimer::IndexType
IndexType
Definition
MallocTimer.h:15
FScopedVirtualMallocTimer::Free
@ Free
Definition
MallocTimer.h:20
FScopedVirtualMallocTimer::Max
@ Max
Definition
MallocTimer.h:22
FScopedVirtualMallocTimer::Combined
@ Combined
Definition
MallocTimer.h:18
FScopedVirtualMallocTimer::Commit
@ Commit
Definition
MallocTimer.h:17
FScopedVirtualMallocTimer::DeCommit
@ DeCommit
Definition
MallocTimer.h:19
FScopedVirtualMallocTimer::Reserve
@ Reserve
Definition
MallocTimer.h:16
FScopedVirtualMallocTimer::~FScopedVirtualMallocTimer
FORCEINLINE ~FScopedVirtualMallocTimer()
Definition
MallocTimer.h:60
Downloads
ArkServerAPI_NEW
ASA
AsaApi
AsaApi
Core
Public
API
UE
HAL
MallocTimer.h
Generated by
1.10.0