Files
UnrealEngineUWP/Engine/Source/Programs/CrashReportClient/Private/MainLoopTiming.cpp
patrick laflamme dc2f183374 Fixed hang in crash reporter client when reporting bug in unattended mode.
- Ensured the new FTSTicker get ticked when running CRC in unattended mode.

#rb Jerome.Delattre
[FYI] Dmytro.vovk

#ROBOMERGE-SOURCE: CL 17157164 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v855-17104924)

[CL 17157202 by patrick laflamme in ue5-release-engine-test branch]
2021-08-12 15:34:48 -04:00

49 lines
1.4 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "MainLoopTiming.h"
#include "HAL/PlatformProcess.h"
#include "Math/UnrealMathUtility.h"
#include "Containers/Ticker.h"
#include "CrashReportClientApp.h"
#include "Async/TaskGraphInterfaces.h"
#if !CRASH_REPORT_UNATTENDED_ONLY
#include "Framework/Application/SlateApplication.h"
#endif
FMainLoopTiming::FMainLoopTiming(float InIdealTickRate, EMainLoopOptions::Type Options)
: IdealFrameTime(1.f / InIdealTickRate)
, bTickSlate(Options & EMainLoopOptions::UsingSlate)
{
}
void FMainLoopTiming::Tick()
{
static double ActualDeltaTime = IdealFrameTime;
static double LastTime = FPlatformTime::Seconds();
// Tick app logic
FTaskGraphInterface::Get().ProcessThreadUntilIdle(ENamedThreads::GameThread);
FTicker::GetCoreTicker().Tick(ActualDeltaTime);
FTSTicker::GetCoreTicker().Tick(ActualDeltaTime);
#if !CRASH_REPORT_UNATTENDED_ONLY
// Tick SlateApplication
if (bTickSlate)
{
FSlateApplication::Get().PumpMessages();
FSlateApplication::Get().Tick();
}
#endif // !CRASH_REPORT_UNATTENDED_ONLY
// Sleep Throttling
// Copied from Community Portal - should be shared
FPlatformProcess::Sleep(FMath::Max<float>(0, IdealFrameTime - (FPlatformTime::Seconds() - LastTime)));
// Calculate deltas
const double AppTime = FPlatformTime::Seconds();
ActualDeltaTime = AppTime - LastTime;
LastTime = AppTime;
}