From 20d8f138db4ccac83a89a4339271b0ac12d10e12 Mon Sep 17 00:00:00 2001 From: Xavier Del Campo Romero Date: Mon, 8 Sep 2025 20:47:23 +0200 Subject: WIP --- src/loop/CMakeLists.txt | 2 ++ src/loop/src/run.c | 25 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+) (limited to 'src/loop') diff --git a/src/loop/CMakeLists.txt b/src/loop/CMakeLists.txt index 5d1e3e2..32b6179 100644 --- a/src/loop/CMakeLists.txt +++ b/src/loop/CMakeLists.txt @@ -18,3 +18,5 @@ add_library(loop) add_subdirectory(src) target_include_directories(loop PUBLIC include PRIVATE private_include) target_link_libraries(loop PUBLIC aio PRIVATE bin fs gfx init net) + +target_link_libraries(loop PRIVATE kprintf drv_ps1_bios) diff --git a/src/loop/src/run.c b/src/loop/src/run.c index ea3ef26..9979fa5 100644 --- a/src/loop/src/run.c +++ b/src/loop/src/run.c @@ -25,8 +25,14 @@ #include #include + +#include +#include +#include int loop_run(void) { + static unsigned iterations; + if (fs_update() || aio_poll(loop_aio_head, 0) < 0 || init_run() @@ -35,5 +41,24 @@ int loop_run(void) || gfx_update()) return -1; + iterations++; + + static struct timespec ts; + struct timespec now; + + if (clock_gettime(CLOCK_REALTIME, &now)) + return -1; + + if (now.tv_sec - ts.tv_sec) + { + extern unsigned sio_read, valid_packets; + extern int sio_stat_overrun, sw_overrun; + + kprintf("%u ticks, read=%u, SIO=%d, SOV=%d, OK=%u\n", iterations, + sio_read, sio_stat_overrun, sw_overrun, valid_packets); + ts = now; + iterations = 0; + } + return 0; } -- cgit v1.2.3