Add CPU Clock Frequency slider
This slider affects the number of cycles that the guest cpu emulation reports that have passed since the last time slice. This option scales the result returned by a percentage that the user selects. In some games underclocking the CPU can give a major speedup. Exposing this as an option will give users something to toy with for performance, while also potentially enhancing games that experience lag on the real console
This commit is contained in:
parent
55ec7031cc
commit
276d56ca9b
15 changed files with 204 additions and 84 deletions
|
@ -148,6 +148,7 @@ public:
|
|||
|
||||
class Timer {
|
||||
public:
|
||||
Timer(double cpu_clock_scale);
|
||||
~Timer();
|
||||
|
||||
s64 GetMaxSliceLength() const;
|
||||
|
@ -190,10 +191,13 @@ 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;
|
||||
};
|
||||
|
||||
explicit Timing(std::size_t num_cores);
|
||||
explicit Timing(std::size_t num_cores, u32 cpu_clock_percentage);
|
||||
|
||||
~Timing(){};
|
||||
|
||||
|
@ -220,6 +224,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);
|
||||
|
@ -229,10 +238,14 @@ 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;
|
||||
};
|
||||
|
||||
} // namespace Core
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue