working well, good docs. TUI.
This commit is contained in:
@@ -237,4 +237,23 @@ class StatisticsEngine:
|
||||
'tracked_flows': total_flows,
|
||||
'total_outliers': total_outliers,
|
||||
'update_frequency': 'per_packet'
|
||||
}
|
||||
}
|
||||
|
||||
def get_max_sigma_deviation(self, flow: FlowStats) -> float:
|
||||
"""Get the maximum sigma deviation for any outlier in this flow"""
|
||||
max_sigma = 0.0
|
||||
|
||||
# Check flow-level outliers
|
||||
if flow.outlier_details and flow.std_inter_arrival > 0:
|
||||
for frame_num, inter_arrival_time in flow.outlier_details:
|
||||
sigma_deviation = (inter_arrival_time - flow.avg_inter_arrival) / flow.std_inter_arrival
|
||||
max_sigma = max(max_sigma, sigma_deviation)
|
||||
|
||||
# Check frame-type-level outliers
|
||||
for frame_type, ft_stats in flow.frame_types.items():
|
||||
if ft_stats.outlier_details and ft_stats.std_inter_arrival > 0:
|
||||
for frame_num, inter_arrival_time in ft_stats.outlier_details:
|
||||
sigma_deviation = (inter_arrival_time - ft_stats.avg_inter_arrival) / ft_stats.std_inter_arrival
|
||||
max_sigma = max(max_sigma, sigma_deviation)
|
||||
|
||||
return max_sigma
|
||||
Reference in New Issue
Block a user