@@ -712,7 +712,7 @@ def _process_events(
712712 # aggregate OnePacketFlow events within this window
713713 total_bytes = sum (e .bytes for e in one_packet_events )
714714 total_packets = sum (e .packets for e in one_packet_events )
715- total_flows = len (one_packet_events )
715+ total_flows = np . uint64 ( len (one_packet_events ) )
716716
717717 singleton_data_rate = (
718718 (total_bytes * 8 ) / duration_s if duration_s > 0 else 0.0
@@ -762,11 +762,11 @@ def _process_events(
762762 else :
763763 current_data_rate += e .data_rate
764764 current_packet_rate += e .packet_rate
765- current_flow_count += e .flow_rate
765+ current_flow_rate += e .flow_rate
766766 if isinstance (e , FlowStartEvent ):
767- current_flow_count += 1
767+ current_flow_count += np . uint64 ( 1 )
768768 elif isinstance (e , FlowEndEvent ):
769- current_flow_count -= 1
769+ current_flow_count -= np . uint64 ( 1 )
770770
771771 self ._sim .set_time (event .time )
772772 simultaneous_events = [event ]
@@ -776,8 +776,10 @@ def _process_events(
776776 duration_s = self ._sim .convert_to_seconds (duration_ms )
777777
778778 if duration_s > 0 :
779+ # aggregate OnePacketFlow events within this window
779780 total_bytes = sum (e .bytes for e in one_packet_events )
780781 total_packets = sum (e .packets for e in one_packet_events )
782+ total_flows = np .uint64 (len (one_packet_events ))
781783
782784 singleton_data_rate = (
783785 (total_bytes * 8 ) / duration_s if duration_s > 0 else 0.0
@@ -786,14 +788,30 @@ def _process_events(
786788 total_packets / duration_s if duration_s > 0 else 0.0
787789 )
788790
791+ singleton_flow_rate = total_flows / duration_s if duration_s > 0 else 0.0
792+
793+ # Compose final rates
789794 total_data_rate = current_data_rate + singleton_data_rate
790795 total_packet_rate = current_packet_rate + singleton_packet_rate
796+ total_flow_count = current_flow_count + total_flows
797+ total_flow_rate = current_flow_rate + singleton_flow_rate
791798
792799 self ._update_statistic_objects (
793800 statistic_objects ,
794801 data_rate = total_data_rate ,
795802 packet_rate = total_packet_rate ,
803+ flow_count = total_flow_count ,
804+ flow_rate = total_flow_rate ,
805+ )
806+
807+ host_stats_event : HostStatsEvent = next (
808+ (e for e in simultaneous_events if isinstance (e , HostStatsEvent )),
809+ None ,
796810 )
811+ if host_stats_event :
812+ self ._update_statistic_objects (
813+ statistic_objects , ** host_stats_event .row ._asdict ()
814+ )
797815
798816 def _update_statistic_objects (
799817 self ,
0 commit comments