1 // Copyright © 2008-2021 Pioneer Developers. See AUTHORS.txt for details 2 // Licensed under the terms of the GPL v3. See licenses/GPL-3.txt 3 4 #pragma once 5 6 #include "PerfStats.h" 7 #include "RefCounted.h" 8 #include <array> 9 #include <memory> 10 11 namespace PiGui { 12 13 class PerfInfo { 14 public: 15 PerfInfo(); 16 ~PerfInfo(); 17 18 // Information about the current process memory usage in KB. 19 struct MemoryInfo { 20 size_t currentMemSize; 21 size_t peakMemSize; 22 }; 23 struct ImGuiState; 24 25 void Draw(); 26 27 // Update with current frame and physics update time in ms 28 void Update(float frameTime, float physTime); 29 void UpdateFrameInfo(int framesThisSecond, int physFramesThisSecond); 30 31 void SetShowDebugInfo(bool open); 32 void SetUpdatePause(bool pause); 33 34 private: 35 void DrawPerfWindow(); 36 void DrawTextureCache(); 37 void DrawTextureInspector(); 38 39 void DrawRendererStats(); 40 void DrawWorldViewStats(); 41 void DrawImGuiStats(); 42 void DrawInputDebug(); 43 void DrawStatList(const Perf::Stats::FrameInfo &fi); 44 45 static const int NUM_FRAMES = 60; 46 std::array<float, NUM_FRAMES> m_fpsGraph; 47 std::array<float, NUM_FRAMES> m_physFpsGraph; 48 float frameTimeAverage = 0; 49 float frameTimeMax = 0; 50 float frameTimeMin = 0; 51 float physFrameTimeAverage = 0; 52 float physFrameTimeMax = 0; 53 float physFrameTimeMin = 0; 54 55 MemoryInfo process_mem; 56 size_t lua_mem = 0; 57 float framesThisSecond = 0; 58 float physFramesThisSecond = 0; 59 60 float lastUpdateTime = 0; 61 62 ImGuiState *m_state; 63 }; 64 65 } // namespace PiGui 66