mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2025-01-04 06:10:05 +00:00
907507886d
Allows us to directly calculate the GPU tick without double conversion to and from the host clock tick.
42 lines
882 B
C++
42 lines
882 B
C++
// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
#pragma once
|
|
|
|
#include "common/wall_clock.h"
|
|
|
|
namespace Common::X64 {
|
|
|
|
class NativeClock final : public WallClock {
|
|
public:
|
|
explicit NativeClock(u64 rdtsc_frequency_);
|
|
|
|
std::chrono::nanoseconds GetTimeNS() const override;
|
|
|
|
std::chrono::microseconds GetTimeUS() const override;
|
|
|
|
std::chrono::milliseconds GetTimeMS() const override;
|
|
|
|
u64 GetCNTPCT() const override;
|
|
|
|
u64 GetGPUTick() const override;
|
|
|
|
u64 GetHostTicksNow() const override;
|
|
|
|
u64 GetHostTicksElapsed() const override;
|
|
|
|
bool IsNative() const override;
|
|
|
|
private:
|
|
u64 start_ticks;
|
|
u64 rdtsc_frequency;
|
|
|
|
u64 ns_rdtsc_factor;
|
|
u64 us_rdtsc_factor;
|
|
u64 ms_rdtsc_factor;
|
|
u64 cntpct_rdtsc_factor;
|
|
u64 gputick_rdtsc_factor;
|
|
};
|
|
|
|
} // namespace Common::X64
|