mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-15 17:25:06 +00:00
GUI: add timing debug info
This commit is contained in:
parent
061b312943
commit
5d1785fb38
3 changed files with 35 additions and 0 deletions
|
@ -20,6 +20,7 @@
|
|||
#include "gui.h"
|
||||
#include "debug.h"
|
||||
#include "IconsFontAwesome4.h"
|
||||
#include <SDL_timer.h>
|
||||
#include <fmt/printf.h>
|
||||
#include <imgui.h>
|
||||
|
||||
|
@ -370,6 +371,13 @@ void FurnaceGUI::drawDebug() {
|
|||
}
|
||||
ImGui::TreePop();
|
||||
}
|
||||
if (ImGui::TreeNode("Performance")) {
|
||||
double perfFreq=SDL_GetPerformanceFrequency()/1000000.0;
|
||||
ImGui::Text("render: %.0fµs",(double)renderTimeDelta/perfFreq);
|
||||
ImGui::Text("layout: %.0fµs",(double)layoutTimeDelta/perfFreq);
|
||||
ImGui::Text("event: %.0fµs",(double)eventTimeDelta/perfFreq);
|
||||
ImGui::TreePop();
|
||||
}
|
||||
if (ImGui::TreeNode("Settings")) {
|
||||
if (ImGui::Button("Sync")) syncSettings();
|
||||
ImGui::SameLine();
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include <SDL_timer.h>
|
||||
#define _USE_MATH_DEFINES
|
||||
#include "gui.h"
|
||||
#include "util.h"
|
||||
|
@ -2411,6 +2412,7 @@ bool FurnaceGUI::loop() {
|
|||
drawHalt=0;
|
||||
if (settings.powerSave) SDL_WaitEventTimeout(NULL,500);
|
||||
}
|
||||
eventTimeBegin=SDL_GetPerformanceCounter();
|
||||
while (SDL_PollEvent(&ev)) {
|
||||
WAKE_UP;
|
||||
ImGui_ImplSDL2_ProcessEvent(&ev);
|
||||
|
@ -2720,6 +2722,10 @@ bool FurnaceGUI::loop() {
|
|||
midiQueue.pop();
|
||||
midiLock.unlock();
|
||||
}
|
||||
|
||||
eventTimeEnd=SDL_GetPerformanceCounter();
|
||||
|
||||
layoutTimeBegin=SDL_GetPerformanceCounter();
|
||||
|
||||
ImGui_ImplSDLRenderer_NewFrame();
|
||||
ImGui_ImplSDL2_NewFrame(sdlWin);
|
||||
|
@ -3740,6 +3746,8 @@ bool FurnaceGUI::loop() {
|
|||
ImGui::EndPopup();
|
||||
}
|
||||
|
||||
layoutTimeEnd=SDL_GetPerformanceCounter();
|
||||
|
||||
// backup trigger
|
||||
if (modified) {
|
||||
if (backupTimer>0) {
|
||||
|
@ -3778,10 +3786,16 @@ bool FurnaceGUI::loop() {
|
|||
uiColors[GUI_COLOR_BACKGROUND].z*255,
|
||||
uiColors[GUI_COLOR_BACKGROUND].w*255);
|
||||
SDL_RenderClear(sdlRend);
|
||||
renderTimeBegin=SDL_GetPerformanceCounter();
|
||||
ImGui::Render();
|
||||
renderTimeEnd=SDL_GetPerformanceCounter();
|
||||
ImGui_ImplSDLRenderer_RenderDrawData(ImGui::GetDrawData());
|
||||
SDL_RenderPresent(sdlRend);
|
||||
|
||||
layoutTimeDelta=layoutTimeEnd-layoutTimeBegin;
|
||||
renderTimeDelta=renderTimeEnd-renderTimeBegin;
|
||||
eventTimeDelta=eventTimeEnd-eventTimeBegin;
|
||||
|
||||
if (--soloTimeout<0) soloTimeout=0;
|
||||
|
||||
wheelX=0;
|
||||
|
@ -4283,6 +4297,15 @@ FurnaceGUI::FurnaceGUI():
|
|||
bindSetPending(false),
|
||||
nextScroll(-1.0f),
|
||||
nextAddScroll(0.0f),
|
||||
layoutTimeBegin(0),
|
||||
layoutTimeEnd(0),
|
||||
layoutTimeDelta(0),
|
||||
renderTimeBegin(0),
|
||||
renderTimeEnd(0),
|
||||
renderTimeDelta(0),
|
||||
eventTimeBegin(0),
|
||||
eventTimeEnd(0),
|
||||
eventTimeDelta(0),
|
||||
transposeAmount(0),
|
||||
randomizeMin(0),
|
||||
randomizeMax(255),
|
||||
|
|
|
@ -1189,6 +1189,10 @@ class FurnaceGUI {
|
|||
|
||||
float nextScroll, nextAddScroll;
|
||||
|
||||
int layoutTimeBegin, layoutTimeEnd, layoutTimeDelta;
|
||||
int renderTimeBegin, renderTimeEnd, renderTimeDelta;
|
||||
int eventTimeBegin, eventTimeEnd, eventTimeDelta;
|
||||
|
||||
ImVec2 patWindowPos, patWindowSize;
|
||||
|
||||
// pattern view specific
|
||||
|
|
Loading…
Reference in a new issue