summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2021-02-01 19:30:55 -0500
committerLeo Tenenbaum <pommicket@gmail.com>2021-02-01 19:30:55 -0500
commit01bfdf98e4475e13e7b4bb8b8fbd382fa836986e (patch)
treedcf687f1bc64e726b1a3675312ec0f98dd373c19 /main.c
parentb376a87775d10dc7a693c0e1ecbe59e867e4634a (diff)
switched syntax highlighting to use a number for the state (will be useful later)
Diffstat (limited to 'main.c')
-rw-r--r--main.c18
1 files changed, 17 insertions, 1 deletions
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);
}