diff options
| -rw-r--r-- | ui/curses/ui.c | 11 | ||||
| -rw-r--r-- | ui/daemon/ui.c | 5 |
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() { |
