From 01bfdf98e4475e13e7b4bb8b8fbd382fa836986e Mon Sep 17 00:00:00 2001 From: Leo Tenenbaum Date: Mon, 1 Feb 2021 19:30:55 -0500 Subject: switched syntax highlighting to use a number for the state (will be useful later) --- main.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'main.c') diff --git a/main.c b/main.c index bcad077..12e9549 100644 --- a/main.c +++ b/main.c @@ -48,6 +48,12 @@ no_warn_end #include "command.c" #include "config.c" +#if PROFILE +#define PROFILE_TIME(var) double var = time_get_seconds(); +#else +#define PROFILE_TIME(var) +#endif + static void die(char const *fmt, ...) { char buf[256] = {0}; @@ -315,7 +321,6 @@ int main(int argc, char **argv) { window_width = ted->window_width, window_height = ted->window_height; while (SDL_PollEvent(&event)) { - TextBuffer *buffer = ted->active_buffer; u32 key_modifier = (u32)ctrl_down << KEY_MODIFIER_CTRL_BIT | (u32)shift_down << KEY_MODIFIER_SHIFT_BIT @@ -483,6 +488,8 @@ int main(int argc, char **argv) { } glClear(GL_COLOR_BUFFER_BIT); + PROFILE_TIME(frame_start); + Font *font = ted->font; if (ted->active_node) { @@ -570,6 +577,15 @@ int main(int argc, char **argv) { buffer_check_valid(&ted->line_buffer); #endif + + PROFILE_TIME(frame_end); + + #if PROFILE + { + printf("Frame: %.1f ms\n", (frame_end - frame_start) * 1000); + } + #endif + SDL_GL_SwapWindow(window); } -- cgit v1.2.3