debug: add timing instruments to cache precalculation and screen refresh

master
Benno Schulenberg 2021-01-26 15:41:02 +01:00
parent 7d3a555464
commit 1364b41dc9
2 changed files with 21 additions and 0 deletions

View File

@ -299,6 +299,12 @@ void precalc_multicolorinfo(void)
openfile->filetop->multidata || ISSET(NO_SYNTAX))
return;
//#define TIMEPRECALC 123
#ifdef TIMEPRECALC
#include <time.h>
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 */

View File

@ -3359,6 +3359,12 @@ void edit_refresh(void)
draw_scrollbar();
#endif
//#define TIMEREFRESH 123
#ifdef TIMEREFRESH
#include <time.h>
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);