Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ccanel committed Feb 19, 2024
1 parent 1a70efc commit 66f7bce
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
5 changes: 3 additions & 2 deletions unfair/model/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1721,6 +1721,7 @@ def find_bound(vals, target, min_idx, max_idx, which):
vals must be monotonically increasing.
"""
assert min_idx >= 0
assert max_idx < len(vals)
assert max_idx >= min_idx
assert which in {"before", "after"}
if min_idx == max_idx:
Expand Down Expand Up @@ -1844,7 +1845,7 @@ def get_ack_packets(pkts):
data_pkts[features.ARRIVAL_TIME_FET],
accept_after_us,
0,
len(data_pkts),
len(data_pkts) - 1,
"before",
)

Expand All @@ -1854,7 +1855,7 @@ def get_ack_packets(pkts):
data_pkts[features.ARRIVAL_TIME_FET],
accept_before_us,
0,
len(data_pkts),
len(data_pkts) - 1,
"after",
)

Expand Down
12 changes: 7 additions & 5 deletions unfair/scripts/eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -705,11 +705,13 @@ def calculate_maxmin_ratios(params, flw_to_pkts, flw_to_sender, sender_to_flws):
)
# Case 3 above.
else:
assert (
total_sender_bneck_bps = (
sender_to_ratebps[smaller_sender] + sender_to_ratebps[larger_sender]
) < (params["bess_bw_Mbps"] * 1e6), (
"Error: Sum of the sender bottlenecks "
"must be less than the shared bottleneck!"
)
assert total_sender_bneck_bps < (params["bess_bw_Mbps"] * 1e6), (
f"Error: Sum of the sender bottlenecks ({total_sender_bneck_bps} bps) "
"must be less than the shared bottleneck "
f"({params['bess_bw_Mbps'] * 1e6} bps)!"
)

# For each bottleneck situation, compare each flow's actual throughput to its
Expand All @@ -724,7 +726,7 @@ def calculate_maxmin_ratios(params, flw_to_pkts, flw_to_sender, sender_to_flws):
pkts[features.ARRIVAL_TIME_FET],
end_s * 1e6,
flw_to_last_cutoff_idx[flw],
len(pkts),
len(pkts) - 1,
"before",
)
tpus_bps = utils.safe_tput_bps(
Expand Down

0 comments on commit 66f7bce

Please sign in to comment.