diff --git a/pq-tls-benchmark-framework/emulation-exp/code/kex/scripts/generate_graphs.py b/pq-tls-benchmark-framework/emulation-exp/code/kex/scripts/generate_graphs.py index 0535d9172ebfb1ab6b8bf0cd872b04ecd4285e7b..c74988d55e63b6d68514ddff715bd7e9bbaceb79 100755 --- a/pq-tls-benchmark-framework/emulation-exp/code/kex/scripts/generate_graphs.py +++ b/pq-tls-benchmark-framework/emulation-exp/code/kex/scripts/generate_graphs.py @@ -753,6 +753,86 @@ def plot_lines(data): ) plt.close() + def plot_lines_for_tcp_and_cquiche_cubic_for_a_sec_level(data, line_type="median"): + os.makedirs( + f"{PLOTS_DIR}/lines/between-cquiche-cubic-and-tlstcp/{line_type}s-of-sec-level/", + mode=0o777, + exist_ok=True, + ) + + # get all combination of scenario, protocol, sec_level + unique_combinations = data[["scenario", "sec_level"]].drop_duplicates() + # print(len(unique_combinations)) + # print(unique_combinations) + + for _, row in unique_combinations.iterrows(): + sec_level = row["sec_level"] + filtered_data = filter_data( + data, + scenario=row["scenario"], + sec_level=sec_level, + ) + # print(f"scenario: {row['scenario']}, protocol: {row['protocol']}, sec_level: {row['sec_level']}") + + plt.figure() + for protocol in ["tlstcp", "cquiche-cubic"]: + inner_filtered_data = filter_data(filtered_data, protocol=protocol) + for idx, kem_alg in enumerate( + inner_filtered_data["kem_alg"].unique().sort_values() + ): + # color = cmap(idx / len(inner_filtered_data["kem_alg"].unique())) + color, mode = get_color_and_mode(kem_alg) + if protocol == "tlstcp": + mode = "--" + + inner_filtered_data_single_kem_alg = filter_data( + inner_filtered_data, kem_alg=kem_alg + ) + # print(inner_filtered_data_single_kem_alg) + y = inner_filtered_data_single_kem_alg[line_type] + x = get_x_axis( + row["scenario"], inner_filtered_data_single_kem_alg, len(y) + ) + + # print( + # f"scenario: {row['scenario']}, protocol: {row['protocol']}, sec_level: {row['sec_level']}, kem_alg: {kem_alg}" + # ) + # print(f"x: {x}") + # print(f"y: {y}") + + prefix = "cquiche-cubic-" + if protocol == "tlstcp": + prefix = "tlstcp-" + plt.plot( + x, + y, + linestyle=mode, + marker=".", + color=color, + label=f"{prefix}{kem_alg}", + ) + + plt.ylim(bottom=0) + plt.xlim(left=0, right=x.max() + (x.max() / 50)) + plt.xlabel(row["scenario"]) + plt.ylabel(f"Time-to-first-byte (ms)") + # plt.title( + # f"Medians of {row['scenario']} in {row['protocol']} in {row['sec_level']}" + # ) + plt.grid() + plt.legend( + bbox_to_anchor=(0.5, 1), + loc="lower center", + ncol=3, + fontsize="small", + ) + plt.tight_layout() + + plt.savefig( + f"{PLOTS_DIR}/lines/between-cquiche-cubic-and-tlstcp/{line_type}s-of-sec-level/{line_type}-{row['scenario']}-{row['sec_level']}.pdf" + ) + plt.close() + def plot_lines_for_comparisons_between_protocols(data, line_type="median"): os.makedirs( f"{PLOTS_DIR}/lines/between-protocols/comparison-of-{line_type}s", @@ -883,6 +963,9 @@ def plot_lines(data): plot_lines_for_comparisons_between_protocols( data, line_type=statistical_measurement ) + plot_lines_for_tcp_and_cquiche_cubic_for_a_sec_level( + data, line_type=statistical_measurement + ) plot_qtls_of_single_algorithm(data)