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:
+14
-1
@@ -2,8 +2,10 @@
|
|||||||
#include <skele/client/input.h>
|
#include <skele/client/input.h>
|
||||||
#include <skele/client/video.h>
|
#include <skele/client/video.h>
|
||||||
#include <skele/clock.h>
|
#include <skele/clock.h>
|
||||||
|
#include <skele/fps.h>
|
||||||
#include <skele/skele.h>
|
#include <skele/skele.h>
|
||||||
#include <stk/stk.h>
|
#include <stk/stk.h>
|
||||||
|
#include <stk/stk_log.h>
|
||||||
|
|
||||||
static uint8_t running = 1;
|
static uint8_t running = 1;
|
||||||
|
|
||||||
@@ -12,7 +14,7 @@ static void on_signal(void) { running = 0; }
|
|||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
skele_video_config_t video_cfg;
|
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);
|
skele_clock_init(on_signal);
|
||||||
|
|
||||||
@@ -65,6 +67,17 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
skele_video_present();
|
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();
|
game_shutdown();
|
||||||
|
|||||||
+14
-1
@@ -2,8 +2,10 @@
|
|||||||
#include <skele/client/input.h>
|
#include <skele/client/input.h>
|
||||||
#include <skele/client/video.h>
|
#include <skele/client/video.h>
|
||||||
#include <skele/clock.h>
|
#include <skele/clock.h>
|
||||||
|
#include <skele/fps.h>
|
||||||
#include <skele/skele.h>
|
#include <skele/skele.h>
|
||||||
#include <stk/stk.h>
|
#include <stk/stk.h>
|
||||||
|
#include <stk/stk_log.h>
|
||||||
|
|
||||||
static uint8_t running = 1;
|
static uint8_t running = 1;
|
||||||
|
|
||||||
@@ -12,7 +14,7 @@ static void on_signal(void) { running = 0; }
|
|||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
skele_video_config_t video_cfg;
|
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);
|
skele_clock_init(on_signal);
|
||||||
|
|
||||||
@@ -65,6 +67,17 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
skele_video_present();
|
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();
|
game_shutdown();
|
||||||
|
|||||||
Reference in New Issue
Block a user