Skip to content

Commit fea64ff

Browse files
Added latency plot to cp_vs_tcp
Also renamed start_slowdown_plot to start_plot_vs_msg_length in cperf.py, since the function can be used for multiple purposes.
1 parent 2e61bca commit fea64ff

9 files changed

Lines changed: 60 additions & 17 deletions

File tree

‎util/cp_both‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ log("Generating slowdown plot for %s" % (options.workload))
6161
title = "TCP (%.1f Gbps) and Homa (%.1f Gbps) together, %s %d nodes" % (
6262
options.gbps - options.homa_gbps, options.homa_gbps,
6363
options.workload.capitalize(), options.num_nodes)
64-
ax = start_slowdown_plot(title, 1000, homa_exp)
64+
ax = start_plot_vs_msg_length(title, 1000, homa_exp)
6565
plot_slowdown(ax, tcp_exp, "p99", "TCP P99", color=tcp_color)
6666
plot_slowdown(ax, tcp_exp, "p50", "TCP P50", color=tcp_color2)
6767
plot_slowdown(ax, homa_exp, "p99", "Homa P99", color=homa_color)

‎util/cp_buffers‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ for workload, bw, seconds in load_info:
163163
title = "%s %d nodes, %.1f Gbps" % (workload.capitalize(),
164164
options.num_nodes, bw)
165165
exp_name = "%s_%s" % (options.protocol, workload)
166-
ax = start_slowdown_plot(title, 1000, exp_name, y_label=" Slowdown")
166+
ax = start_plot_vs_msg_length(title, 1000, exp_name, y_label=" Slowdown")
167167
for exp in data:
168168
plot_slowdown(ax, exp["name"], "p99", "%.1f MB P99" % exp["buf_size"])
169169
ax.legend(loc="upper left", prop={'size': 9})

