mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2026-03-28 14:39:43 -06:00
Some checks are pending
Build and Release / reuse (push) Waiting to run
Build and Release / clang-format (push) Waiting to run
Build and Release / get-info (push) Waiting to run
Build and Release / windows-sdl (push) Blocked by required conditions
Build and Release / windows-qt (push) Blocked by required conditions
Build and Release / macos-sdl (push) Blocked by required conditions
Build and Release / macos-qt (push) Blocked by required conditions
Build and Release / linux-sdl (push) Blocked by required conditions
Build and Release / linux-qt (push) Blocked by required conditions
Build and Release / linux-sdl-gcc (push) Blocked by required conditions
Build and Release / linux-qt-gcc (push) Blocked by required conditions
Build and Release / pre-release (push) Blocked by required conditions
50 lines
1.1 KiB
C++
50 lines
1.1 KiB
C++
// SPDX-FileCopyrightText: 2013 Dolphin Emulator Project
|
|
// SPDX-FileCopyrightText: 2014 Citra Emulator Project
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
#pragma once
|
|
|
|
#include <chrono>
|
|
#include "common/types.h"
|
|
|
|
namespace Common {
|
|
|
|
enum class ThreadPriority : u32 {
|
|
Low = 0,
|
|
Normal = 1,
|
|
High = 2,
|
|
VeryHigh = 3,
|
|
Critical = 4,
|
|
};
|
|
|
|
void SetCurrentThreadRealtime(std::chrono::nanoseconds period_ns);
|
|
|
|
void SetCurrentThreadPriority(ThreadPriority new_priority);
|
|
|
|
void SetCurrentThreadName(const char* name);
|
|
|
|
void SetThreadName(void* thread, const char* name);
|
|
|
|
bool AccurateSleep(std::chrono::nanoseconds duration, std::chrono::nanoseconds* remaining,
|
|
bool interruptible);
|
|
|
|
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();
|
|
|
|
std::chrono::nanoseconds GetTotalWait() const {
|
|
return total_wait;
|
|
}
|
|
};
|
|
|
|
} // namespace Common
|