feat: log fps/frame/tick diagnostics in example clients

Once/sec via stk_log, using skele's new fps.h/clock.h counters.
This commit is contained in:
2026-08-23 17:44:33 +02:00
parent 829ba66782
commit 9ba3494eac
2 changed files with 28 additions and 2 deletions
+14 -1
View File
@@ -2,8 +2,10 @@
#include <skele/client/input.h>
#include <skele/client/video.h>
#include <skele/clock.h>
#include <skele/fps.h>
#include <skele/skele.h>
#include <stk/stk.h>
#include <stk/stk_log.h>
static uint8_t running = 1;
@@ -12,7 +14,7 @@ static void on_signal(void) { running = 0; }
int main(int argc, char *argv[])
{
skele_video_config_t video_cfg;
uint64_t last, now, elapsed, accum = 0;
uint64_t last, now, elapsed, accum = 0, last_print = 0;
skele_clock_init(on_signal);
@@ -65,6 +67,17 @@ int main(int argc, char *argv[])
}
skele_video_present();
if (now - last_print >= 1000000000ULL) {
stk_log(STK_LOG_INFO,
"fps=%.1f frame=%.2fms/%.2fms tps=%.1f tick=%lluns/%lluns idle=%lluns",
skele_fps, skele_frame_time_ms,
skele_frame_budget_ms, skele_tps,
(unsigned long long)skele_tick_time_ns,
(unsigned long long)skele_tick_ns,
(unsigned long long)skele_tick_idle_ns);
last_print = now;
}
}
game_shutdown();