‎util/cp_config‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ for workload, bw, seconds in load_info:
336336
log("Generating slowdown plot for %s" % (workload))
337337
title = "%s %d nodes, %.1f Gbps" % (workload.capitalize(),
338338
options.num_nodes, bw)
339-
ax = start_slowdown_plot(title, plot_max_y, "%s_%s" % (
339+
ax = start_plot_vs_msg_length(title, plot_max_y, "%s_%s" % (
340340
specs[0]['exp_name'], workload), y_label=" Slowdown")
341341
for spec in specs:
342342
exp_name = "%s_%s" % (spec['exp_name'], workload)

‎util/cp_config_buf‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ for workload, bw, seconds in load_info:
338338
log("Generating slowdown plot for %s" % (workload))
339339
title = "%s %d nodes, %.1f Gbps" % (workload.capitalize(),
340340
options.num_nodes, bw)
341-
ax = start_slowdown_plot(title, plot_max_y, "%s_%s" % (
341+
ax = start_plot_vs_msg_length(title, plot_max_y, "%s_%s" % (
342342
specs[0]['exp_name'], workload), y_label=" Slowdown")
343343
for spec in specs:
344344
exp_name = "%s_%s" % (spec['exp_name'], workload)

‎util/cp_load‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ set_unloaded(unloaded_exp)
8989
log("Generating slowdown plot for %s" % (options.workload))
9090
title = "%s %d nodes, %.2f GB/s" % (options.workload.capitalize(),
9191
options.num_nodes, options.gbps)
92-
ax = start_slowdown_plot(title, 1000, "homa1.0_%s" % (options.workload))
92+
ax = start_plot_vs_msg_length(title, 1000, "homa1.0_%s" % (options.workload))
9393
if options.dctcp:
9494
plot_slowdown(ax, "dctcp%3.1f_%s" % (fractions[0], options.workload),
9595
"p99", "DCTCP %4.2f Gbps" % (fractions[0] * options.gbps),

‎util/cp_tcp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ for workload, bw in load_info:
8181
log("Generating slowdown plot for %s" % (workload))
8282
title = "%s %d nodes, %.1f Gbps" % (workload.capitalize(),
8383
options.num_nodes, bw)
84-
ax = start_slowdown_plot(title, 1000, exp)
84+
ax = start_plot_vs_msg_length(title, 1000, exp)
8585
plot_slowdown(ax, exp, "p99", "%s P99" % (prot))
8686
plot_slowdown(ax, exp, "p50", "%s P50" % (prot))
8787
ax.legend()

‎util/cp_tcp_config‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ for workload, bw in load_info:
111111
if options.tcp:
112112
title = "%s %d nodes, %.1f Gbps" % (workload.capitalize(),
113113
options.num_nodes, bw)
114-
ax = start_slowdown_plot(title, 1000,
114+
ax = start_plot_vs_msg_length(title, 1000,
115115
"tcp_%s_%s" % (specs[0]['exp_name'], workload),
116116
y_label="TCP Slowdown")
117117
for spec in specs:
@@ -128,7 +128,7 @@ for workload, bw in load_info:
128128
if options.dctcp:
129129
title = "%s %d nodes, %.1f Gbps" % (workload.capitalize(),
130130
options.num_nodes, bw)
131-
ax = start_slowdown_plot(title, 10000,
131+
ax = start_plot_vs_msg_length(title, 10000,
132132
"dctcp_%s_%s" % (specs[0]['exp_name'], workload),
133133
y_label="DCTCP Slowdown")
134134
for spec in specs:

‎util/cp_vs_tcp‎

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ for workload, bw, seconds in load_info:
116116
log("Generating slowdown plot for %s" % (workload))
117117
title = "%s %d nodes, %.1f Gbps" % (workload.capitalize(),
118118
options.num_nodes, bw)
119-
ax = start_slowdown_plot(title, 1000, homa_exp)
119+
ax = start_plot_vs_msg_length(title, 1000, homa_exp)
120120
if options.tcp:
121121
plot_slowdown(ax, tcp_exp, "p99", "TCP P99", color=tcp_color)
122122
plot_slowdown(ax, tcp_exp, "p50", "TCP P50", color=tcp_color2)
@@ -127,7 +127,25 @@ for workload, bw, seconds in load_info:
127127
plot_slowdown(ax, homa_exp, "p50", "Homa P50", color=homa_color2)
128128
ax.legend(loc="upper right", prop={'size': 9})
129129
plt.tight_layout()
130-
plt.savefig("%s/reports/vs_tcp_%s.pdf" % (options.log_dir, workload))
130+
plt.savefig("%s/reports/slowdown_%s.pdf" % (options.log_dir, workload))
131+
132+
# Generate latency plot.
133+
log("Generating RTT latency plot for %s" % (workload))
134+
title = "%s %d nodes, %.1f Gbps" % (workload.capitalize(),
135+
options.num_nodes, bw)
136+
ax = start_plot_vs_msg_length(title, [30, 30000], homa_exp,
137+
y_label=r'RTT (µsec)')
138+
if options.tcp:
139+
plot_histogram(ax, tcp_exp, "p99", "TCP P99", color=tcp_color)
140+
plot_histogram(ax, tcp_exp, "p50", "TCP P50", color=tcp_color2)
141+
if options.dctcp:
142+
plot_histogram(ax, dctcp_exp, "p99", "DCTCP P99", color=dctcp_color)
143+
plot_histogram(ax, dctcp_exp, "p50", "DCTCP P50", color=dctcp_color2)
144+
plot_histogram(ax, homa_exp, "p99", "Homa P99", color=homa_color)
145+
plot_histogram(ax, homa_exp, "p50", "Homa P50", color=homa_color2)
146+
ax.legend(loc="upper right", prop={'size': 9})
147+
plt.tight_layout()
148+
plt.savefig("%s/reports/rtt_%s.pdf" % (options.log_dir, workload))
131149

132150
# Generate CDF of small-message RTTs.
133151
log("Generating short message CDF for %s" % (workload))

‎util/cperf.py‎

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1447,15 +1447,18 @@ def get_digest(experiment):
14471447
digests[experiment] = digest
14481448
return digest
14491449

1450-
def start_slowdown_plot(title, max_y, x_experiment, size=10,
1450+
def start_plot_vs_msg_length(title, y_range, x_experiment, size=10,
14511451
show_top_label=True, show_bot_label=True, figsize=[6,4],
14521452
y_label="Slowdown", show_upper_x_axis=True):
14531453
"""
1454-
Create a pyplot graph that will be used for slowdown data. Returns the
1455-
Axes object for the plot.
1454+
Create a pyplot graph that will be used to display some value as a
1455+
function of message size, with the x-axis scaled so that distance
1456+
corresponds to cumulative number of messages.
14561457
14571458
title: Title for the plot; may be empty
1458-
max_y: Maximum y-coordinate
1459+
y_range: Either a single value giving maximum y-coordinate
1460+
(min will be 1) or a list containing min and max
1461+
values. The y-axis will be log-scale.
14591462
x_experiment: Name of experiment whose rtt distribution will be used to
14601463
label the x-axis of the plot. None means don't label the
14611464
x-axis (caller will presumably invoke cdf_xaxis to do it).
@@ -1473,11 +1476,16 @@ def start_slowdown_plot(title, max_y, x_experiment, size=10,
14731476
ax.set_title(title, size=size)
14741477
ax.set_xlim(0, 1.0)
14751478
ax.set_yscale("log")
1476-
ax.set_ylim(1, max_y)
1479+
if isinstance(y_range, list):
1480+
min_y, max_y = y_range
1481+
else:
1482+
min_y = 1
1483+
max_y = y_range
1484+
ax.set_ylim(min_y, max_y)
14771485
ax.tick_params(right=True, which="both", direction="in", length=5)
14781486
ticks = []
14791487
labels = []
1480-
y = 1
1488+
y = 10 ** (math.ceil(math.log10(min_y)))
14811489
while y <= max_y:
14821490
ticks.append(y)
14831491
labels.append("%d" % (y))
@@ -1607,7 +1615,7 @@ def plot_slowdown(ax, experiment, percentile, label, **kwargs):
16071615
16081616
ax: matplotlib Axes object: info will be plotted here.
16091617
experiment: Name of the experiment whose data should be graphed.
1610-
percentile: While percentile of slowdown to graph: must be "p50", "p99",
1618+
percentile: Which percentile of slowdown to graph: must be "p50", "p99",
16111619
or "p999"
16121620
label: Text to display in the graph legend for this curve
16131621
kwargs: Additional keyword arguments to pass through to plt.plot
@@ -1628,6 +1636,23 @@ def plot_slowdown(ax, experiment, percentile, label, **kwargs):
16281636
% (percentile))
16291637
ax.plot(x, y, label=label, **kwargs)
16301638

1639+
def plot_histogram(ax, experiment, metric, label, **kwargs):
1640+
"""
1641+
Add a histogram to a plot created by start_plot_vs_msg_length().
1642+
1643+
ax: matplotlib Axes object: info will be plotted here.
1644+
experiment: Name of the experiment whose data should be graphed.
1645+
percentile: Metric from experiment to graph, such as "p50" for 50th
1646+
percentile latency or "slow_99" for 99th percentile
1647+
slowdown
1648+
label: Text to display in the graph legend for this curve
1649+
kwargs: Additional keyword arguments to pass through to plt.plot
1650+
"""
1651+
digest = get_digest(experiment)
1652+
x, y = make_histogram(digest["cum_frac"], digest[metric],
1653+
init=[0, digest[metric][0]], after=False)
1654+
ax.plot(x, y, label=label, **kwargs)
1655+
16311656
def start_cdf_plot(title, min_x, max_x, min_y, x_label, y_label,
16321657
figsize=[5, 4], size=10, xscale="log", yscale="log"):
16331658
"""

0 commit comments

Comments
 (0)