perf stuff
This commit is contained in:
@@ -11,12 +11,18 @@
|
||||
#include "imgui.h"
|
||||
#include "remixicon.h"
|
||||
|
||||
#define IMGUI_REDRAW_COUNT 3
|
||||
|
||||
class DrawData {
|
||||
public:
|
||||
GLFWwindow* window = nullptr;
|
||||
HWND window_handle = nullptr;
|
||||
ImVec4 clear_color = {};
|
||||
ImVec2 window_size = {};
|
||||
float frameTimeSetup = 0.f;
|
||||
float frameTimeDraw = 0.f;
|
||||
float frameTimeRender = 0.f;
|
||||
float frameTimeDisplay = 0.f;
|
||||
};
|
||||
|
||||
class ImGuiCallbacks {
|
||||
@@ -26,6 +32,28 @@ public:
|
||||
std::function<void(DrawData&)> cleanupFunc = nullptr;
|
||||
};
|
||||
|
||||
class PerfTimer {
|
||||
private:
|
||||
LARGE_INTEGER start;
|
||||
LARGE_INTEGER end;
|
||||
LARGE_INTEGER freq;
|
||||
|
||||
public:
|
||||
LONGLONG resultTicks;
|
||||
float resultSeconds;
|
||||
|
||||
public:
|
||||
void Start() {
|
||||
QueryPerformanceFrequency(&freq);
|
||||
QueryPerformanceCounter(&start);
|
||||
}
|
||||
void End() {
|
||||
QueryPerformanceCounter(&end);
|
||||
resultTicks = end.QuadPart - start.QuadPart;
|
||||
resultSeconds = static_cast<float>(resultTicks * 1000) / freq.QuadPart;
|
||||
}
|
||||
};
|
||||
|
||||
int startImgui(ImGuiCallbacks& callbacks, const char* title, int windowWidth, int windowHeight);
|
||||
|
||||
ImVec2 getWindowSize(GLFWwindow* window);
|
||||
|
||||
Reference in New Issue
Block a user