Added optional PERF_LOG* defines.

This commit is contained in:
yellows8 2018-02-26 18:56:52 -05:00
parent 114db71711
commit 65d3a19499
2 changed files with 39 additions and 0 deletions

View File

@ -340,6 +340,19 @@ void menuLoop() {
DrawText(interuiregular14, 180, 46, themeCurrent.textColor, "v2.0.0"); DrawText(interuiregular14, 180, 46, themeCurrent.textColor, "v2.0.0");
DrawTextTruncate(interuiregular18, 40, 720 - 47, themeCurrent.textColor, menu->dirname, 918, "..."); DrawTextTruncate(interuiregular18, 40, 720 - 47, themeCurrent.textColor, menu->dirname, 918, "...");
#ifdef PERF_LOG_DRAW//Seperate from the PERF_LOG define since this might affect perf.
extern u64 g_tickdiff_vsync;
extern u64 g_tickdiff_frame;
char tmpstr[64];
snprintf(tmpstr, sizeof(tmpstr)-1, "%lu", g_tickdiff_vsync);
DrawText(interuiregular14, 180 + 256, 46, themeCurrent.textColor, tmpstr);
snprintf(tmpstr, sizeof(tmpstr)-1, "%lu", g_tickdiff_frame);
DrawText(interuiregular14, 180 + 256, 46 + 16, themeCurrent.textColor, tmpstr);
#endif
//drawTime(); //drawTime();
if (menu->nEntries==0) if (menu->nEntries==0)

View File

@ -7,8 +7,17 @@
uint8_t* g_framebuf; uint8_t* g_framebuf;
u32 g_framebuf_width; u32 g_framebuf_width;
#ifdef PERF_LOG
u64 g_tickdiff_vsync=0;
u64 g_tickdiff_frame=0;
#endif
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
#ifdef PERF_LOG
u64 start_tick=0;
#endif
gfxInitDefault(); gfxInitDefault();
appletSetScreenShotPermission(1); appletSetScreenShotPermission(1);
@ -21,8 +30,20 @@ int main(int argc, char **argv)
launchInit(); launchInit();
#ifdef PERF_LOG
gfxWaitForVsync();
start_tick = svcGetSystemTick();
gfxWaitForVsync();
g_tickdiff_vsync = svcGetSystemTick() - start_tick;
#endif
while (appletMainLoop()) while (appletMainLoop())
{ {
#ifdef PERF_LOG
start_tick = svcGetSystemTick();
#endif
//Scan all the inputs. This should be done once for each frame //Scan all the inputs. This should be done once for each frame
hidScanInput(); hidScanInput();
@ -32,6 +53,11 @@ int main(int argc, char **argv)
menuLoop(); menuLoop();
gfxFlushBuffers(); gfxFlushBuffers();
#ifdef PERF_LOG
g_tickdiff_frame = svcGetSystemTick() - start_tick;
#endif
gfxSwapBuffers(); gfxSwapBuffers();
gfxWaitForVsync(); gfxWaitForVsync();
} }