Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
FThreadHeartBeat Class Reference

#include <ThreadHeartBeat.h>

+ Inheritance diagram for FThreadHeartBeat:
+ Collaboration diagram for FThreadHeartBeat:

Classes

struct  FHeartBeatInfo
 

Public Types

enum  EConstants { InvalidThreadId = (uint32)-1 , PresentThreadId = (uint32)-2 }
 

Public Member Functions

void Start ()
 
void HeartBeat (bool bReadConfig=false)
 
void PresentFrame ()
 
uint32 CheckHeartBeat (double &OutHangDuration)
 
void KillHeartBeat ()
 
void MonitorFunctionStart ()
 
void MonitorFunctionEnd ()
 
uint32 CheckFunctionHeartBeat (double &OutHangDuration)
 
void MonitorCheckpointStart (FName EndCheckPoint, double TimeToReachCheckpoint)
 
void MonitorCheckpointEnd (FName CheckPoint)
 
uint32 CheckCheckpointHeartBeat (double &OutHangDuration)
 
void SuspendHeartBeat (bool bAllThreads=false)
 
void ResumeHeartBeat (bool bAllThreads=false)
 
bool IsBeating ()
 
void SetDurationMultiplier (double NewMultiplier)
 
uint32 GetLastHungThreadId () const
 
uint32 GetLastStuckThreadId () const
 
FOnThreadStuckGetOnThreadStuck ()
 
FOnThreadUnstuckGetOnThreadUnstuck ()
 
FOnHangDelegateGetOnHangDelegate ()
 
double GetHangDuration () const
 
virtual bool Init ()
 
virtual uint32 Run ()
 
virtual void Stop ()
 
- Public Member Functions inherited from FRunnable
virtual void Exit ()
 
virtual class FSingleThreadRunnableGetSingleThreadInterface ()
 
virtual ~FRunnable ()
 

Static Public Member Functions

static FThreadHeartBeatGet ()
 
static FThreadHeartBeatGetNoInit ()
 

Private Member Functions

 FThreadHeartBeat ()
 
virtual ~FThreadHeartBeat ()
 
void InitSettings ()
 
void FORCENOINLINE OnHang (double HangDuration, uint32 ThreadThatHung)
 
void FORCENOINLINE OnPresentHang (double HangDuration)
 
bool IsEnabled ()
 

Private Attributes

FRunnableThreadThread
 
FThreadSafeCounter StopTaskCounter
 
FCriticalSection HeartBeatCritical
 
TMap< uint32, FHeartBeatInfoThreadHeartBeat
 
FHeartBeatInfo PresentHeartBeat
 
FCriticalSection FunctionHeartBeatCritical
 
TMap< uint32, FHeartBeatInfoFunctionHeartBeat
 
FCriticalSection CheckpointHeartBeatCritical
 
TMap< FName, FHeartBeatInfoCheckpointHeartBeat
 
FThreadSafeBool bReadyToCheckHeartbeat
 
double ConfigHangDuration
 
double CurrentHangDuration
 
double ConfigPresentDuration
 
double CurrentPresentDuration
 
double ConfigStuckDuration
 
double CurrentStuckDuration
 
double HangDurationMultiplier
 
uint32 LastHangCallstackCRC
 
uint32 LastHungThreadId
 
uint32 LastStuckThreadId
 
bool bHangsAreFatal
 
FThreadSafeCounter GlobalSuspendCount
 
int32 CheckpointSuspendCount
 
FThreadHeartBeatClock Clock
 
FOnThreadStuck OnStuck
 
FOnThreadUnstuck OnUnstuck
 
FOnHangDelegate OnHangDelegate
 

Static Private Attributes

static FThreadHeartBeatSingleton
 

Detailed Description

Thread heartbeat check class. Used by crash handling code to check for hangs.

Definition at line 52 of file ThreadHeartBeat.h.

Member Enumeration Documentation

◆ EConstants

Enumerator
InvalidThreadId 

Invalid thread Id used by CheckHeartBeat

PresentThreadId 

Id used to track presented frames (supported platforms only).

Definition at line 165 of file ThreadHeartBeat.h.

Constructor & Destructor Documentation

◆ FThreadHeartBeat()

FThreadHeartBeat::FThreadHeartBeat ( )
private

Member Function Documentation

◆ CheckCheckpointHeartBeat()

uint32 FThreadHeartBeat::CheckCheckpointHeartBeat ( double & OutHangDuration)

◆ CheckFunctionHeartBeat()

uint32 FThreadHeartBeat::CheckFunctionHeartBeat ( double & OutHangDuration)

Called by a supervising thread to check all function calls' being monitored health

◆ CheckHeartBeat()

uint32 FThreadHeartBeat::CheckHeartBeat ( double & OutHangDuration)

Called by a supervising thread to check the threads' health

◆ Get()

static FThreadHeartBeat & FThreadHeartBeat::Get ( )
static

Gets the heartbeat singleton

◆ GetHangDuration()

double FThreadHeartBeat::GetHangDuration ( ) const
inline

