mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-05-22 03:15:01 +00:00
common: Rework timekeeping with native RDTSC and port to linux
This commit is contained in:
parent
acfa56f6bc
commit
fe43558779
37 changed files with 818 additions and 279 deletions
32
src/common/native_clock.h
Normal file
32
src/common/native_clock.h
Normal file
|
@ -0,0 +1,32 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <chrono>
|
||||
#include "common/types.h"
|
||||
|
||||
namespace Common {
|
||||
|
||||
class NativeClock final {
|
||||
public:
|
||||
explicit NativeClock();
|
||||
|
||||
u64 GetTscFrequency() const {
|
||||
return rdtsc_frequency;
|
||||
}
|
||||
|
||||
u64 GetTimeNS() const;
|
||||
u64 GetTimeUS() const;
|
||||
u64 GetTimeMS() const;
|
||||
u64 GetUptime() const;
|
||||
u64 GetProcessTimeUS() const;
|
||||
|
||||
private:
|
||||
u64 rdtsc_frequency;
|
||||
u64 ns_rdtsc_factor;
|
||||
u64 us_rdtsc_factor;
|
||||
u64 ms_rdtsc_factor;
|
||||
};
|
||||
|
||||
} // namespace Common
|
Loading…
Add table
Add a link
Reference in a new issue