Add FPS profiling (set DEBUG_FPS when running tint2) : show average
o9000 mrovi9000@gmail.com
1 files changed,
5 insertions(+),
1 deletions(-)
jump to
M
src/tint.c
→
src/tint.c
@@ -1567,6 +1567,7 @@ double ts_event_read = 0;
double ts_event_processed = 0; double ts_render_finished = 0; double ts_flush_finished = 0; + double fps_sum = 0, fps_count = 0; while (1) { if (panel_refresh) { if (debug_fps)@@ -1654,9 +1655,12 @@ double fps = 1.0 / period;
double proc_ratio = (ts_event_processed - ts_event_read) / period; double render_ratio = (ts_render_finished - ts_event_processed) / period; double flush_ratio = (ts_flush_finished - ts_render_finished) / period; + fps_sum += fps; + fps_count += 1; fprintf(stderr, - BLUE "fps = %.1f : processing %.1f%%, rendering %.1f%%, flushing %.1f%%" RESET "\n", + BLUE "fps = %.1f (avg %.1f) : processing %.1f%%, rendering %.1f%%, flushing %.1f%%" RESET "\n", fps, + fps_sum / fps_count, proc_ratio * 100, render_ratio * 100, flush_ratio * 100);