Definition at line 258 of file ThreadHeartBeat.h.

◆ GetLastHungThreadId()

uint32 FThreadHeartBeat::GetLastHungThreadId ( ) const
inline

Definition at line 232 of file ThreadHeartBeat.h.

◆ GetLastStuckThreadId()

uint32 FThreadHeartBeat::GetLastStuckThreadId ( ) const
inline

Definition at line 238 of file ThreadHeartBeat.h.

◆ GetNoInit()

static FThreadHeartBeat * FThreadHeartBeat::GetNoInit ( )
static
+ Here is the caller graph for this function:

◆ GetOnHangDelegate()

FOnHangDelegate & FThreadHeartBeat::GetOnHangDelegate ( )
inline

Definition at line 252 of file ThreadHeartBeat.h.

◆ GetOnThreadStuck()

FOnThreadStuck & FThreadHeartBeat::GetOnThreadStuck ( )
inline

Definition at line 243 of file ThreadHeartBeat.h.

◆ GetOnThreadUnstuck()

FOnThreadUnstuck & FThreadHeartBeat::GetOnThreadUnstuck ( )
inline

Definition at line 244 of file ThreadHeartBeat.h.

◆ HeartBeat()

void FThreadHeartBeat::HeartBeat ( bool bReadConfig = false)

Called from a thread once per frame to update the heartbeat time

◆ Init()

virtual bool FThreadHeartBeat::Init ( )
virtual

Initializes the runnable object.

This method is called in the context of the thread object that aggregates this, not the thread that passes this runnable to a new thread.

Returns
True if initialization was successful, false otherwise
See also
Run, Stop, Exit

Reimplemented from FRunnable.

◆ InitSettings()

void FThreadHeartBeat::InitSettings ( )
private

◆ IsBeating()

bool FThreadHeartBeat::IsBeating ( )

Returns true/false if this thread is currently performing heartbeat monitoring

◆ IsEnabled()

bool FThreadHeartBeat::IsEnabled ( )
private

◆ KillHeartBeat()

void FThreadHeartBeat::KillHeartBeat ( )

Called by a thread when it's no longer expecting to be ticked

◆ MonitorCheckpointEnd()

void FThreadHeartBeat::MonitorCheckpointEnd ( FName CheckPoint)

◆ MonitorCheckpointStart()

void FThreadHeartBeat::MonitorCheckpointStart ( FName EndCheckPoint,
double TimeToReachCheckpoint )

◆ MonitorFunctionEnd()

void FThreadHeartBeat::MonitorFunctionEnd ( )

Called by a thread when a function has completed and no longer needs to be monitored

+ Here is the caller graph for this function:

◆ MonitorFunctionStart()

void FThreadHeartBeat::MonitorFunctionStart ( )

Called from a thread once on entry to a function to be monitored

+ Here is the caller graph for this function:

◆ OnHang()

void FORCENOINLINE FThreadHeartBeat::OnHang ( double HangDuration,
uint32 ThreadThatHung )
private

◆ OnPresentHang()

void FORCENOINLINE FThreadHeartBeat::OnPresentHang ( double HangDuration)
private

◆ PresentFrame()

void FThreadHeartBeat::PresentFrame ( )

Called from the rendering or RHI thread when the platform RHI presents a frame (supported platforms only).

◆ ResumeHeartBeat()

void FThreadHeartBeat::ResumeHeartBeat ( bool bAllThreads = false)

Resume heartbeat measuring for the current thread

Parameters
bAllThreadsIf true, resumes heartbeat for all threads, not only the current one
+ Here is the caller graph for this function:

◆ Run()

virtual uint32 FThreadHeartBeat::Run ( )
virtual

Runs the runnable object.

This is where all per object thread work is done. This is only called if the initialization was successful.

Returns
The exit code of the runnable object
See also
Init, Stop, Exit

Implements FRunnable.

◆ SetDurationMultiplier()

void FThreadHeartBeat::SetDurationMultiplier ( double NewMultiplier)

Sets a multiplier to the hang duration (>= 1.0). Can be used to extend the duration during loading screens etc.

◆ Start()

void FThreadHeartBeat::Start ( )

Begin measuring heartbeat

◆ Stop()

virtual void FThreadHeartBeat::Stop ( )
virtual

Stops the runnable object.

This is called if a thread is requested to terminate early.

See also
Init, Run, Exit

Reimplemented from FRunnable.

◆ SuspendHeartBeat()

void FThreadHeartBeat::SuspendHeartBeat ( bool bAllThreads = false)

Suspend heartbeat measuring for the current thread if the thread has already had a heartbeat

Parameters
bAllThreadsIf true, suspends heartbeat for all threads, not only the current one
+ Here is the caller graph for this function:

◆ ~FThreadHeartBeat()

virtual FThreadHeartBeat::~FThreadHeartBeat ( )
privatevirtual

Member Data Documentation

◆ bHangsAreFatal

bool FThreadHeartBeat::bHangsAreFatal
private

Definition at line 140 of file ThreadHeartBeat.h.

◆ bReadyToCheckHeartbeat

