Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ccanel committed Feb 20, 2024
1 parent 76fef62 commit f07c1ae
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
7 changes: 4 additions & 3 deletions unfair/model/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1839,25 +1839,26 @@ 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(
data_pkts[features.ARRIVAL_TIME_FET],
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(
data_pkts[features.ARRIVAL_TIME_FET],
accept_before_us,
0,
len(data_pkts) - 1,
"after",
"before",
)

trimmed_data_pkts = data_pkts[new_start_idx : new_end_idx + 1]
Expand Down
8 changes: 7 additions & 1 deletion unfair/scripts/eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f07c1ae

Please sign in to comment.