diff --git a/src/capture.rs b/src/capture.rs index 1db1a286..c2641e98 100644 --- a/src/capture.rs +++ b/src/capture.rs @@ -231,6 +231,7 @@ pub enum TrafficItem { #[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd)] pub enum TrafficViewMode { Hierarchical, + Interleaved, Transactions, Packets, } @@ -242,6 +243,7 @@ impl TrafficViewMode { use TrafficViewMode::*; match self { Hierarchical => "Hierarchical", + Interleaved => "Interleaved", Transactions => "Transactions", Packets => "Packets", } @@ -252,6 +254,7 @@ impl TrafficViewMode { use TrafficViewMode::*; match self { Hierarchical => "traffic-hierarchical", + Interleaved => "traffic-interleaved", Transactions => "traffic-transactions", Packets => "traffic-packets", } @@ -262,6 +265,7 @@ impl TrafficViewMode { use TrafficViewMode::*; match log_name { "traffic-hierarchical" => Hierarchical, + "traffic-interleaved" => Interleaved, "traffic-transactions" => Transactions, "traffic-packets" => Packets, _ => panic!("Unrecognised log name '{log_name}'") @@ -1528,7 +1532,7 @@ impl ItemSource for CaptureReader { use TrafficViewMode::*; match parent { None => Ok(match view_mode { - Hierarchical => { + Hierarchical | Interleaved => { let item_id = TrafficItemId::from(index); let group_id = self.item_index.get(item_id)?; TransactionGroup(group_id) @@ -1580,7 +1584,7 @@ impl ItemSource for CaptureReader { Ok(match parent { None => { (self.completion(), match view_mode { - Hierarchical => self.item_index.len(), + Hierarchical | Interleaved => self.item_index.len(), Transactions => self.transaction_index.len(), Packets => self.packet_index.len(), }) @@ -1592,11 +1596,19 @@ impl ItemSource for CaptureReader { } let transaction_count = self.group_range(&entry)?.len(); let ep_traf = self.endpoint_traffic(entry.endpoint_id())?; - if entry.group_id().value >= ep_traf.end_index.len() { - (Ongoing, transaction_count) - } else { - (Complete, transaction_count) - } + let ep_group_id = entry.group_id(); + let ongoing = ep_group_id.value >= ep_traf.end_index.len(); + let status = match (view_mode, ongoing) { + (Hierarchical, true) => Ongoing, + (Hierarchical, false) => Complete, + (Interleaved, true) => InterleavedOngoing, + (Interleaved, false) => { + let end = ep_traf.end_index.get(ep_group_id)?; + InterleavedComplete(end.value) + } + (Transactions | Packets, _) => unreachable!(), + }; + (status, transaction_count) }, Some(Transaction(_, transaction_id)) => { let packet_count = self.transaction_index.target_range(