FPSCounter.h 613 B

123456789101112131415161718192021222324252627282930313233
  1. // Copyright 2008 Dolphin Emulator Project
  2. // Licensed under GPLv2+
  3. // Refer to the license.txt file included.
  4. #pragma once
  5. #include <fstream>
  6. #include "Common/Timer.h"
  7. class FPSCounter
  8. {
  9. public:
  10. unsigned int m_fps;
  11. // Initializes the FPS counter.
  12. FPSCounter();
  13. // Called when a frame is rendered. Returns the value to be displayed on
  14. // screen as the FPS counter (updated every second).
  15. int Update();
  16. private:
  17. unsigned int m_counter;
  18. unsigned int m_fps_last_counter;
  19. Common::Timer m_update_time;
  20. Common::Timer m_render_time;
  21. std::ofstream m_bench_file;
  22. void LogRenderTimeToFile(u64 val);
  23. };