Skip to content

Commit

Permalink
Remove prints
Browse files Browse the repository at this point in the history
  • Loading branch information
ccanel committed Feb 20, 2024
1 parent ca7154d commit b0c3409
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 27 deletions.
3 changes: 1 addition & 2 deletions unfair/model/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1862,15 +1862,14 @@ 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
25 changes: 0 additions & 25 deletions unfair/scripts/eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -528,20 +528,12 @@ 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("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 Expand Up @@ -697,13 +689,6 @@ def calculate_maxmin_ratios(params, flw_to_pkts, flw_to_sender, sender_to_flws):
assert smaller_idx != larger_idx
assert tuple(sorted([smaller_idx, larger_idx])) == (0, 1)

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"):
rate_bps = (
Expand Down Expand Up @@ -741,31 +726,21 @@ def calculate_maxmin_ratios(params, flw_to_pkts, flw_to_sender, sender_to_flws):
bneck_to_avg_maxmin_ratio = {}
for start_s, end_s, _ in bneck_situations:
bneck = (start_s, end_s)
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])
print("flw end", pkts[-1][features.ARRIVAL_TIME_FET])
print("last cutoff idx", flw_to_last_cutoff_idx[flw])
cutoff_idx = utils.find_bound(
pkts[features.ARRIVAL_TIME_FET],
end_s * 1e6,
flw_to_last_cutoff_idx[flw],
len(pkts) - 1,
"before",
)
print("cutoff idx", cutoff_idx)
tpus_bps = utils.safe_tput_bps(
pkts, flw_to_last_cutoff_idx[flw], cutoff_idx
)
maxmin_rate_bps = bneck_to_sender_to_maxminbps[bneck][flw_to_sender[flw]]
flw_to_maxmin_ratio[flw] = tpus_bps / maxmin_rate_bps
flw_to_last_cutoff_idx[flw] = cutoff_idx + 1
print()
bneck_to_avg_maxmin_ratio[bneck] = np.average(
list(flw_to_maxmin_ratio.values())
)
Expand Down

0 comments on commit b0c3409

Please sign in to comment.