From c741cf7c6c5cc4a33d5fe7e0892479ab98719e80 Mon Sep 17 00:00:00 2001 From: Allen Webster Date: Mon, 21 Oct 2019 23:02:49 -0700 Subject: [PATCH] Profiling lexing --- custom/4coder_default_hooks.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/custom/4coder_default_hooks.cpp b/custom/4coder_default_hooks.cpp index 62729570..204997a7 100644 --- a/custom/4coder_default_hooks.cpp +++ b/custom/4coder_default_hooks.cpp @@ -545,9 +545,13 @@ do_full_lex_async__inner(Async_Context *actx, Buffer_ID buffer_id){ Thread_Context *tctx = get_thread_context(app); Scratch_Block scratch(tctx); - system_acquire_global_frame_mutex(tctx); - String_Const_u8 contents = push_whole_buffer(app, scratch, buffer_id); - system_release_global_frame_mutex(tctx); + String_Const_u8 contents = {}; + { + ProfileBlock(app, "async lex contents"); + system_acquire_global_frame_mutex(tctx); + contents = push_whole_buffer(app, scratch, buffer_id); + system_release_global_frame_mutex(tctx); + } Lex_State_Cpp state = {}; lex_full_input_cpp_init(&state, contents); @@ -555,7 +559,7 @@ do_full_lex_async__inner(Async_Context *actx, Buffer_ID buffer_id){ Token_List list = {}; b32 canceled = false; for (;;){ - ProfileScope(app, "async lex block"); + ProfileBlock(app, "async lex block"); if (lex_full_input_cpp_breaks(scratch, &list, &state, 10000)){ break; } @@ -566,6 +570,7 @@ do_full_lex_async__inner(Async_Context *actx, Buffer_ID buffer_id){ } if (!canceled){ + ProfileBlock(app, "async lex save results"); system_acquire_global_frame_mutex(tctx); Managed_Scope scope = buffer_get_managed_scope(app, buffer_id); Base_Allocator *allocator = managed_scope_allocator(app, scope);