From 1364b41dc97fcd3081906d880cf746991e05de9a Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Tue, 26 Jan 2021 15:41:02 +0100 Subject: [PATCH] debug: add timing instruments to cache precalculation and screen refresh --- src/color.c | 11 +++++++++++ src/winio.c | 10 ++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/color.c b/src/color.c index bc5c2529..4737b704 100644 --- a/src/color.c +++ b/src/color.c @@ -299,6 +299,12 @@ void precalc_multicolorinfo(void) openfile->filetop->multidata || ISSET(NO_SYNTAX)) return; +//#define TIMEPRECALC 123 +#ifdef TIMEPRECALC +#include + clock_t start = clock(); +#endif + /* For each line, allocate cache space for the multiline-regex info. */ for (line = openfile->filetop; line != NULL; line = line->next) set_up_multicache(line); @@ -372,6 +378,11 @@ void precalc_multicolorinfo(void) } } } + +#ifdef TIMEPRECALC + statusline(INFO, "Precalculation: %.1f ms", 1000 * (double)(clock() - start) / CLOCKS_PER_SEC); + napms(1200); +#endif } #endif /* ENABLE_COLOR */ diff --git a/src/winio.c b/src/winio.c index a16f8116..7e158526 100644 --- a/src/winio.c +++ b/src/winio.c @@ -3359,6 +3359,12 @@ void edit_refresh(void) draw_scrollbar(); #endif +//#define TIMEREFRESH 123 +#ifdef TIMEREFRESH +#include + clock_t start = clock(); +#endif + line = openfile->edittop; while (row < editwinrows && line != NULL) { @@ -3378,6 +3384,10 @@ void edit_refresh(void) row++; } +#ifdef TIMEREFRESH + statusline(INFO, "Refresh: %.1f ms", 1000 * (double)(clock() - start) / CLOCKS_PER_SEC); +#endif + place_the_cursor(); wnoutrefresh(edit);