UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
DiskCacheGovernor.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
6#include <atomic>
7
8namespace UE::IoStore
9{
10
13{
14public:
16 {
17 uint32 Bytes = 16 << 20;
18 uint32 Ops = 32;
20 };
21
22 struct FDemand
23 {
27 };
28
35
38
39 void ConfigureStreamingCache(const FConfig& Config);
42 void OnInstallCacheFlushed(uint64 ByteCount, uint32 OpCount);
43
44private:
45 struct FCacheState;
46
47 static void Configure(FCacheState& CacheState, const FConfig& Config);
48 static int32 TryBeginWrite(FCacheState& CacheState, uint32 DemandPercent, int64 Cycles);
49 static int32 TryBeginWrite(FCacheState& CacheState, uint32 DemandPercent);
50 static int32 EndWrite(struct FCacheState& CacheState, uint32 UnusedAllowance);
51 static int32 GetMaxWaitCycles(FCacheState& CacheState);
52
53 struct FCacheState
54 {
55 enum class EState : uint8
56 {
57 Waiting,
58 Rolling,
59 };
60
61 int64 OpInterval = 0;
62 int64 PrevCycles = 0;
63 uint32 RunOff = 0;
64 uint32 OpCount = 0;
65 uint32 MaxOpCount = 0;
66 uint32 OpAllowance = 0;
67 std::atomic_int64_t CyclesSuspended{0};
68 FDemand Demand;
69 EState State = EState::Waiting;
70 };
71
72 FCacheState StreamingCacheState;
73};
74
75} // namespace UE::IoStore
FPlatformTypes::int64 int64
A 64-bit signed integer.
Definition Platform.h:1127
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
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
uint8_t uint8
Definition binka_ue_file_header.h:8
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition DiskCacheGovernor.h:13
void ConfigureStreamingCache(const FConfig &Config)
Definition DiskCacheGovernor.cpp:27
UE_NONCOPYABLE(FDiskCacheGovernor)
int32 EndWriteToStreamingCache(uint32 UnusedAllowance)
Definition DiskCacheGovernor.cpp:39
FDiskCacheGovernor()
Definition DiskCacheGovernor.cpp:20
void OnInstallCacheFlushed(uint64 ByteCount, uint32 OpCount)
Definition DiskCacheGovernor.cpp:183
int32 TryBeginWriteToStreamingCache(uint32 DemandPercent)
Definition DiskCacheGovernor.cpp:33
NO_LOGGING.
Definition Client.h:20
Definition DiskCacheGovernor.h:16
uint32 Seconds
Definition DiskCacheGovernor.h:19
uint32 Bytes
Definition DiskCacheGovernor.h:17
uint32 Ops
Definition DiskCacheGovernor.h:18
Definition DiskCacheGovernor.h:30
uint32 CommitBufferSize
Definition DiskCacheGovernor.h:33
FAllowance Allowance
Definition DiskCacheGovernor.h:31
FDemand Demand
Definition DiskCacheGovernor.h:32
Definition DiskCacheGovernor.h:23
uint8 Threshold
Definition DiskCacheGovernor.h:24
uint8 Boost
Definition DiskCacheGovernor.h:25
uint8 SuperBoost
Definition DiskCacheGovernor.h:26