HostInterface: Move throttle and perf stats to System class

This commit is contained in:
Connor McLaughlin
2020-02-09 22:16:25 +09:00
parent 895cefec60
commit c820ddba79
10 changed files with 180 additions and 182 deletions

View File

@ -38,9 +38,6 @@ public:
/// Returns the game list.
const GameList* GetGameList() const { return m_game_list.get(); }
/// Adjusts the throttle frequency, i.e. how many times we should sleep per second.
void SetThrottleFrequency(double frequency) { m_throttle_period = static_cast<s64>(1000000000.0 / frequency); }
bool CreateSystem();
bool BootSystem(const char* filename, const char* state_filename);
void ResetSystem();
@ -68,12 +65,7 @@ public:
/// Returns a path relative to the user directory.
std::string GetUserDirectoryRelativePath(const char* format, ...) const;
/// Throttles the system, i.e. sleeps until it's time to execute the next frame.
void Throttle();
protected:
using ThrottleClock = std::chrono::steady_clock;
enum : u32
{
AUDIO_SAMPLE_RATE = 44100,
@ -90,7 +82,7 @@ protected:
};
virtual void SwitchGPURenderer();
virtual void OnPerformanceCountersUpdated();
virtual void OnSystemPerformanceCountersUpdated();
virtual void OnRunningGameChanged();
void SetUserDirectory();
@ -132,8 +124,6 @@ protected:
/// Adjusts the internal (render) resolution of the hardware backends.
void ModifyResolutionScale(s32 increment);
void RunFrame();
void UpdateSpeedLimiterState();
void DrawFPSWindow();
@ -141,9 +131,6 @@ protected:
void DrawDebugWindows();
void ClearImGuiFocus();
void UpdatePerformanceCounters();
void ResetPerformanceCounters();
std::unique_ptr<HostDisplay> m_display;
std::unique_ptr<AudioStream> m_audio_stream;
std::unique_ptr<System> m_system;
@ -151,29 +138,10 @@ protected:
Settings m_settings;
std::string m_user_directory;
u64 m_last_throttle_time = 0;
s64 m_throttle_period = INT64_C(1000000000) / 60;
Common::Timer m_throttle_timer;
Common::Timer m_speed_lost_time_timestamp;
bool m_paused = false;
bool m_speed_limiter_temp_disabled = false;
bool m_speed_limiter_enabled = false;
float m_average_frame_time_accumulator = 0.0f;
float m_worst_frame_time_accumulator = 0.0f;
float m_vps = 0.0f;
float m_fps = 0.0f;
float m_speed = 0.0f;
float m_worst_frame_time = 0.0f;
float m_average_frame_time = 0.0f;
u32 m_last_frame_number = 0;
u32 m_last_internal_frame_number = 0;
u32 m_last_global_tick_counter = 0;
Common::Timer m_fps_timer;
Common::Timer m_frame_timer;
std::deque<OSDMessage> m_osd_messages;
std::mutex m_osd_messages_lock;
};