12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- #include "PerfCounter.h"
-
- #include <imgui.h>
- #include <imgui_plot.h>
-
- #include "util.h"
-
- namespace Swan {
-
- void PerfCounter::render() {
- Deferred<ImGui::End> win;
- if (!ImGui::Begin("Perf Stats"))
- return;
-
- std::array<float, 64> buf;
- ImGui::PlotConfig conf;
-
- conf.values = { .ys = buf.data(), .count = 64 };
- conf.scale = { 0, 1 / 30.0 };
- conf.frame_size = { ImGui::GetWindowContentRegionWidth(), 30 },
-
- total_time_.fill(buf);
- ImGui::Text("Total Time");
- ImGui::Plot("Total Time", conf);
-
- render_present_.fill(buf);
- ImGui::Text("Render Present");
- ImGui::Plot("Render Present", conf);
-
- frame_time_.fill(buf);
- ImGui::Text("Frame Times");
- ImGui::Plot("Frame Times", conf);
-
- game_update_.fill(buf);
- ImGui::Text("Game Update");
- ImGui::Plot("Game Update", conf);
-
- game_draw_.fill(buf);
- ImGui::Text("Game Draw");
- ImGui::Plot("Game Draw", conf);
-
- game_tick_.fill(buf);
- ImGui::Text("Game Tick");
- ImGui::Plot("Game Tick", conf);
-
- game_updates_per_frame_.fill(buf);
- conf.scale = { 0, 3 };
- ImGui::Text("Game Updates Per Frame");
- ImGui::Plot("Game Updates Per Frame", conf);
- }
-
- }
|