Widen compact dispatch cluster probe

This commit is contained in:
Jan Petykiewicz 2026-04-19 02:32:28 -07:00
commit 8115b6b67a
2 changed files with 60 additions and 15 deletions

View file

@ -311,6 +311,11 @@ struct RuntimeCompactEventDispatchClusterReport {
maps_with_event_runtime_collection: usize,
maps_with_dispatch_strip_records: usize,
dispatch_strip_record_count: usize,
dispatch_strip_records_with_trigger_kind: usize,
dispatch_strip_records_missing_trigger_kind: usize,
dispatch_strip_payload_families: BTreeMap<String, usize>,
dispatch_descriptor_occurrences:
BTreeMap<String, Vec<RuntimeCompactEventDispatchClusterOccurrence>>,
unknown_descriptor_ids: Vec<u32>,
unknown_descriptor_special_condition_label_matches: Vec<String>,
unknown_descriptor_occurrences:
@ -323,6 +328,7 @@ struct RuntimeCompactEventDispatchClusterOccurrence {
record_index: usize,
live_entry_id: u32,
payload_family: String,
trigger_kind: Option<u8>,
signature_family: Option<String>,
condition_tuples: Vec<RuntimeCompactEventDispatchClusterConditionTuple>,
rows: Vec<RuntimeCompactEventDispatchClusterRow>,
@ -1715,6 +1721,11 @@ fn run_runtime_inspect_compact_event_dispatch_cluster(
let mut maps_with_event_runtime_collection = 0usize;
let mut maps_with_dispatch_strip_records = 0usize;
let mut dispatch_strip_record_count = 0usize;
let mut dispatch_strip_records_with_trigger_kind = 0usize;
let mut dispatch_strip_records_missing_trigger_kind = 0usize;
let mut dispatch_strip_payload_families = BTreeMap::<String, usize>::new();
let mut dispatch_descriptor_occurrences =
BTreeMap::<String, Vec<RuntimeCompactEventDispatchClusterOccurrence>>::new();
let mut unknown_descriptor_occurrences =
BTreeMap::<u32, Vec<RuntimeCompactEventDispatchClusterOccurrence>>::new();
@ -1730,10 +1741,7 @@ fn run_runtime_inspect_compact_event_dispatch_cluster(
let matching_rows = record
.grouped_effect_rows
.iter()
.filter(|row| {
compact_event_dispatch_strip_opcode(row.opcode)
&& row.descriptor_label.is_none()
})
.filter(|row| compact_event_dispatch_strip_opcode(row.opcode))
.fold(
BTreeMap::<u32, Vec<RuntimeCompactEventDispatchClusterRow>>::new(),
|mut grouped, row| {
@ -1754,6 +1762,14 @@ fn run_runtime_inspect_compact_event_dispatch_cluster(
}
map_dispatch_strip_record_count += 1;
if record.trigger_kind.is_some() {
dispatch_strip_records_with_trigger_kind += 1;
} else {
dispatch_strip_records_missing_trigger_kind += 1;
}
*dispatch_strip_payload_families
.entry(record.payload_family.clone())
.or_insert(0) += 1;
let condition_tuples = record
.standalone_condition_rows
.iter()
@ -1766,18 +1782,26 @@ fn run_runtime_inspect_compact_event_dispatch_cluster(
let signature_family = compact_event_signature_family_from_notes(&record.notes);
for (descriptor_id, rows) in matching_rows {
unknown_descriptor_occurrences
.entry(descriptor_id)
let occurrence = RuntimeCompactEventDispatchClusterOccurrence {
path: path.display().to_string(),
record_index: record.record_index,
live_entry_id: record.live_entry_id,
payload_family: record.payload_family.clone(),
trigger_kind: record.trigger_kind,
signature_family: signature_family.clone(),
condition_tuples: condition_tuples.clone(),
rows: rows.clone(),
};
dispatch_descriptor_occurrences
.entry(compact_event_dispatch_descriptor_key(descriptor_id, &rows))
.or_default()
.push(RuntimeCompactEventDispatchClusterOccurrence {
path: path.display().to_string(),
record_index: record.record_index,
live_entry_id: record.live_entry_id,
payload_family: record.payload_family.clone(),
signature_family: signature_family.clone(),
condition_tuples: condition_tuples.clone(),
rows,
});
.push(occurrence.clone());
if rows.iter().all(|row| row.descriptor_label.is_none()) {
unknown_descriptor_occurrences
.entry(descriptor_id)
.or_default()
.push(occurrence);
}
}
}
@ -1806,6 +1830,10 @@ fn run_runtime_inspect_compact_event_dispatch_cluster(
maps_with_event_runtime_collection,
maps_with_dispatch_strip_records,
dispatch_strip_record_count,
dispatch_strip_records_with_trigger_kind,
dispatch_strip_records_missing_trigger_kind,
dispatch_strip_payload_families,
dispatch_descriptor_occurrences,
unknown_descriptor_ids,
unknown_descriptor_special_condition_label_matches,
unknown_descriptor_occurrences,
@ -4169,6 +4197,16 @@ fn collect_compact_event_dispatch_cluster_input_paths(
Ok(())
}
fn compact_event_dispatch_descriptor_key(
descriptor_id: u32,
rows: &[RuntimeCompactEventDispatchClusterRow],
) -> String {
rows.first()
.and_then(|row| row.descriptor_label.as_deref())
.map(|label| format!("{descriptor_id} {label}"))
.unwrap_or_else(|| descriptor_id.to_string())
}
fn parse_hex_offset(text: &str) -> Option<usize> {
text.strip_prefix("0x")
.and_then(|digits| usize::from_str_radix(digits, 16).ok())