aboutsummaryrefslogtreecommitdiff
path: root/src/loop
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi92@disroot.org>2025-09-08 20:47:23 +0200
committerXavier Del Campo Romero <xavi92@disroot.org>2025-09-15 23:14:43 +0200
commit20d8f138db4ccac83a89a4339271b0ac12d10e12 (patch)
treed15832e2d39b614540fc9b2b87f00e8b2feda147 /src/loop
parentb42e218f0d66af002c585a6bb0f586f92a628a40 (diff)
Diffstat (limited to 'src/loop')
-rw-r--r--src/loop/CMakeLists.txt2
-rw-r--r--src/loop/src/run.c25
2 files changed, 27 insertions, 0 deletions
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 <init.h>
#include <net.h>
+
+#include <kprintf.h>
+#include <time.h>
+#include <drv/ps1/bios.h>
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;
}