FThreadSafeBool FThreadHeartBeat::bReadyToCheckHeartbeat
private

True if heartbeat should be measured

Definition at line 122 of file ThreadHeartBeat.h.

◆ CheckpointHeartBeat

TMap<FName, FHeartBeatInfo> FThreadHeartBeat::CheckpointHeartBeat
private

Keeps track of the last heartbeat time for a checkpoint

Definition at line 119 of file ThreadHeartBeat.h.

◆ CheckpointHeartBeatCritical

FCriticalSection FThreadHeartBeat::CheckpointHeartBeatCritical
private

Synch object for the checkpoint heartbeat

Definition at line 117 of file ThreadHeartBeat.h.

◆ CheckpointSuspendCount

int32 FThreadHeartBeat::CheckpointSuspendCount
private

Definition at line 143 of file ThreadHeartBeat.h.

◆ Clock

FThreadHeartBeatClock FThreadHeartBeat::Clock
private

Definition at line 145 of file ThreadHeartBeat.h.

◆ ConfigHangDuration

double FThreadHeartBeat::ConfigHangDuration
private

Max time the thread is allowed to not send the heartbeat

Definition at line 124 of file ThreadHeartBeat.h.

◆ ConfigPresentDuration

double FThreadHeartBeat::ConfigPresentDuration
private

Definition at line 126 of file ThreadHeartBeat.h.

◆ ConfigStuckDuration

double FThreadHeartBeat::ConfigStuckDuration
private

Definition at line 128 of file ThreadHeartBeat.h.

◆ CurrentHangDuration

double FThreadHeartBeat::CurrentHangDuration
private

Definition at line 125 of file ThreadHeartBeat.h.

◆ CurrentPresentDuration

double FThreadHeartBeat::CurrentPresentDuration
private

Definition at line 127 of file ThreadHeartBeat.h.

◆ CurrentStuckDuration

double FThreadHeartBeat::CurrentStuckDuration
private

Definition at line 129 of file ThreadHeartBeat.h.

◆ FunctionHeartBeat

TMap<uint32, FHeartBeatInfo> FThreadHeartBeat::FunctionHeartBeat
private

Keeps track of the last heartbeat time for a function, can't be nested

Definition at line 114 of file ThreadHeartBeat.h.

◆ FunctionHeartBeatCritical

FCriticalSection FThreadHeartBeat::FunctionHeartBeatCritical
private

Synch object for the function heartbeat

Definition at line 112 of file ThreadHeartBeat.h.

◆ GlobalSuspendCount

FThreadSafeCounter FThreadHeartBeat::GlobalSuspendCount
private

Definition at line 142 of file ThreadHeartBeat.h.

◆ HangDurationMultiplier

double FThreadHeartBeat::HangDurationMultiplier
private

Definition at line 131 of file ThreadHeartBeat.h.

◆ HeartBeatCritical

FCriticalSection FThreadHeartBeat::HeartBeatCritical
private

Synch object for the heartbeat

Definition at line 105 of file ThreadHeartBeat.h.

◆ LastHangCallstackCRC

uint32 FThreadHeartBeat::LastHangCallstackCRC
private

CRC of the last hang's callstack

Definition at line 134 of file ThreadHeartBeat.h.

◆ LastHungThreadId

uint32 FThreadHeartBeat::LastHungThreadId
private

Id of the last thread that hung

Definition at line 136 of file ThreadHeartBeat.h.

◆ LastStuckThreadId

uint32 FThreadHeartBeat::LastStuckThreadId
private

Definition at line 138 of file ThreadHeartBeat.h.

◆ OnHangDelegate

FOnHangDelegate FThreadHeartBeat::OnHangDelegate
private

Definition at line 150 of file ThreadHeartBeat.h.

◆ OnStuck

FOnThreadStuck FThreadHeartBeat::OnStuck
private

Definition at line 147 of file ThreadHeartBeat.h.

◆ OnUnstuck

FOnThreadUnstuck FThreadHeartBeat::OnUnstuck
private

Definition at line 148 of file ThreadHeartBeat.h.

◆ PresentHeartBeat

FHeartBeatInfo FThreadHeartBeat::PresentHeartBeat
private

The last heartbeat time for the rendering or RHI thread frame present.

Definition at line 109 of file ThreadHeartBeat.h.

◆ Singleton

FThreadHeartBeat* FThreadHeartBeat::Singleton
staticprivate

Definition at line 54 of file ThreadHeartBeat.h.

◆ StopTaskCounter

FThreadSafeCounter FThreadHeartBeat::StopTaskCounter
private

Stops this thread

Definition at line 103 of file ThreadHeartBeat.h.

◆ Thread

FRunnableThread* FThreadHeartBeat::Thread
private

Thread to run the worker FRunnable on

Definition at line 101 of file ThreadHeartBeat.h.

◆ ThreadHeartBeat

TMap<uint32, FHeartBeatInfo> FThreadHeartBeat::ThreadHeartBeat
private

Keeps track of the last heartbeat time for threads

Definition at line 107 of file ThreadHeartBeat.h.


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