Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
WindowsPlatformTime.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreTypes.h"
6#include "GenericPlatform/GenericPlatformTime.h"
7#include "Windows/WindowsSystemIncludes.h"
8
9
10/**
11 * Windows implementation of the Time OS functions.
12 *
13 * Please see following UDN post about using rdtsc on processors that support
14 * result being invariant across cores.
15 *
16 * https://udn.epicgames.com/lists/showpost.php?id=46794&list=unprog3
17 */
20{
21 static double InitTiming();
22
23 static FORCEINLINE double Seconds()
24 {
25 Windows::LARGE_INTEGER Cycles;
27
28 // add big number to make bugs apparent where return value is being passed to float
29 return (double)Cycles.QuadPart * GetSecondsPerCycle() + 16777216.0;
30 }
31
32 static FORCEINLINE uint32 Cycles()
33 {
34 Windows::LARGE_INTEGER Cycles;
36 return (uint32)Cycles.QuadPart;
37 }
38
39 static FORCEINLINE uint64 Cycles64()
40 {
41 Windows::LARGE_INTEGER Cycles;
43 return Cycles.QuadPart;
44 }
45
46
47 static void SystemTime( int32& Year, int32& Month, int32& DayOfWeek, int32& Day, int32& Hour, int32& Min, int32& Sec, int32& MSec );
48 static void UtcTime( int32& Year, int32& Month, int32& DayOfWeek, int32& Day, int32& Hour, int32& Min, int32& Sec, int32& MSec );
49
50 static bool UpdateCPUTime( float DeltaTime );
51 static bool UpdateThreadCPUTime(float = 0.0);
52 static void AutoUpdateGameThreadCPUTime(double UpdateInterval);
56
57protected:
58
59 /** Percentage CPU utilization for the last interval relative to one core. */
60 static float CPUTimePctRelative;
61};
62
63
#define FORCEINLINE
Definition Platform.h:644
FWindowsPlatformTime FPlatformTime
FORCEINLINE BOOL WINAPI QueryPerformanceCounter(LARGE_INTEGER *Cycles)
static double GetSecondsPerCycle()
static void SystemTime(int32 &Year, int32 &Month, int32 &DayOfWeek, int32 &Day, int32 &Hour, int32 &Min, int32 &Sec, int32 &MSec)
static FCPUTime GetCPUTime()
static bool UpdateCPUTime(float DeltaTime)
static FORCEINLINE double Seconds()
static void UtcTime(int32 &Year, int32 &Month, int32 &DayOfWeek, int32 &Day, int32 &Hour, int32 &Min, int32 &Sec, int32 &MSec)
static void AutoUpdateGameThreadCPUTime(double UpdateInterval)
static FORCEINLINE uint64 Cycles64()
static FCPUTime GetThreadCPUTime()
static double InitTiming()
static bool UpdateThreadCPUTime(float=0.0)
static double GetLastIntervalThreadCPUTimeInSeconds()
static FORCEINLINE uint32 Cycles()