From f07c1ae90d682bad9c6aa2fd8439dee2bf80dc68 Mon Sep 17 00:00:00 2001 From: Christopher Canel Date: Tue, 20 Feb 2024 02:43:14 +0000 Subject: [PATCH] Fixes --- unfair/model/utils.py | 7 ++++--- unfair/scripts/eval.py | 8 +++++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/unfair/model/utils.py b/unfair/model/utils.py index e59a18e..4ccff0f 100644 --- a/unfair/model/utils.py +++ b/unfair/model/utils.py @@ -1839,7 +1839,7 @@ def get_ack_packets(pkts): for flow, pkts in flw_to_pkts.items(): data_pkts = get_data_packets(pkts) - # Find the first indes greater than accept_after_us. + # Find the first index before accept_after_us. new_start_idx = 0 if accept_after_us is not None: new_start_idx = find_bound( @@ -1847,9 +1847,10 @@ def get_ack_packets(pkts): accept_after_us, 0, len(data_pkts) - 1, - "before", + "after", ) + # Find the first index after accept_before_us. new_end_idx = len(data_pkts) - 1 if accept_before_us is not None: new_start_idx = find_bound( @@ -1857,7 +1858,7 @@ def get_ack_packets(pkts): accept_before_us, 0, len(data_pkts) - 1, - "after", + "before", ) trimmed_data_pkts = data_pkts[new_start_idx : new_end_idx + 1] diff --git a/unfair/scripts/eval.py b/unfair/scripts/eval.py index 335c6d6..78f6f48 100755 --- a/unfair/scripts/eval.py +++ b/unfair/scripts/eval.py @@ -528,13 +528,19 @@ def parse_opened_exp( ) # Drop packets from before the last flow starts and after the first flow ends. + print("start times:") + for flw, pkts in flw_to_pkts.items(): + print("\t", flw, pkts[features.ARRIVAL_TIME_FET][0]) latest_start_time_us = max( pkts[features.ARRIVAL_TIME_FET][0] for pkts in flw_to_pkts.values() ) + print("latest_start_time_us", latest_start_time_us) + print("end times:") + for flw, pkts in flw_to_pkts.items(): + print("\t", flw, pkts[features.ARRIVAL_TIME_FET][-1]) earliest_end_time_us = min( pkts[features.ARRIVAL_TIME_FET][-1] for pkts in flw_to_pkts.values() ) - print("latest_start_time_us", latest_start_time_us) print("earliest_end_time_us", earliest_end_time_us) flw_to_pkts = utils.trim_packets( flw_to_pkts, latest_start_time_us, earliest_end_time_us