ui thread logging; more ctrl thread logging

This commit is contained in:
Ryan Fleury
2024-04-23 09:57:17 -07:00
parent 757cd9b9d2
commit ec13092a35
6 changed files with 88 additions and 10 deletions
+19
View File
@@ -11,6 +11,19 @@ update_and_render(OS_Handle repaint_window_handle, void *user_data)
ProfBeginFunction();
Temp scratch = scratch_begin(0, 0);
//- rjf: begin logging
if(main_thread_log == 0)
{
main_thread_log = log_alloc();
String8 user_program_data_path = os_string_from_system_path(scratch.arena, OS_SystemPath_UserProgramData);
String8 user_data_folder = push_str8f(scratch.arena, "%S/raddbg/logs", user_program_data_path);
main_thread_log_path = push_str8f(df_state->arena, "%S/ui_thread.raddbg_log", user_data_folder);
os_make_directory(user_data_folder);
os_write_data_to_file_path(main_thread_log_path, str8_zero());
}
log_select(main_thread_log);
log_scope_begin();
//- rjf: tick cache layers
txt_user_clock_tick();
geo_user_clock_tick();
@@ -328,6 +341,12 @@ update_and_render(OS_Handle repaint_window_handle, void *user_data)
frame_time_us_history[frame_time_us_history_idx%ArrayCount(frame_time_us_history)] = frame_time_us;
frame_time_us_history_idx += 1;
//- rjf: end logging
{
String8 log = log_scope_end(scratch.arena);
os_append_data_to_file_path(main_thread_log_path, log);
}
scratch_end(scratch);
ProfEnd();
}
+2
View File
@@ -442,6 +442,8 @@ read_only global String8 ipc_shared_memory_name = str8_lit_comp("_raddbg_ipc_sha
read_only global String8 ipc_semaphore_name = str8_lit_comp("_raddbg_ipc_semaphore_");
global U64 frame_time_us_history[64] = {0};
global U64 frame_time_us_history_idx = 0;
global Log *main_thread_log = 0;
global String8 main_thread_log_path = {0};
////////////////////////////////
//~ rjf: Frontend Entry Points