Merge remote-tracking branch 'upstream/master' into feature/savestates-2

This commit is contained in:
Hamish Milne 2020-03-28 12:46:24 +00:00
commit 03379b2072
17 changed files with 224 additions and 93 deletions

View file

@ -176,6 +176,7 @@ public:
class Timer {
public:
Timer();
~Timer();
s64 GetMaxSliceLength() const;
@ -218,7 +219,10 @@ public:
s64 slice_length = MAX_SLICE_LENGTH;
s64 downcount = MAX_SLICE_LENGTH;
s64 executed_ticks = 0;
u64 idled_cycles;
u64 idled_cycles = 0;
// Stores a scaling for the internal clockspeed. Changing this number results in
// under/overclocking the guest cpu
double cpu_clock_scale = 1.0;
template <class Archive>
void serialize(Archive& ar, const unsigned int) {
@ -234,7 +238,7 @@ public:
friend class boost::serialization::access;
};
explicit Timing(std::size_t num_cores);
explicit Timing(std::size_t num_cores, u32 cpu_clock_percentage);
~Timing(){};
@ -261,6 +265,11 @@ public:
global_timer += ticks;
}
/**
* Updates the value of the cpu clock scaling to the new percentage.
*/
void UpdateClockSpeed(u32 cpu_clock_percentage);
std::chrono::microseconds GetGlobalTimeUs() const;
std::shared_ptr<Timer> GetTimer(std::size_t cpu_id);
@ -270,11 +279,15 @@ private:
// unordered_map stores each element separately as a linked list node so pointers to
// elements remain stable regardless of rehashes/resizing.
std::unordered_map<std::string, TimingEventType> event_types;
std::unordered_map<std::string, TimingEventType> event_types = {};
std::vector<std::shared_ptr<Timer>> timers;
std::shared_ptr<Timer> current_timer;
// Stores a scaling for the internal clockspeed. Changing this number results in
// under/overclocking the guest cpu
double cpu_clock_scale = 1.0;
template <class Archive>
void serialize(Archive& ar, const unsigned int) {
// event_types set during initialization of other things