aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Oliver <contact@pauloliver.dev>2026-04-06 22:22:41 +0200
committerPaul Oliver <contact@pauloliver.dev>2026-04-06 22:22:41 +0200
commit0eadabbd642de773ce3187310eb4a52fd5dcd455 (patch)
tree09b510b9376baf64140f37ffc3cf8fd7a21a52e5
parentb313dec6204d4c9b070af1e5eb0265509d523438 (diff)
UIs display steps per second
-rw-r--r--ui/curses/ui.c11
-rw-r--r--ui/daemon/ui.c5
2 files changed, 15 insertions, 1 deletions
diff --git a/ui/curses/ui.c b/ui/curses/ui.c
index 8a2d85a..4d633df 100644
--- a/ui/curses/ui.c
+++ b/ui/curses/ui.c
@@ -78,6 +78,7 @@ uint64_t g_vsiz_rng;
uint64_t g_ivpt_scroll;
char *g_line_buff;
uint64_t g_step_block;
+float g_steps_per_sec;
const wchar_t *g_zoomed_symbols = (
L"⠀⠁⠂⠃⠄⠅⠆⠇⡀⡁⡂⡃⡄⡅⡆⡇⠈⠉⠊⠋⠌⠍⠎⠏⡈⡉⡊⡋⡌⡍⡎⡏⠐⠑⠒⠓⠔⠕⠖⠗⡐⡑⡒⡓⡔⡕⡖⡗⠘⠙⠚⠛⠜⠝⠞⠟⡘⡙⡚⡛⡜⡝⡞⡟"
@@ -386,6 +387,11 @@ void ui_ulx_field(int l, const char *label, uint64_t value) {
ui_line(false, l, PAIR_NORMAL, A_NORMAL, "%-4s : %#18lx", label, value);
}
+void ui_float_field(int l, const char *label, float value) {
+ assert(label);
+ ui_line(false, l, PAIR_NORMAL, A_NORMAL, "%-4s : %18.1f", label, value);
+}
+
// ----------------------------------------------------------------------------
// Core page functions
// ----------------------------------------------------------------------------
@@ -912,6 +918,7 @@ void ui_print() {
ui_ulx_field(l++, "step", g_steps);
ui_ulx_field(l++, "sync", g_syncs);
ui_ulx_field(l++, "step", g_step_block);
+ ui_float_field(l++, "stps", g_steps_per_sec);
switch (g_page) {
case PAGE_CORE:
@@ -1266,6 +1273,7 @@ void ev_handle() {
break;
case ' ':
g_running = !g_running;
+ g_steps_per_sec = 0.f;
nodelay(stdscr, g_running);
break;
case '1':
@@ -1347,6 +1355,9 @@ void exec() {
if ((end - beg) >= (CLOCKS_PER_SEC / MAX_FPS) && g_step_block != 1) {
g_step_block >>= 1;
}
+
+ float secs = (float)(end - beg) / (float)CLOCKS_PER_SEC;
+ g_steps_per_sec = (float)g_step_block / secs;
}
ui_print();
diff --git a/ui/daemon/ui.c b/ui/daemon/ui.c
index 28bade9..f5fe668 100644
--- a/ui/daemon/ui.c
+++ b/ui/daemon/ui.c
@@ -69,7 +69,10 @@ void step_block() {
g_step_block >>= 1;
}
- g_info("Simulator running on step '%#lx'", g_steps);
+ float secs = (float)(end - beg) / (float)CLOCKS_PER_SEC;
+ float steps_per_sec = (float)g_step_block / secs;
+
+ g_info("Simulator running on step %#lx @%.1f steps/s", g_steps, steps_per_sec);
}
int main() {