-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #219 from Tencent/release/v0.9.0
Release/v0.9.0
- Loading branch information
Showing
18 changed files
with
777 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import os | ||
import sys | ||
|
||
import json | ||
import matplotlib.pyplot as plt | ||
import numpy as np | ||
|
||
# QUIC implementes | ||
IMPLS = ["tquic", "lsquic", "picoquic", "quiche"] | ||
|
||
# Different file sizes | ||
SIZES = ["10m", "1m", "100k"] | ||
|
||
# Different loss rates | ||
RATES = [0, 1, 3, 5] | ||
|
||
# Running count for each test | ||
COUNT = 10 | ||
|
||
|
||
# Read a measurement file generated by goodput testing | ||
def read_data(data_dir, impl, cc, size, loss): | ||
dirname = "goodput%s-%s-%s" % (size, cc, impl) | ||
filename = "goodput%s-%s-%s-%s.json" % (size, loss, cc, impl) | ||
path = os.path.join(data_dir, dirname, filename) | ||
try: | ||
with open(path) as f: | ||
data = json.load(f) | ||
return data["measurements"][0][0]["data"] | ||
except: | ||
return None | ||
|
||
|
||
# Plot the throughput graph for the specified CC algorithm under different file | ||
# sizes and packet loss rates. | ||
def plot(data_dir, cc): | ||
fig, axs = plt.subplots(len(SIZES), len(RATES), figsize=(15,10)) | ||
x = np.linspace(0, COUNT, COUNT) | ||
for i in range(len(SIZES)): | ||
for j in range(len(RATES)): | ||
for impl in IMPLS: | ||
data = read_data(data_dir, impl, cc, SIZES[i], RATES[j]) | ||
if data is None or len(data) != COUNT: | ||
continue | ||
axs[i, j].plot(x, data, label=impl, marker="o") | ||
axs[i, j].set_xlabel("Run #") | ||
axs[i, j].set_ylabel("Goodput") | ||
axs[i, j].set_title("%s loss rate %s%%" % (SIZES[i], RATES[j])) | ||
axs[i, j].legend() | ||
plt.suptitle(cc.upper()) | ||
plt.tight_layout() | ||
plt.savefig("goodput-%s.png" % (cc), dpi=300) | ||
|
||
|
||
if __name__ == '__main__': | ||
if len(sys.argv) < 2: | ||
print("Usage: %s [data_dir]" % (sys.argv[0])) | ||
exit(1) | ||
|
||
data_dir= sys.argv[1] | ||
plot(data_dir, "bbr") | ||
plot(data_dir, "cubic") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import os | ||
import sys | ||
|
||
import json | ||
import matplotlib.pyplot as plt | ||
import numpy as np | ||
from matplotlib.colors import ListedColormap | ||
|
||
# QUIC implementes | ||
CLIENT_IMPLS = ["tquic", "lsquic", "quiche", "picoquic", "ngtcp2", "msquic", | ||
"s2n-quic", "quinn", "neqo", "kwik", "aioquic", "chrome", | ||
"go-x-net", "quic-go", "mvfst"] | ||
|
||
SERVER_IMPLS = ["lsquic", "quiche", "picoquic", "ngtcp2", "msquic", "s2n-quic", | ||
"quinn", "neqo", "kwik", "aioquic", "nginx", "haproxy", | ||
"go-x-net", "quic-go", "mvfst"] | ||
|
||
# Interop test cases | ||
INTEROP_TESTS = ["handshake", "retry", "resumption", "zerortt", "amplificationlimit", | ||
"http3", "ipv6", "transfer", "multiplexing", "longrtt", "blackhole", | ||
"handshakeloss", "handshakecorruption", "transferloss","transfercorruption"] | ||
|
||
|
||
# Read a interop file generated by interop testing | ||
def read_data(data_dir, server, client): | ||
dirname = "%s-%s/%s-%s-logs" % (server, client, server, client) | ||
path = os.path.join(data_dir, dirname, "interop.json") | ||
try: | ||
with open(path) as f: | ||
data = json.load(f) | ||
return convert_data(data["results"][0]) | ||
except: | ||
return [0] * len(INTEROP_TESTS) | ||
|
||
|
||
# Convert interop results to a vector | ||
def convert_data(result): | ||
data = [0] * len(INTEROP_TESTS) | ||
for i, name in enumerate(INTEROP_TESTS): | ||
for item in result: | ||
if item["name"] != name: | ||
continue | ||
if item["result"] == "succeeded": | ||
data[i] = 3 | ||
elif item["result"] == "unsupported": | ||
data[i] = 2 | ||
else: | ||
data[i] = 1 | ||
break | ||
return data | ||
|
||
|
||
# Convert test result to a letter | ||
def convert_text(value): | ||
if value == 3: | ||
return "Y" # success | ||
elif value == 2: | ||
return "U" # unsupported | ||
elif value == 1: | ||
return "N" # failure | ||
else: | ||
return "-" # unknown | ||
|
||
|
||
# Plot the interop graph | ||
def plot(data_dir, is_tquic_server): | ||
impls = CLIENT_IMPLS if is_tquic_server else SERVER_IMPLS | ||
name = "server" if is_tquic_server else "client" | ||
if is_tquic_server: | ||
data = [read_data(data_dir, "tquic", impl) for impl in impls] | ||
else: | ||
data = [read_data(data_dir, impl, "tquic") for impl in impls] | ||
interop_result = np.array(data) | ||
print(interop_result) | ||
|
||
fig, ax = plt.subplots() | ||
im = ax.imshow(interop_result, cmap=ListedColormap(['gray', 'red', 'blue', 'green']), | ||
interpolation='nearest') | ||
ax.set_xticks(np.arange(len(INTEROP_TESTS)), labels=INTEROP_TESTS) | ||
ax.set_yticks(np.arange(len(impls)), labels=impls) | ||
plt.setp(ax.get_xticklabels(), rotation=45, ha="right", | ||
rotation_mode="anchor") | ||
for i in range(len(INTEROP_TESTS)): | ||
for j in range(len(impls)): | ||
text = ax.text(j, i, convert_text(interop_result[i, j]), | ||
ha="center", va="center", color="w") | ||
ax.set_title("TQUIC %s interop results" % (name)) | ||
fig.tight_layout() | ||
|
||
filename = "interop-tquic-%s.png" % (name) | ||
plt.savefig(filename, dpi=300) | ||
|
||
|
||
if __name__ == '__main__': | ||
if len(sys.argv) < 2: | ||
print("Usage: %s [data_dir]" % (sys.argv[0])) | ||
exit(1) | ||
|
||
data_dir= sys.argv[1] | ||
plot(data_dir, True) | ||
plot(data_dir, False) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.