diff options
| -rw-r--r-- | ttt.jai | 18 | ||||
| -rw-r--r-- | unused.jai | 19 |
2 files changed, 28 insertions, 9 deletions
@@ -895,7 +895,14 @@ update_layout :: () { } } -draw_tui :: (db: *Database, layout: *Layout) { +dbg_average := 0; // DEBUG +dbg_count := 0; // DEBUG +draw_user_interface :: (db: *Database, layout: *Layout) { + + start := current_time_monotonic(); // DEBUG + + + // TODO During dirty_flag revamp...we may also start using the String_Builder. @@ -1094,6 +1101,13 @@ draw_tui :: (db: *Database, layout: *Layout) { TUI.set_style(style_default); x += 1; print_time(y, x, total_time, layout.columns[L_TOTAL_IDX].width); + + stop := current_time_monotonic(); // DEBUG + dbg_sample := to_nanoseconds(stop-start); // DEBUG + dbg_average = (dbg_sample + dbg_count * dbg_average) / (dbg_count + 1); // DEBUG + dbg_count += 1; // DEBUG + TUI.set_cursor_position(3, 1); + print("Average % us ---------", dbg_average/1000); // DEBUG } free_memory :: () { @@ -1371,7 +1385,7 @@ main :: () { write_strings(INVALID_WINDOW_MESSAGE); } else { - draw_tui(db, layout); + draw_user_interface(db, layout); draw_error_window(); } @@ -3,14 +3,19 @@ print(">%<", S64_MIN + delta, to_standard_error = true); // MEASURE PERFORMANCE { - #import "Basic"; - start := current_time_monotonic(); - // Code to measure. - stop := current_time_monotonic(); - print("Measured % ns.\n", to_nanoseconds(stop-start)); + dbg_average := 0; // DEBUG + dbg_count := 0; // DEBUG - // Cumulative average: - CA_n+1 = (x_n+1 + n*CA_n ) / (n + 1) + #import "Basic"; + + // Cumulative average: CA_n+1 = (x_n+1 + n*CA_n ) / (n + 1) + start := current_time_monotonic(); // DEBUG + // ...code to be measured... + stop := current_time_monotonic(); // DEBUG + dbg_sample := to_nanoseconds(stop-start); // DEBUG + dbg_average = (dbg_sample + dbg_count * dbg_average) / (dbg_count + 1); // DEBUG + dbg_count += 1; // DEBUG + print("Average % ns.\n", dbg_average); // DEBUG } // Memory allocator debugging. |
