Common/Timer: Add additional sleep functions

This commit is contained in:
Connor McLaughlin
2021-01-26 02:20:38 +10:00
parent 0d473e8681
commit 52f5ca7e28
2 changed files with 130 additions and 3 deletions

View File

@ -1,5 +1,4 @@
#pragma once
#include "types.h"
#include <cstdint>
namespace Common {
@ -7,7 +6,7 @@ namespace Common {
class Timer
{
public:
using Value = u64;
using Value = std::uint64_t;
Timer();
@ -15,6 +14,12 @@ public:
static double ConvertValueToSeconds(Value value);
static double ConvertValueToMilliseconds(Value value);
static double ConvertValueToNanoseconds(Value value);
static Value ConvertSecondsToValue(double s);
static Value ConvertMillisecondsToValue(double s);
static Value ConvertNanosecondsToValue(double ns);
static void BusyWait(std::uint64_t ns);
static void HybridSleep(std::uint64_t ns, std::uint64_t min_sleep_time = UINT64_C(2000000));
static void NanoSleep(std::uint64_t ns);
void Reset();