UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
StatsTrace.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreTypes.h"
6#include "Misc/Build.h"
7#include "Trace/Config.h"
8
9#if !defined(STATSTRACE_ENABLED)
10#if UE_TRACE_ENABLED && STATS && !UE_BUILD_SHIPPING
11#define STATSTRACE_ENABLED 1
12#else
13#define STATSTRACE_ENABLED 0
14#endif
15#endif
16
17#if STATSTRACE_ENABLED
18
19class FName;
20
21struct FStatsTrace
22{
23 CORE_API static void DeclareStat(const FName& Stat, const ANSICHAR* Name, const TCHAR* Description, const ANSICHAR* Group, bool IsFloatingPoint, bool IsMemory, bool ShouldClearEveryFrame);
24 CORE_API static void Increment(const FName& Stat);
25 CORE_API static void Decrement(const FName& Stat);
26 CORE_API static void Add(const FName& Stat, int64 Amount);
27 CORE_API static void Add(const FName& Stat, double Amount);
28 CORE_API static void Set(const FName& Stat, int64 Value);
29 CORE_API static void Set(const FName& Stat, double Value);
30};
31
32#define TRACE_STAT_INCREMENT(Stat) \
33 FStatsTrace::Increment(Stat);
34
35#define TRACE_STAT_DECREMENT(Stat) \
36 FStatsTrace::Decrement(Stat);
37
38#define TRACE_STAT_ADD(Stat, Amount) \
39 FStatsTrace::Add(Stat, Amount);
40
41#define TRACE_STAT_SET(Stat, Value) \
42 FStatsTrace::Set(Stat, Value);
43
44#else
45
46#define TRACE_STAT_INCREMENT(...)
47#define TRACE_STAT_DECREMENT(...)
48#define TRACE_STAT_ADD(...)
49#define TRACE_STAT_SET(...)
50
51#endif
FPlatformTypes::TCHAR TCHAR
Either ANSICHAR or WIDECHAR, depending on whether the platform supports wide characters or the requir...
Definition Platform.h:1135
FPlatformTypes::int64 int64
A 64-bit signed integer.
Definition Platform.h:1127
FPlatformTypes::ANSICHAR ANSICHAR
An ANSI character. Normally a signed type.
Definition Platform.h:1131
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
Definition NameTypes.h:617