UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
GenericPlatformSurvey.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "Containers/Array.h"
7#include "CoreMinimal.h"
8#include "HAL/Platform.h"
9#include "Logging/LogMacros.h"
10
12
13// time and amount of work that was measured
15{
21
22 // in seconds, >=0
23 float TotalTime;
24 // Time / WorkScale, WorkScale might have been adjusted (e.g. quantized), >0
26};
27
28
30{
32 : Desc(0)
33 , MeasuredTotalTime(-1)
34 , MeasuredNormalizedTime(-1)
35 , IndexNormalizedTime(-1)
36 , ValueType(0)
37 , Confidence(0)
38 , Weight(1.f)
39 { }
40
41 // @param InDesc descriptions
43 : Desc(InDesc)
44 , MeasuredTotalTime(-1)
45 , MeasuredNormalizedTime(-1)
46 , IndexNormalizedTime(InIndexNormalizedTime)
47 , ValueType(InValueType)
48 , Confidence(0)
49 , Weight(InWeight)
50 {
51// check(InDesc);
52// check(InValueType);
53 }
54
55 // Computes the linear performance index (>0), around 100 with good hardware but higher numbers are possible
56 float ComputePerfIndex() const
57 {
58 return 100.0f * IndexNormalizedTime / MeasuredNormalizedTime;
59 }
60
61 // @param TimeSample seconds and normalized time (e.g. seconds / GPixels)
62 // @param InConfidence 0..100
64 {
65// check(InConfidence >= 0.0f && InConfidence <= 100.0f);
66 MeasuredTotalTime = TimeSample.TotalTime;
67 MeasuredNormalizedTime = TimeSample.NormalizedTime;
68 Confidence = InConfidence;
69 }
70
71 // @return can be 0
72 const TCHAR* GetDesc() const
73 {
74 return Desc;
75 }
76
77 // @return can be 0
78 const TCHAR* GetValueType() const
79 {
80 return ValueType;
81 }
82
83 float GetNormalizedTime() const
84 {
85 return MeasuredNormalizedTime;
86 }
87
89 {
90 return MeasuredTotalTime;
91 }
92
93 // @return 0=no..100=full
94 float GetConfidence() const
95 {
96 return Confidence;
97 }
98
99 float GetWeight() const
100 {
101 return Weight;
102 }
103
104private:
105
106 // 0 if not valid
107 const TCHAR *Desc;
108 // -1 if not defined, in seconds, useful to see if a test did run too long (some slower GPUs might timeout)
109 float MeasuredTotalTime;
110 // -1 if not defined, depends on the test (e.g. s/GPixels), WorkScale is divided out
111 float MeasuredNormalizedTime;
112 // -1 if not defined, timing value expected on a norm GPU (index value 100, here NVidia 670)
113 float IndexNormalizedTime;
114 // 0 if not valid
115 const TCHAR *ValueType;
116 // 0..100, 100: fully confident
117 float Confidence;
118 // 1 is normal weight, 0 is no weight, > 1 is unbounded additional weight
119 float Weight;
120};
121
122
124{
127
128 // 100: avg good CPU, <100:slower, >100:faster
130
131 // 100: avg good GPU, <100:slower, >100:faster
133
134 // @return in seconds, useful to check if a benchmark takes too long (very slow hardware, don't make tests with large WorkScale)
136 {
137 float Ret = 0.0f;
138 for(uint32 i = 0; i < sizeof(GPUStats) / sizeof(GPUStats[0]); ++i)
139 {
140 Ret += GPUStats[i].GetMeasuredTotalTime();
141 }
142
143 return Ret;
144 }
145};
146
147
159
160
162{
163 static const uint32 MaxStringLength = 260;
164
166 //
168 // extra data when RHI starts up, AMD has the Catalyst Driver version which is more useful for the user, otherwise it's the same as GRHIAdapterInternalDriverVersion
170 // extra data when RHI starts up
172 //
174};
175
176
222
223
228{
237 static bool GetSurveyResults( FHardwareSurveyResults& OutResults, bool bWait = false )
238 {
239 return false;
240 }
241};
FPlatformTypes::TCHAR TCHAR
Either ANSICHAR or WIDECHAR, depending on whether the platform supports wide characters or the requir...
Definition Platform.h:1135
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define DECLARE_LOG_CATEGORY_EXTERN(CategoryName, DefaultVerbosity, CompileTimeVerbosity)
Definition LogMacros.h:361
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition Array.h:670
Definition GenericPlatformSurvey.h:162
static const uint32 MaxStringLength
Definition GenericPlatformSurvey.h:163
TCHAR AdapterUserDriverVersion[MaxStringLength]
Definition GenericPlatformSurvey.h:169
TCHAR AdapterInternalDriverVersion[MaxStringLength]
Definition GenericPlatformSurvey.h:167
TCHAR AdapterDedicatedMemoryMB[MaxStringLength]
Definition GenericPlatformSurvey.h:173
TCHAR AdapterName[MaxStringLength]
Definition GenericPlatformSurvey.h:165
TCHAR AdapterDriverDate[MaxStringLength]
Definition GenericPlatformSurvey.h:171
Definition GenericPlatformSurvey.h:228
static bool GetSurveyResults(FHardwareSurveyResults &OutResults, bool bWait=false)
Definition GenericPlatformSurvey.h:237
Definition GenericPlatformSurvey.h:149
static const uint32 MaxStringLength
Definition GenericPlatformSurvey.h:150
uint32 GPUDedicatedMemoryMB_DEPRECATED
Definition GenericPlatformSurvey.h:156
uint32 CurrentModeWidth
Definition GenericPlatformSurvey.h:152
TCHAR GPUDriverVersion_DEPRECATED[MaxStringLength]
Definition GenericPlatformSurvey.h:157
uint32 CurrentModeHeight
Definition GenericPlatformSurvey.h:153
TCHAR GPUCardName_DEPRECATED[MaxStringLength]
Definition GenericPlatformSurvey.h:155
Definition GenericPlatformSurvey.h:178
FSynthBenchmarkResults SynthBenchmark
Definition GenericPlatformSurvey.h:220
TCHAR MultimediaAPI_DEPRECATED[MaxStringLength]
Definition GenericPlatformSurvey.h:190
uint32 DisplayCount
Definition GenericPlatformSurvey.h:209
TCHAR Platform[MaxStringLength]
Definition GenericPlatformSurvey.h:182
TCHAR LastSurveyError[MaxStringLength]
Definition GenericPlatformSurvey.h:215
uint32 MemoryMB
Definition GenericPlatformSurvey.h:194
uint32 CPUCount
Definition GenericPlatformSurvey.h:203
FHardwareDisplay Displays[MaxDisplayCount]
Definition GenericPlatformSurvey.h:210
float CPUClockGHz
Definition GenericPlatformSurvey.h:204
static const int32 MaxStringLength
Definition GenericPlatformSurvey.h:180
uint32 OSBits
Definition GenericPlatformSurvey.h:186
FGPUAdpater RHIAdapter
Definition GenericPlatformSurvey.h:212
TCHAR LastPerformanceIndexError[MaxStringLength]
Definition GenericPlatformSurvey.h:217
uint32 bIsRemoteSession
Definition GenericPlatformSurvey.h:201
TCHAR OSSubVersion[MaxStringLength]
Definition GenericPlatformSurvey.h:185
TCHAR OSLanguage[MaxStringLength]
Definition GenericPlatformSurvey.h:187
uint32 HardDriveFreeMB
Definition GenericPlatformSurvey.h:193
float GPUPerformanceIndex
Definition GenericPlatformSurvey.h:197
TCHAR OSVersion[MaxStringLength]
Definition GenericPlatformSurvey.h:184
TCHAR CPUNameString[MaxStringLength]
Definition GenericPlatformSurvey.h:206
uint32 CPUInfo
Definition GenericPlatformSurvey.h:207
static const int32 MaxDisplayCount
Definition GenericPlatformSurvey.h:179
float CPUPerformanceIndex
Definition GenericPlatformSurvey.h:196
TCHAR RenderingAPI[MaxStringLength]
Definition GenericPlatformSurvey.h:189
TCHAR LastSurveyErrorDetail[MaxStringLength]
Definition GenericPlatformSurvey.h:216
uint32 ErrorCount
Definition GenericPlatformSurvey.h:214
TCHAR CPUBrand[MaxStringLength]
Definition GenericPlatformSurvey.h:205
float RAMPerformanceIndex
Definition GenericPlatformSurvey.h:198
uint32 bIsLaptopComputer
Definition GenericPlatformSurvey.h:200
uint32 HardDriveGB
Definition GenericPlatformSurvey.h:192
TCHAR LastPerformanceIndexErrorDetail[MaxStringLength]
Definition GenericPlatformSurvey.h:218
Definition GenericPlatformSurvey.h:124
float ComputeTotalGPUTime() const
Definition GenericPlatformSurvey.h:135
APPLICATIONCORE_API float ComputeCPUPerfIndex(TArray< float > *OutIndividualResults=nullptr) const
Definition GenericPlatformSurvey.cpp:9
FSynthBenchmarkStat CPUStats[2]
Definition GenericPlatformSurvey.h:125
FSynthBenchmarkStat GPUStats[7]
Definition GenericPlatformSurvey.h:126
APPLICATIONCORE_API float ComputeGPUPerfIndex(TArray< float > *OutIndividualResults=nullptr) const
Definition GenericPlatformSurvey.cpp:40
Definition GenericPlatformSurvey.h:30
float GetNormalizedTime() const
Definition GenericPlatformSurvey.h:83
void SetMeasuredTime(const FTimeSample &TimeSample, float InConfidence=90)
Definition GenericPlatformSurvey.h:63
float GetMeasuredTotalTime() const
Definition GenericPlatformSurvey.h:88
const TCHAR * GetValueType() const
Definition GenericPlatformSurvey.h:78
float ComputePerfIndex() const
Definition GenericPlatformSurvey.h:56
FSynthBenchmarkStat(const TCHAR *InDesc, float InIndexNormalizedTime, const TCHAR *InValueType, float InWeight)
Definition GenericPlatformSurvey.h:42
float GetConfidence() const
Definition GenericPlatformSurvey.h:94
const TCHAR * GetDesc() const
Definition GenericPlatformSurvey.h:72
FSynthBenchmarkStat()
Definition GenericPlatformSurvey.h:31
float GetWeight() const
Definition GenericPlatformSurvey.h:99
Definition GenericPlatformSurvey.h:15
float NormalizedTime
Definition GenericPlatformSurvey.h:25
FTimeSample(float InTotalTime, float InNormalizedTime)
Definition GenericPlatformSurvey.h:16
float TotalTime
Definition GenericPlatformSurvey.h:23