re-introduce timeout-based re-requests for dbgi & fs layers; further adjust pre-emptive conversion heuristic

This commit is contained in:
Ryan Fleury
2024-11-14 09:29:01 -08:00
parent fa4f9621b0
commit ff45952f07
6 changed files with 26 additions and 6 deletions
+13 -2
View File
@@ -4125,7 +4125,13 @@ ctrl_thread__next_dmn_event(Arena *arena, DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg,
// loaded, and pre-emptively convert all of them (which for us is the
// heaviest part of debug info loading, if native RDI is not used).
//
if(event->kind == DMN_EventKind_LoadModule)
// only do this on the first ever loaded module, *or* once we get beyond 256
// modules (a very bad heuristic that may or may not inform us that we are
// dealing with insane-town projects)
//
if(event->kind == DMN_EventKind_LoadModule &&
(ctrl_state->ctrl_thread_entity_store->entity_kind_counts[CTRL_EntityKind_Module] > 256 ||
ctrl_state->ctrl_thread_entity_store->entity_kind_counts[CTRL_EntityKind_Module] == 1))
{
//- rjf: unpack event
CTRL_Handle process_handle = ctrl_handle_make(CTRL_MachineID_Local, event->process);
@@ -4177,6 +4183,11 @@ ctrl_thread__next_dmn_event(Arena *arena, DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg,
parent_dir_node = next_child;
}
//- rjf: count modules
{
parent_dir_node->module_direct_count += 1;
}
//- rjf: iterate from dir node up its ancestor chain - do recursive
// searches if this is an ancestor of loaded modules, it has not been
// searched yet, but it has >4 child branches, meaning it looks like
@@ -4185,7 +4196,7 @@ ctrl_thread__next_dmn_event(Arena *arena, DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg,
DI_KeyList preemptively_loaded_keys = {0};
for(CTRL_DbgDirNode *dir_node = parent_dir_node; dir_node != 0; dir_node = dir_node->parent)
{
if(dir_node->search_count == 0 && dir_node->child_count >= 4)
if(dir_node->search_count == 0 && dir_node->module_direct_count >= 1)
{
//- rjf: form full path of this directory node
String8List dir_node_path_parts = {0};
+1
View File
@@ -838,6 +838,7 @@ struct CTRL_DbgDirNode
String8 name;
U64 search_count;
U64 child_count;
U64 module_direct_count;
};
////////////////////////////////
+4 -1
View File
@@ -491,6 +491,7 @@ di_open(DI_Key *key)
if(node->ref_count == 1)
{
di_u2p_enqueue_key(&key_normalized, max_U64);
ins_atomic_u64_eval_assign(&node->last_time_requested_us, os_now_microseconds());
ins_atomic_u64_inc_eval(&node->request_count);
async_push_work(di_parse_work, .completion_counter = &node->completion_count);
}
@@ -609,9 +610,11 @@ di_rdi_from_key(DI_Scope *scope, DI_Key *key, U64 endt_us)
//- rjf: parse not done, not working -> ask for parse
if(node != 0 &&
!node->parse_done &&
ins_atomic_u64_eval(&node->request_count) == ins_atomic_u64_eval(&node->completion_count) &&
(ins_atomic_u64_eval(&node->request_count) == ins_atomic_u64_eval(&node->completion_count) ||
ins_atomic_u64_eval(&node->last_time_requested_us)+100000 < os_now_microseconds()) &&
di_u2p_enqueue_key(&key_normalized, endt_us))
{
ins_atomic_u64_eval_assign(&node->last_time_requested_us, os_now_microseconds());
ins_atomic_u64_inc_eval(&node->request_count);
async_push_work(di_parse_work, .completion_counter = &node->completion_count);
}
+1
View File
@@ -94,6 +94,7 @@ struct DI_Node
U64 request_count;
U64 completion_count;
U64 is_working;
U64 last_time_requested_us;
// rjf: key
DI_Key key;
+6 -3
View File
@@ -146,11 +146,13 @@ fs_hash_from_path_range(String8 path, Rng1U64 range, U64 endt_us)
}
// rjf: try to send stream request
if(ins_atomic_u64_eval(&range_node->request_count) == ins_atomic_u64_eval(&range_node->completion_count) &&
if((ins_atomic_u64_eval(&range_node->request_count) == ins_atomic_u64_eval(&range_node->completion_count) ||
ins_atomic_u64_eval(&range_node->last_time_requested_us)+100000 < os_now_microseconds()) &&
fs_u2s_enqueue_req(range, path, endt_us))
{
async_push_work(fs_stream_work, .completion_counter = &range_node->completion_count);
ins_atomic_u64_eval_assign(&range_node->last_time_requested_us, os_now_microseconds());
ins_atomic_u64_inc_eval(&range_node->request_count);
async_push_work(fs_stream_work, .completion_counter = &range_node->completion_count);
}
// rjf: try to reobtain results
@@ -419,8 +421,9 @@ fs_detector_thread__entry_point(void *p)
if(ins_atomic_u64_eval(&range_n->request_count) == ins_atomic_u64_eval(&range_n->completion_count) &&
fs_u2s_enqueue_req(range_n->range, n->path, os_now_microseconds()+100000))
{
async_push_work(fs_stream_work, .completion_counter = &range_n->completion_count);
ins_atomic_u64_eval_assign(&range_n->last_time_requested_us, os_now_microseconds());
ins_atomic_u64_inc_eval(&range_n->request_count);
async_push_work(fs_stream_work, .completion_counter = &range_n->completion_count);
}
}
}
+1
View File
@@ -14,6 +14,7 @@ struct FS_RangeNode
Rng1U64 range;
U64 request_count;
U64 completion_count;
U64 last_time_requested_us;
};
typedef struct FS_RangeSlot FS_RangeSlot;