Files
UnrealEngineUWP/Engine/Source/Programs/CrashReporter/CrashReportClient/Private/MainLoopTiming.cpp
Matthew Griffin bb70b349ce Merging CL 2804086 from //UE4/Release-4.11 to Dev-Main (//UE4/Dev-Main) to isolate copyright update
#lockdown Nick.Penwarden

[CL 2819020 by Matthew Griffin in Main branch]
2016-01-07 08:17:16 -05:00

42 lines
1.1 KiB
C++

// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
#include "CrashReportClientApp.h"
#include "MainLoopTiming.h"
#include "LaunchEngineLoop.h"
#include "TaskGraphInterfaces.h"
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);
#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;
}