UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
UE::Net::TBinnedMovingValue< ConsumerType, NumBins, InMode > Class Template Reference

#include <NetStatsUtils.h>

+ Inheritance diagram for UE::Net::TBinnedMovingValue< ConsumerType, NumBins, InMode >:

Public Member Functions

 TBinnedMovingValue (double TimePerBin)
 
void AddMeasurement (double TimeVal, double Value)
 
void Flush ()
 
- Public Member Functions inherited from UE::Net::FBinnedMovingValueBase
NETCORE_API double GetSample () const
 
NETCORE_API void Reset ()
 
- Public Member Functions inherited from UE::Net::TSampleProducer< ConsumerType >
void SetConsumer (ConsumerType *InConsumer)
 

Additional Inherited Members

- Protected Member Functions inherited from UE::Net::FBinnedMovingValueBase
 FBinnedMovingValueBase ()=delete
 
NETCORE_API FBinnedMovingValueBase (const TArrayView< FBin > InBins, double InTimePerBin, EBinnedValueMode InMode)
 
NETCORE_API void AddMeasurement_Implementation (double TimeVal, double Value, TOptional< double > &OutSample)
 
- Protected Member Functions inherited from UE::Net::TSampleProducer< ConsumerType >
void OutputSample (double Value)
 
template<typename InnerConsumerType = ConsumerType, typename = typename TEnableIf<TModels_V<CPeekMeasurements, InnerConsumerType>>::Type>
void PeekMeasurement (double TimeVal, double Value)
 
template<typename InnerConsumerType = ConsumerType, typename = typename TEnableIf<!TModels_V<CPeekMeasurements, InnerConsumerType>>::Type, int32 UnusedParamForODR = 0>
void PeekMeasurement (double TimeVal, double Value)
 

Detailed Description

template<typename ConsumerType, int32 NumBins, EBinnedValueMode InMode>
class UE::Net::TBinnedMovingValue< ConsumerType, NumBins, InMode >

Tracks/stores a moving average or moving sum over a period of time, binning the accumulated values into different time periods, for smoothing and balancing the memory/accuracy cost of dropping old values as they fall out of the measured time period.

Use TBinnedMovingAvg/TBinnedMovingSum aliases, instead of using this directly.

Measurements are input using AddMeasurement, and samples/values are output to the specified consumer, which is set using SetConsumer.

Samples are automatically output when all of the data bins fill and are rolled over - this guarantees perfect accuracy over the full time period. Samples can be manually output using Flush, but this can be less accurate depending on the use case - see Flush for more information.

Parameters
ConsumerTypeThe type which will be used for consuming samples.
NumBinsThe number of bins to use.
InModeInternal

Constructor & Destructor Documentation

◆ TBinnedMovingValue()

template<typename ConsumerType , int32 NumBins, EBinnedValueMode InMode>
UE::Net::TBinnedMovingValue< ConsumerType, NumBins, InMode >::TBinnedMovingValue ( double  TimePerBin)
inlineexplicit

Main constructor

Parameters
TimePerBinThe amount of time that each bin represents.

Member Function Documentation

◆ AddMeasurement()

template<typename ConsumerType , int32 NumBins, EBinnedValueMode InMode>
void UE::Net::TBinnedMovingValue< ConsumerType, NumBins, InMode >::AddMeasurement ( double  TimeVal,
double  Value 
)
inline

Inputs a measurement value and the approximate time it was measured.

Parameters
TimeValThe time of the measurement.
ValueThe measurement value

◆ Flush()

template<typename ConsumerType , int32 NumBins, EBinnedValueMode InMode>
void UE::Net::TBinnedMovingValue< ConsumerType, NumBins, InMode >::Flush ( )
inline

Flushes a sample from the current bin values to the consumer.

Since this is a moving value, none of the bins are reset when a sample is output (so the flushed sample can partially reflect old values), and the current bin will have been reset recently so it can be filled (so the flushed value may not reflect the full time period).

The user must consider whether this is accurate/suitable for their use case.


The documentation for this class was generated from the following file: