per-run tls base vaddr cache; cleanup/fixes/improvements on fuzzy filtering of scheduler view

This commit is contained in:
Ryan Fleury
2024-02-06 08:48:09 -08:00
parent 0696eab974
commit 87ed6a8c62
7 changed files with 173 additions and 53 deletions
+19 -3
View File
@@ -8750,8 +8750,9 @@ df_entity_tooltips(DF_Entity *entity)
}
internal void
df_entity_desc_button(DF_Window *ws, DF_Entity *entity, FuzzyMatchRangeList *name_matches)
df_entity_desc_button(DF_Window *ws, DF_Entity *entity, FuzzyMatchRangeList *name_matches, String8 fuzzy_query)
{
ProfBeginFunction();
Temp scratch = scratch_begin(0, 0);
if(entity->kind == DF_EntityKind_Thread)
{
@@ -8875,8 +8876,9 @@ df_entity_desc_button(DF_Window *ws, DF_Entity *entity, FuzzyMatchRangeList *nam
CTRL_Unwind unwind = df_query_cached_unwind_from_thread(entity);
DF_Entity *process = df_entity_ancestor_from_kind(entity, DF_EntityKind_Process);
U64 idx = 0;
U64 limit = 3;
ui_spacer(ui_em(1.f, 1.f));
for(CTRL_UnwindFrame *f = unwind.last; f != 0 && idx < 3; f = f->prev)
for(CTRL_UnwindFrame *f = unwind.last; f != 0 && idx < limit; f = f->prev)
{
U64 rip_vaddr = f->rip;
DF_Entity *module = df_module_from_process_vaddr(process, rip_vaddr);
@@ -8885,12 +8887,25 @@ df_entity_desc_button(DF_Window *ws, DF_Entity *entity, FuzzyMatchRangeList *nam
String8 procedure_name = df_symbol_name_from_binary_voff(scratch.arena, binary, rip_voff);
if(procedure_name.size != 0)
{
FuzzyMatchRangeList fuzzy_matches = {0};
if(fuzzy_query.size != 0)
{
fuzzy_matches = fuzzy_match_find(scratch.arena, fuzzy_query, procedure_name);
}
if(idx != 0)
{
UI_TextColor(df_rgba_from_theme_color(DF_ThemeColor_WeakText)) UI_PrefWidth(ui_em(2.f, 1.f)) ui_label(str8_lit(">"));
}
UI_PrefWidth(ui_text_dim(10.f, 0.f)) ui_label(procedure_name);
UI_PrefWidth(ui_text_dim(10.f, 0.f))
{
UI_Box *label_box = ui_label(procedure_name).box;
ui_box_equip_fuzzy_match_ranges(label_box, &fuzzy_matches);
}
idx += 1;
if(idx == limit)
{
UI_TextColor(df_rgba_from_theme_color(DF_ThemeColor_WeakText)) UI_PrefWidth(ui_text_dim(10.f, 1.f)) ui_label(str8_lit("> ..."));
}
}
}
}
@@ -8938,6 +8953,7 @@ df_entity_desc_button(DF_Window *ws, DF_Entity *entity, FuzzyMatchRangeList *nam
}
}
scratch_end(scratch);
ProfEnd();
}
internal void
+1 -1
View File
@@ -1029,7 +1029,7 @@ internal void df_cmd_list_menu_buttons(DF_Window *ws, U64 count, DF_CoreCmdKind
internal UI_Signal df_icon_button(DF_IconKind kind, FuzzyMatchRangeList *matches, String8 string);
internal UI_Signal df_icon_buttonf(DF_IconKind kind, FuzzyMatchRangeList *matches, char *fmt, ...);
internal void df_entity_tooltips(DF_Entity *entity);
internal void df_entity_desc_button(DF_Window *ws, DF_Entity *entity, FuzzyMatchRangeList *name_matches);
internal void df_entity_desc_button(DF_Window *ws, DF_Entity *entity, FuzzyMatchRangeList *name_matches, String8 fuzzy_query);
internal void df_entity_src_loc_button(DF_Window *ws, DF_Entity *entity, TxtPt point);
////////////////////////////////
+38 -35
View File
@@ -3390,7 +3390,7 @@ DF_VIEW_UI_FUNCTION_DEF(Targets)
// rjf: target name
UI_WidthFill UI_FocusHot((row_selected && cursor.x == 1) ? UI_FocusKind_On : UI_FocusKind_Off)
{
df_entity_desc_button(ws, target, &targets.v[row_idx-1].matches);
df_entity_desc_button(ws, target, &targets.v[row_idx-1].matches, query);
}
// rjf: controls
@@ -3815,48 +3815,51 @@ DF_VIEW_UI_FUNCTION_DEF(Scheduler)
//- rjf: produce list of items; no query -> all entities, in tree; query -> only show threads
DF_EntityFuzzyItemArray items = {0};
if(query.size == 0)
ProfScope("query -> entities")
{
//- rjf: build flat array of entities, arranged into row order
DF_EntityArray entities = {0};
if(query.size == 0)
{
entities.count = machines.count+processes.count+threads.count;
entities.v = push_array_no_zero(scratch.arena, DF_Entity *, entities.count);
U64 idx = 0;
for(DF_EntityNode *machine_n = machines.first; machine_n != 0; machine_n = machine_n->next)
//- rjf: build flat array of entities, arranged into row order
DF_EntityArray entities = {0};
{
DF_Entity *machine = machine_n->entity;
entities.v[idx] = machine;
idx += 1;
for(DF_EntityNode *process_n = processes.first; process_n != 0; process_n = process_n->next)
entities.count = machines.count+processes.count+threads.count;
entities.v = push_array_no_zero(scratch.arena, DF_Entity *, entities.count);
U64 idx = 0;
for(DF_EntityNode *machine_n = machines.first; machine_n != 0; machine_n = machine_n->next)
{
DF_Entity *process = process_n->entity;
if(df_entity_ancestor_from_kind(process, DF_EntityKind_Machine) != machine)
{
continue;
}
entities.v[idx] = process;
DF_Entity *machine = machine_n->entity;
entities.v[idx] = machine;
idx += 1;
for(DF_EntityNode *thread_n = threads.first; thread_n != 0; thread_n = thread_n->next)
for(DF_EntityNode *process_n = processes.first; process_n != 0; process_n = process_n->next)
{
DF_Entity *thread = thread_n->entity;
if(df_entity_ancestor_from_kind(thread, DF_EntityKind_Process) != process)
DF_Entity *process = process_n->entity;
if(df_entity_ancestor_from_kind(process, DF_EntityKind_Machine) != machine)
{
continue;
}
entities.v[idx] = thread;
entities.v[idx] = process;
idx += 1;
for(DF_EntityNode *thread_n = threads.first; thread_n != 0; thread_n = thread_n->next)
{
DF_Entity *thread = thread_n->entity;
if(df_entity_ancestor_from_kind(thread, DF_EntityKind_Process) != process)
{
continue;
}
entities.v[idx] = thread;
idx += 1;
}
}
}
}
//- rjf: entities -> fuzzy-filtered entities
items = df_entity_fuzzy_item_array_from_entity_array_needle(scratch.arena, &entities, query);
}
else
{
items = df_entity_fuzzy_item_array_from_entity_list_needle(scratch.arena, &threads, query);
}
//- rjf: entities -> fuzzy-filtered entities
items = df_entity_fuzzy_item_array_from_entity_array_needle(scratch.arena, &entities, query);
}
else
{
items = df_entity_fuzzy_item_array_from_entity_list_needle(scratch.arena, &threads, query);
}
//- rjf: selected column/entity -> selected cursor
@@ -3945,7 +3948,7 @@ DF_VIEW_UI_FUNCTION_DEF(Scheduler)
UI_TableCellSized(ui_pct(1, 0))
UI_FocusHot((row_is_selected && desc_col_rng.min <= cursor.x && cursor.x <= desc_col_rng.max) ? UI_FocusKind_On : UI_FocusKind_Off)
{
df_entity_desc_button(ws, entity, &items.v[idx].matches);
df_entity_desc_button(ws, entity, &items.v[idx].matches, query);
}
switch(entity->kind)
{
@@ -4169,7 +4172,7 @@ DF_VIEW_UI_FUNCTION_DEF(CallStack)
}
else
{
df_entity_desc_button(ws, module, 0);
df_entity_desc_button(ws, module, 0, str8_zero());
}
}
@@ -4430,7 +4433,7 @@ DF_VIEW_UI_FUNCTION_DEF(Modules)
{
UI_TableCellSized(ui_pct(1, 0)) UI_FocusHot((row_is_selected) ? UI_FocusKind_On : UI_FocusKind_Off)
{
df_entity_desc_button(ws, entity, &items.v[idx].matches);
df_entity_desc_button(ws, entity, &items.v[idx].matches, query);
}
}
idx_in_process = 0;
@@ -4444,7 +4447,7 @@ DF_VIEW_UI_FUNCTION_DEF(Modules)
}
UI_TableCell UI_FocusHot((row_is_selected && cursor.x == 0) ? UI_FocusKind_On : UI_FocusKind_Off)
{
df_entity_desc_button(ws, entity, &items.v[idx].matches);
df_entity_desc_button(ws, entity, &items.v[idx].matches, query);
}
UI_TableCell UI_Font(df_font_from_slot(DF_FontSlot_Code)) UI_FocusHot((row_is_selected && cursor.x == 1) ? UI_FocusKind_On : UI_FocusKind_Off)
{
@@ -8355,7 +8358,7 @@ DF_VIEW_UI_FUNCTION_DEF(Breakpoints)
}
UI_TableCell UI_FocusHot((row_is_selected && cursor.x == 1) ? UI_FocusKind_On : UI_FocusKind_Off)
{
df_entity_desc_button(ws, entity, &entities.v[idx-1].matches);
df_entity_desc_button(ws, entity, &entities.v[idx-1].matches, query);
}
UI_TableCell UI_FocusHot((row_is_selected && cursor.x == 2) ? UI_FocusKind_On : UI_FocusKind_Off)
{
@@ -8516,7 +8519,7 @@ DF_VIEW_UI_FUNCTION_DEF(WatchPins)
{
UI_TableCell UI_FocusHot((row_is_selected && cursor.x == 0) ? UI_FocusKind_On : UI_FocusKind_Off)
{
df_entity_desc_button(ws, entity, &entities.v[idx-1].matches);
df_entity_desc_button(ws, entity, &entities.v[idx-1].matches, query);
}
UI_TableCell UI_FocusHot((row_is_selected && cursor.x == 1) ? UI_FocusKind_On : UI_FocusKind_Off)
{