mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-11-15 22:40:06 +00:00
HostTiming: Correct rebase and implement AddTicks.
This commit is contained in:
parent
49a7e0984a
commit
96b2d8419c
@ -36,7 +36,8 @@ struct CoreTiming::Event {
|
|||||||
};
|
};
|
||||||
|
|
||||||
CoreTiming::CoreTiming() {
|
CoreTiming::CoreTiming() {
|
||||||
clock = Common::CreateBestMatchingClock(Core::Timing::BASE_CLOCK_RATE, Core::Timing::CNTFREQ);
|
clock =
|
||||||
|
Common::CreateBestMatchingClock(Core::Hardware::BASE_CLOCK_RATE, Core::Hardware::CNTFREQ);
|
||||||
}
|
}
|
||||||
|
|
||||||
CoreTiming::~CoreTiming() = default;
|
CoreTiming::~CoreTiming() = default;
|
||||||
@ -110,6 +111,14 @@ void CoreTiming::UnscheduleEvent(const std::shared_ptr<EventType>& event_type, u
|
|||||||
basic_lock.unlock();
|
basic_lock.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CoreTiming::AddTicks(std::size_t core_index, u64 ticks) {
|
||||||
|
ticks_count[core_index] += ticks;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CoreTiming::ResetTicks(std::size_t core_index) {
|
||||||
|
ticks_count[core_index] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
u64 CoreTiming::GetCPUTicks() const {
|
u64 CoreTiming::GetCPUTicks() const {
|
||||||
return clock->GetCPUCycles();
|
return clock->GetCPUCycles();
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <atomic>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
@ -18,6 +19,7 @@
|
|||||||
#include "common/thread.h"
|
#include "common/thread.h"
|
||||||
#include "common/threadsafe_queue.h"
|
#include "common/threadsafe_queue.h"
|
||||||
#include "common/wall_clock.h"
|
#include "common/wall_clock.h"
|
||||||
|
#include "core/hardware_properties.h"
|
||||||
|
|
||||||
namespace Core::HostTiming {
|
namespace Core::HostTiming {
|
||||||
|
|
||||||
@ -91,6 +93,11 @@ public:
|
|||||||
/// We only permit one event of each type in the queue at a time.
|
/// We only permit one event of each type in the queue at a time.
|
||||||
void RemoveEvent(const std::shared_ptr<EventType>& event_type);
|
void RemoveEvent(const std::shared_ptr<EventType>& event_type);
|
||||||
|
|
||||||
|
|
||||||
|
void AddTicks(std::size_t core_index, u64 ticks);
|
||||||
|
|
||||||
|
void ResetTicks(std::size_t core_index);
|
||||||
|
|
||||||
/// Returns current time in emulated CPU cycles
|
/// Returns current time in emulated CPU cycles
|
||||||
u64 GetCPUTicks() const;
|
u64 GetCPUTicks() const;
|
||||||
|
|
||||||
@ -138,6 +145,8 @@ private:
|
|||||||
std::atomic<bool> wait_set{};
|
std::atomic<bool> wait_set{};
|
||||||
std::atomic<bool> shutting_down{};
|
std::atomic<bool> shutting_down{};
|
||||||
std::atomic<bool> has_started{};
|
std::atomic<bool> has_started{};
|
||||||
|
|
||||||
|
std::array<std::atomic<u64>, Core::Hardware::NUM_CPU_CORES> ticks_count{};
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Creates a core timing event with the given name and callback.
|
/// Creates a core timing event with the given name and callback.
|
||||||
|
Loading…
Reference in New Issue
Block a user