You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#jira UE-133395 #rb Zousar.Shaker #rnx [CL 25843613 by devin doucette in ue5-main branch]
68 lines
1.5 KiB
C++
68 lines
1.5 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "DerivedDataCacheStore.h"
|
|
|
|
#include "Async/UniqueLock.h"
|
|
#include "CoreGlobals.h"
|
|
#include "DerivedDataCacheRecord.h"
|
|
#include "DerivedDataValue.h"
|
|
#include "Serialization/CompactBinary.h"
|
|
|
|
namespace UE::DerivedData
|
|
{
|
|
|
|
FCacheStoreRequestTimer::FCacheStoreRequestTimer(FCacheStoreRequestStats& OutStats)
|
|
: Stats(OutStats)
|
|
, StartTime(FMonotonicTimePoint::Now())
|
|
{
|
|
}
|
|
|
|
FCacheStoreRequestTimer::~FCacheStoreRequestTimer()
|
|
{
|
|
const FMonotonicTimePoint EndTime = FMonotonicTimePoint::Now();
|
|
const bool bIsInGameThread = IsInGameThread();
|
|
TUniqueLock Lock(Stats.Mutex);
|
|
(bIsInGameThread ? Stats.MainThreadTime : Stats.OtherThreadTime) = EndTime - StartTime;
|
|
Stats.StartTime = FMath::Min(Stats.StartTime, StartTime);
|
|
Stats.EndTime = FMath::Max(Stats.EndTime, EndTime);
|
|
}
|
|
|
|
void FCacheStoreRequestStats::AddLatency(const FMonotonicTimeSpan InLatency)
|
|
{
|
|
if (Latency > InLatency)
|
|
{
|
|
Latency = InLatency;
|
|
}
|
|
}
|
|
|
|
void FCacheStoreRequestStats::AddLogicalRead(const FCacheRecord& Record)
|
|
{
|
|
if (const FCbObject& Meta = Record.GetMeta())
|
|
{
|
|
LogicalReadSize += Meta.GetSize();
|
|
}
|
|
|
|
for (const FValueWithId& Value : Record.GetValues())
|
|
{
|
|
AddLogicalRead(Value);
|
|
}
|
|
}
|
|
|
|
void FCacheStoreRequestStats::AddLogicalRead(const FValue& Value)
|
|
{
|
|
if (Value.HasData())
|
|
{
|
|
LogicalReadSize += Value.GetRawSize();
|
|
}
|
|
}
|
|
|
|
void FCacheStoreRequestStats::AddLogicalWrite(const FValue& Value)
|
|
{
|
|
if (Value.HasData())
|
|
{
|
|
LogicalWriteSize += Value.GetRawSize();
|
|
}
|
|
}
|
|
|
|
} // UE::DerivedData
|