Files
2026-06-03 12:44:36 +02:00

47 lines
1.6 KiB
R

#!/usr/bin/env Rscript
source("common.R")
parser <- fig_parser(description = "Initial ssthresh vs bottleneck queue")
parser$add_argument("--ymin", type = "double")
parser$add_argument("--ymax", type = "double")
parser$add_argument("--ystep", type = "double")
args <- parser$parse_args()
read_runs <- function(path, label) {
lines <- readLines(path)
do.call(rbind, lapply(lines, function(ln) {
parts <- strsplit(ln, ":", fixed = TRUE)[[1]]
qlen <- as.integer(trimws(parts[1]))
vals <- as.numeric(strsplit(trimws(parts[2]), "\\s+")[[1]])
data.frame(solution = label, qlen = qlen, ssthresh = vals)
}))
}
runs <- rbind(
read_runs(file.path(args$data, "tso.txt"), "tso"),
read_runs(file.path(args$data, "tso_pacing.txt"), "tso-pacing")
) %>%
prepare_solution() %>%
group_by(solution, qlen) %>%
summarise(mean = mean(ssthresh),
sd = sd(ssthresh), .groups = "drop")
p <- ggplot(runs, aes(x = factor(qlen), y = mean, fill = solution)) +
geom_col(position = position_dodge(width = 0.75), width = 0.65, colour = "black") +
geom_errorbar(aes(ymin = mean - sd, ymax = mean + sd),
position = position_dodge(width = 0.75), width = 0.25) +
scale_fill_manual(values = LABEL_COLORS) +
labs(x = "Bottleneck queue limit (pkts)", y = "Max CWND (pkts)") +
theme_paper() +
theme_debug_margins(args)
if (!is.null(args$ymax)) {
ymin <- if (is.null(args$ymin)) 0 else args$ymin
p <- p + coord_cartesian(ylim = c(ymin, args$ymax))
if (!is.null(args$ystep)) {
p <- p + scale_y_continuous(breaks = seq(ymin, args$ymax, args$ystep))
}
}
save_figure(p, args)