2024-02-27 22:10:34 +00:00
|
|
|
// SPDX-FileCopyrightText: 2013 Dolphin Emulator Project
|
|
|
|
// SPDX-FileCopyrightText: 2014 Citra Emulator Project
|
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2024-09-19 22:28:35 +00:00
|
|
|
#include <chrono>
|
2024-02-27 22:10:34 +00:00
|
|
|
#include "common/types.h"
|
|
|
|
|
|
|
|
namespace Common {
|
|
|
|
|
|
|
|
enum class ThreadPriority : u32 {
|
|
|
|
Low = 0,
|
|
|
|
Normal = 1,
|
|
|
|
High = 2,
|
|
|
|
VeryHigh = 3,
|
|
|
|
Critical = 4,
|
|
|
|
};
|
|
|
|
|
2024-09-19 22:28:35 +00:00
|
|
|
void SetCurrentThreadRealtime(std::chrono::nanoseconds period_ns);
|
|
|
|
|
2024-02-27 22:10:34 +00:00
|
|
|
void SetCurrentThreadPriority(ThreadPriority new_priority);
|
|
|
|
|
|
|
|
void SetCurrentThreadName(const char* name);
|
|
|
|
|
2024-09-23 15:43:51 +00:00
|
|
|
class AccurateTimer {
|
|
|
|
std::chrono::nanoseconds target_interval{};
|
|
|
|
std::chrono::nanoseconds total_wait{};
|
|
|
|
|
|
|
|
std::chrono::high_resolution_clock::time_point start_time;
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit AccurateTimer(std::chrono::nanoseconds target_interval);
|
|
|
|
|
|
|
|
void Start();
|
|
|
|
|
|
|
|
void End();
|
|
|
|
};
|
|
|
|
|
2024-02-27 22:10:34 +00:00
|
|
|
} // namespace Common
|