Skip to content

Commit

Permalink
Debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
ccanel committed Feb 19, 2024
1 parent 79b7475 commit 6cba1ac
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
6 changes: 4 additions & 2 deletions unfair/model/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1838,7 +1838,8 @@ def get_ack_packets(pkts):
total_dropped = 0
for flow, pkts in flw_to_pkts.items():
data_pkts = get_data_packets(pkts)
# Find the highest index before the time at which the first flow finishes.

# Find the first indes greater than accept_after_us.
new_start_idx = 0
if accept_after_us is not None:
new_start_idx = find_bound(
Expand All @@ -1860,14 +1861,15 @@ def get_ack_packets(pkts):
)

trimmed_data_pkts = data_pkts[new_start_idx : new_end_idx + 1]
print("trimming", len(data_pkts), new_start_idx, new_end_idx, len(trimmed_data_pkts))
trimmed[flow] = (
# We do not trim the ACK packets because we do not need to.
(trimmed_data_pkts, get_ack_packets(pkts))
if includes_acks
else trimmed_data_pkts
)

total_dropped += len(data_pkts) - len(trimmed_data_pkts)
total_dropped += (len(data_pkts) - len(trimmed_data_pkts))
logging.info(
"Dropped %d data packets while trimming flows.",
total_dropped,
Expand Down
9 changes: 9 additions & 0 deletions unfair/scripts/eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,13 @@ def calculate_maxmin_ratios(params, flw_to_pkts, flw_to_sender, sender_to_flws):
# Note that this is per-flow.
larger_maxmin_rate_bps = maxmin_rates_bps[larger_idx]

print("small sender", smaller_sender)
print("large sender", larger_sender)
print("small sender bneck bps", sender_to_ratebps[smaller_sender])
print("large sender bneck bps", sender_to_ratebps[larger_sender])
print("shared bneck Mbps", params["bess_bw_Mbps"])
print("shared bneck bps", params["bess_bw_Mbps"] * 1e6)

# Case 1 above.
if smaller_maxmin_rate_bps == float("inf") and larger_maxmin_rate_bps == float(
"inf"
Expand Down Expand Up @@ -723,6 +730,8 @@ def calculate_maxmin_ratios(params, flw_to_pkts, flw_to_sender, sender_to_flws):
print("bneck", bneck)
flw_to_maxmin_ratio = {}
for flw, pkts in flw_to_pkts.items():
# assert pkts[cutoff_idx][features.ARRIVAL_TIME_FET]

print("flw", flw)
print("len(pkts)", len(pkts))
print("flw start", pkts[0][features.ARRIVAL_TIME_FET])
Expand Down

0 comments on commit 6cba1ac

Please sign in to comment.