Profiling lexing

master
Allen Webster 2019-10-21 23:02:49 -07:00
parent a8d639da8e
commit c741cf7c6c
1 changed files with 9 additions and 4 deletions

View File

@ -545,9 +545,13 @@ do_full_lex_async__inner(Async_Context *actx, Buffer_ID buffer_id){
Thread_Context *tctx = get_thread_context(app); Thread_Context *tctx = get_thread_context(app);
Scratch_Block scratch(tctx); Scratch_Block scratch(tctx);
system_acquire_global_frame_mutex(tctx); String_Const_u8 contents = {};
String_Const_u8 contents = push_whole_buffer(app, scratch, buffer_id); {
system_release_global_frame_mutex(tctx); 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_State_Cpp state = {};
lex_full_input_cpp_init(&state, contents); 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 = {}; Token_List list = {};
b32 canceled = false; b32 canceled = false;
for (;;){ for (;;){
ProfileScope(app, "async lex block"); ProfileBlock(app, "async lex block");
if (lex_full_input_cpp_breaks(scratch, &list, &state, 10000)){ if (lex_full_input_cpp_breaks(scratch, &list, &state, 10000)){
break; break;
} }
@ -566,6 +570,7 @@ do_full_lex_async__inner(Async_Context *actx, Buffer_ID buffer_id){
} }
if (!canceled){ if (!canceled){
ProfileBlock(app, "async lex save results");
system_acquire_global_frame_mutex(tctx); system_acquire_global_frame_mutex(tctx);
Managed_Scope scope = buffer_get_managed_scope(app, buffer_id); Managed_Scope scope = buffer_get_managed_scope(app, buffer_id);
Base_Allocator *allocator = managed_scope_allocator(app, scope); Base_Allocator *allocator = managed_scope_allocator(app, scope);