From ec0a37cf38e7ff00bbf7c6440dfe26e77b869f9d Mon Sep 17 00:00:00 2001 From: onyinyang Date: Tue, 11 Oct 2022 02:46:04 -0400 Subject: [PATCH] Proposed changes for artifact, run_tests_fast feature runs with 100 users --- crates/lox-library/Cargo.toml | 1 + crates/lox-library/Dockerfile | 7 + .../lox-library/Parsing-results/blockages.py | 60 ++++++ .../Parsing-results/check_blockages.py | 110 +++++++++++ .../Parsing-results/make_steady.py | 79 ++++++++ .../Parsing-results/make_tables.py | 68 +++++++ .../lox-library/Parsing-results/parse_data.sh | 14 ++ .../Parsing-results/performance.py | 63 +++++++ .../lox-library/Parsing-results/pets_plots.py | 62 ++++++ .../lox-library/Parsing-results/raw_to_csv.py | 176 ++++++++++++++++++ .../Parsing-results/trust_promo.py | 86 +++++++++ .../Parsing-results/trust_promo_plot.py | 74 ++++++++ crates/lox-library/README.md | 27 ++- crates/lox-library/run_tests_fast.sh | 29 +++ crates/lox-library/src/tests.rs | 49 ++--- 15 files changed, 877 insertions(+), 28 deletions(-) create mode 100644 crates/lox-library/Parsing-results/blockages.py create mode 100644 crates/lox-library/Parsing-results/check_blockages.py create mode 100644 crates/lox-library/Parsing-results/make_steady.py create mode 100644 crates/lox-library/Parsing-results/make_tables.py create mode 100755 crates/lox-library/Parsing-results/parse_data.sh create mode 100644 crates/lox-library/Parsing-results/performance.py create mode 100644 crates/lox-library/Parsing-results/pets_plots.py create mode 100644 crates/lox-library/Parsing-results/raw_to_csv.py create mode 100644 crates/lox-library/Parsing-results/trust_promo.py create mode 100644 crates/lox-library/Parsing-results/trust_promo_plot.py create mode 100755 crates/lox-library/run_tests_fast.sh diff --git a/crates/lox-library/Cargo.toml b/crates/lox-library/Cargo.toml index 6b7e6a9..ea76d76 100644 --- a/crates/lox-library/Cargo.toml +++ b/crates/lox-library/Cargo.toml @@ -28,3 +28,4 @@ default = ["u64_backend"] u32_backend = ["curve25519-dalek/u32_backend"] u64_backend = ["curve25519-dalek/u64_backend"] simd_backend = ["curve25519-dalek/simd_backend"] +fast = [] diff --git a/crates/lox-library/Dockerfile b/crates/lox-library/Dockerfile index 1c12288..35f7a44 100644 --- a/crates/lox-library/Dockerfile +++ b/crates/lox-library/Dockerfile @@ -3,6 +3,13 @@ WORKDIR /home/lox ADD src/ ./src/ ADD Cargo.toml Cargo.toml ADD tests/ ./tests/ +ADD run_tests_fast.sh . +ADD Parsing-results ./Parsing-results ADD README.md README.md +RUN apt-get update -y +RUN apt-get install -y python3 python3-pip +RUN pip3 install pandas +RUN pip3 install numpy +RUN pip3 install matplotlib RUN cargo build --release ENV SHELL=/bin/bash diff --git a/crates/lox-library/Parsing-results/blockages.py b/crates/lox-library/Parsing-results/blockages.py new file mode 100644 index 0000000..6da60c4 --- /dev/null +++ b/crates/lox-library/Parsing-results/blockages.py @@ -0,0 +1,60 @@ +import pandas as pd +import matplotlib.pyplot as plt +from matplotlib.lines import Line2D + +fig, (axs, axs1) = plt.subplots(2, 4, figsize=(24, 12)) +fig.suptitle("Checking for Blockage and Migration to new Bridges for" + + " Percentage of Bridges Blocked") +columns = ["Percent", "RequestT", "Rtstdev", "ResponseS", "ResponseT", + "ReTstdev", "ResponseHT", "RHTstdev"] +df = pd.read_csv("check_blockage.csv", usecols=columns) +df1 = pd.read_csv("migration.csv", usecols=columns) +fig.supxlabel('Blocked Bridges (%)') +axs[0].set_ylabel('Request Time (ms)') +axs[0].set_ylim([0,70]) +l1 = axs[0].plot(df.Percent, df.RequestT, color='#CC4F1B', + label='Request Time for Percentage of Bridges Blocked') +axs[0].fill_between(df.Percent, df.RequestT-df.Rtstdev, df.RequestT+df.Rtstdev, + alpha=0.5, edgecolor='#CC4F1B', facecolor='#FF9848') +axs1[0].set_ylabel('Request Time (ms)') +axs1[0].set_ylim([0,70]) +axs1[0].plot(df1.Percent, df1.RequestT, color='#1B2ACC', + label='Request Time for Percentage of Bridges Blocked') +axs1[0].fill_between(df1.Percent, df1.RequestT-df1.Rtstdev, + df1.RequestT+df1.Rtstdev, alpha=0.2, edgecolor='#1B2ACC', + facecolor='#089FFF') +axs[1].set_ylabel('Response Time (ms)') +axs[1].plot(df.Percent, df.ResponseT, color='#CC4F1B', + label='Response Time for Percentage of Bridges Blocked') +axs[1].fill_between(df.Percent, df.ResponseT-df.ReTstdev, + df.ResponseT+df.ReTstdev, alpha=0.5, edgecolor='#CC4F1B', + facecolor='#FF9848') +axs1[1].set_ylabel('Response Time (ms)') +axs1[1].set_ylim([0,70]) +axs1[1].plot(df1.Percent, df1.ResponseT, color='#1B2ACC', + label='Response Time for Percentage of Bridges Blocked') +axs1[1].fill_between(df1.Percent, df1.ResponseT-df1.ReTstdev, + df1.ResponseT+df1.ReTstdev, alpha=0.2, edgecolor='#1B2ACC', + facecolor='#089FFF') +axs[2].set_ylabel('Response Size (ms)') +axs[2].plot(df.Percent, df.ResponseS, color='#CC4F1B', + label='Response Size for Percentage of Bridges Blocked') +axs1[2].set_ylabel('Response Size (ms)') +axs1[2].plot(df1.Percent, df1.ResponseS, color='#1B2ACC', + label='Response Size for Percentage of Bridges Blocked') +axs[3].set_ylabel('Response Handling Time (ms)') +axs[3].plot(df.Percent, df.ResponseHT, color='#CC4F1B', + label='Response Handling Time for Percentage of Bridges Blocked') +axs[3].fill_between(df.Percent, df.ResponseHT-df.RHTstdev, + df.ResponseHT+df.RHTstdev, alpha=0.5, edgecolor='#CC4F1B', + facecolor='#FF9848') +axs1[3].set_ylabel('Response Handling Time (ms)') +axs1[3].set_ylim([0,70]) +axs1[3].plot(df1.Percent, df1.ResponseHT, color='#1B2ACC', + label='Response Handling Time for Percentage of Bridges Blocked') +axs1[3].fill_between(df1.Percent, df1.ResponseHT-df1.RHTstdev, + df1.ResponseHT+df1.RHTstdev, alpha=0.2, edgecolor='#1B2ACC', + facecolor='#089FFF') +legend_elements = [Line2D([0], [0], color='#CC4F1B', label="Check Blockage Protocol"), Line2D([0], [0], color='#1B2ACC', label="Blockage Migration Protocol")] +fig.legend(handles=legend_elements, loc='lower right') +fig.savefig("Performance.pdf") diff --git a/crates/lox-library/Parsing-results/check_blockages.py b/crates/lox-library/Parsing-results/check_blockages.py new file mode 100644 index 0000000..4e820c6 --- /dev/null +++ b/crates/lox-library/Parsing-results/check_blockages.py @@ -0,0 +1,110 @@ +import sys +import pandas as pd +import matplotlib +import matplotlib.pyplot as plt +from matplotlib.lines import Line2D + + +def main(): + + fig, axs = plt.subplots(1, 3, figsize=(24, 7)) + columns = ["Percent","Bridges", "RequestT", "Rtstdev", "ResponseS", "ResponseT", + "ReTstdev", "ResponseHT", "RHTstdev"] + df = pd.read_csv("standard_check"+".csv", usecols=columns) + df.sort_values(["Percent"], axis=0,ascending=[False], inplace=True) + bridges = df.Bridges*2*3 + fig.supxlabel('Blocked Bridges (%)', size=30) + axs[0].set_ylabel('Response Time (ms)', size=25) + axs[0].tick_params(axis='x', labelsize=15) + axs[0].tick_params(axis='y', labelsize=15) +# axs[0].set_xticklabels('Blocked Bridges (%)',fontsize=10) + axs[0].plot(df.Percent, df.ResponseT, color='#CC4F1B', + label='Response Time for Percentage of Bridges Blocked') + axs[0].fill_between(df.Percent, df.ResponseT-df.ReTstdev, + df.ResponseT+df.ReTstdev, alpha=0.5, edgecolor='#CC4F1B', + facecolor='#FF9848') + axs[1].set_ylabel('Response Size (bytes)', size=25) + axs[1].tick_params(axis='x', labelsize=15) + axs[1].tick_params(axis='y', labelsize=15) + axs[1].plot(df.Percent, df.ResponseS, color='#CC4F1B', + label='Response Size for Percentage of Bridges Blocked') + axs[2].set_ylabel('Response Handling Time (ms)', size=25) + axs[2].tick_params(axis='x', labelsize=15) + axs[2].tick_params(axis='y', labelsize=15) + axs[2].plot(df.Percent, df.ResponseHT, color='#CC4F1B', + label='Response Handling Time for Percentage of Bridges Blocked') + axs[2].fill_between(df.Percent, df.ResponseHT-df.RHTstdev, + df.ResponseHT+df.RHTstdev, alpha=0.5, edgecolor='#CC4F1B', + facecolor='#FF9848') + fig. tight_layout(pad=1) + fig.savefig("StandardCheck.pdf") + plt.close('all') + + for n in range(5,105,5): + fig, axs = plt.subplots(1, 3, figsize=(24, 7)) + columns = ["Percent","Bridges", "RequestT", "Rtstdev", "ResponseS", "ResponseT", + "ReTstdev", "ResponseHT", "RHTstdev"] + df = pd.read_csv("checkblockage"+str(n)+".csv", usecols=columns) + bridges = df.Bridges*2*3 + fig.supxlabel('Total Size of Bridge Pool ('+str(n)+'% Bridges Blocked)',size=30) + axs[0].set_ylabel('Response Time (ms)', size=25) + axs[0].tick_params(axis='x', labelsize=15) + axs[0].tick_params(axis='y', labelsize=15) + axs[0].plot(bridges, df.ResponseT, color='#740202', + label='Response Time for Percentage of Bridges Blocked') + axs[0].fill_between(bridges, df.ResponseT-df.ReTstdev, + df.ResponseT+df.ReTstdev, alpha=0.5, edgecolor='#740202', + facecolor='#E75252') + axs[1].set_ylabel('Response Size (bytes)', size=25) + axs[1].tick_params(axis='x', labelsize=15) + axs[1].tick_params(axis='y', labelsize=15) + axs[1].plot(bridges, df.ResponseS, color='#740202', + label='Response Size for Percentage of Bridges Blocked') + axs[2].set_ylabel('Response Handling Time (ms)', size=25) + axs[2].tick_params(axis='x', labelsize=15) + axs[2].tick_params(axis='y', labelsize=15) + axs[2].plot(bridges, df.ResponseHT, color='#740202', + label='Response Handling Time for Percentage of Bridges Blocked') + axs[2].fill_between(bridges, df.ResponseHT-df.RHTstdev, + df.ResponseHT+df.RHTstdev, alpha=0.5, edgecolor='#740202', + facecolor='#E75252') + fig. tight_layout(pad=1) + fig.savefig("PerformanceVaried"+str(n)+".pdf") + print("\nDone PerformanceVaried"+str(n)+" Plot.\nOutput to: PerformanceVaried"+str(n)+".pdf") + plt.close('all') + + +def set_plot_options(): + options = { + 'font.size': 12, + 'figure.figsize': (4,2), + 'figure.dpi': 100.0, + 'figure.subplot.left': 0.20, + 'figure.subplot.right': 0.97, + 'figure.subplot.bottom': 0.20, + 'figure.subplot.top': 0.90, + 'grid.color': '0.1', + 'grid.linestyle': ':', + #'grid.linewidth': 0.5, + 'axes.grid' : True, + #'axes.grid.axis' : 'y', + #'axes.axisbelow': True, + 'axes.titlesize' : 25, + 'axes.labelsize' : 25, + 'axes.formatter.limits': (-4,4), + 'xtick.labelsize' : 30,#get_tick_font_size_10(), + 'ytick.labelsize' : 30,#get_tick_font_size_10(), + 'lines.linewidth' : 2.0, + 'lines.markeredgewidth' : 0.5, + 'lines.markersize' : 15, + } + + for option_key in options: + matplotlib.rcParams[option_key] = options[option_key] + if 'figure.max_num_figures' in matplotlib.rcParams: + matplotlib.rcParams['figure.max_num_figures'] = 100 + if 'figure.max_open_warning' in matplotlib.rcParams: + matplotlib.rcParams['figure.max_open_warning'] = 100 + +if __name__ == "__main__": + sys.exit(main()) diff --git a/crates/lox-library/Parsing-results/make_steady.py b/crates/lox-library/Parsing-results/make_steady.py new file mode 100644 index 0000000..674dfee --- /dev/null +++ b/crates/lox-library/Parsing-results/make_steady.py @@ -0,0 +1,79 @@ +#!/usr/bin/env python + +import sys +import json +import lzma +import numpy as np + +import matplotlib +import matplotlib.pyplot as pyplot +import matplotlib.colors as mcolors + + +def main(): + set_plot_options() + buckets = [600, 1200, 1800, 2400, 3000] + n = 1000000 + ft = [] + + pyplot.figure() + for b in buckets: + delta = np.arange(1/10,1,.01) + x = [] + for d in delta: + p = n*(1.61 + (14.71/d+23.725/d**2)/b) / 86400000 + x.append(p) + ft.append(x) + + + pyplot.plot(delta, ft[0], label='600 Buckets') + pyplot.plot(delta, ft[1], linestyle='dotted', label='1200 Buckets') + pyplot.plot(delta, ft[2], linestyle='dashed', label='1800 Buckets') + pyplot.plot(delta, ft[3], linestyle='dashdot', label='2400 Buckets') + pyplot.plot(delta, ft[4], label='3000 Buckets') + pyplot.ylim(bottom=0) + + pyplot.xlabel(r'$\Delta$') + pyplot.ylabel("Cores / Million Users") +# pyplot.title("Average Number of Bridge Users for 1 Month Old Bridges November 2021") + + + pyplot.legend(loc="upper right") + pyplot.tight_layout(pad=1) + pyplot.savefig("core-users.pdf") + +def set_plot_options(): + options = { + #'backend': 'PDF', + 'font.size': 18, + 'figure.figsize': (7,4), + 'figure.dpi': 100.0, + 'axes.grid' : True, + 'axes.xmargin' : 0, + 'axes.grid.axis' : 'y', + 'axes.axisbelow': True, + 'axes.titlesize' : 'medium', + 'axes.labelsize' : 'large', + 'axes.formatter.limits': (-6,6), + 'xtick.labelsize' : 18,#get_tick_font_size_10(), + 'ytick.labelsize' : 18, + 'lines.linewidth' : 2.0, + 'lines.markersize' : 10, + # turn on the following to embedd fonts; requires latex + 'ps.useafm' : True, + 'pdf.use14corefonts' : True, + 'text.usetex' : False, + } + + for option_key in options: + matplotlib.rcParams[option_key] = options[option_key] + + if 'figure.max_num_figures' in matplotlib.rcParams: + matplotlib.rcParams['figure.max_num_figures'] = 100 + if 'figure.max_open_warning' in matplotlib.rcParams: + matplotlib.rcParams['figure.max_open_warning'] = 100 + if 'legend.ncol' in matplotlib.rcParams: + matplotlib.rcParams['legend.ncol'] = 100 + +if __name__ == "__main__": + sys.exit(main()) diff --git a/crates/lox-library/Parsing-results/make_tables.py b/crates/lox-library/Parsing-results/make_tables.py new file mode 100644 index 0000000..36e6d16 --- /dev/null +++ b/crates/lox-library/Parsing-results/make_tables.py @@ -0,0 +1,68 @@ +import csv +import sys +import pandas as pd +import numpy as np + + +def main(): + perf = open("performance_stats"+".csv", "w", newline='') + protocols=["Open Invitation", "Trust Promotion(0->1)", + "Trust Migration (0->1)", "Level Up (1->4)", "Issue Invitation", + "Redeem Invitation", "Check Blockage 5%", "Check Blockage 50%", "Check Blockage 100%", "Blockage Migration"] + files = ["trust_levels.csv", "trust_promo.csv", "trust_mig.csv", "level2.csv", + "invitations.csv", "redeem_invites.csv","check_blockage5.csv", + "check_blockage50.csv","check_blockage100.csv","check_blockage50.csv"] + csv_cols = ["RequestS", "RequestT","Rtstdev","ResponseS","ResponseT", + "ReTstdev", "ResponseHT", "RHTstdev"] + perf_columns = ["Protocol","Request Size", "Request Time", "sigma", + "Response Size","Response Time", "sigma", + "Response Handling Time", "sigma"] + worst_resp = 0 + perfwriter = csv.writer(perf, delimiter=',') + perfwriter.writerow(perf_columns) + + for i, protocol in enumerate(protocols): + columns = ["Percent","Bridges", "RequestS", "Rsstdev", "RequestT", + "Rtstdev", "ResponseS","Restdev","ResponseT", + "ReTstdev", "ResponseHT", "RHTstdev"] + df = pd.read_csv(files[i], usecols=columns) + perf_in = [] + + perf_in.append(protocol) + for item in csv_cols: + row = df[item].loc[df['Bridges']==900].values + if "stdev" in item: + rounded = np.round(row[0], decimals=1) + else: + rounded = np.round(row[0], decimals=3) + perf_in.append(rounded) + rounded = np.round(row[0], decimals=1) + if item == "RequestT": + req = np.round(rounded, decimals=1) + elif item == "ResponseT": + resp_sec = np.round(1000/rounded, decimals=1) + resp_core = resp_sec/(1/(60*60*24)) + if rounded > worst_resp: + worst_resp = rounded + + + perfwriter.writerow(perf_in) + + for i, protocol in enumerate(protocols): + columns = ["Percent","Bridges", "RequestS", "Rsstdev", "RequestT", + "Rtstdev", "ResponseS","Restdev","ResponseT", + "ReTstdev", "ResponseHT", "RHTstdev"] + df = pd.read_csv(files[i], usecols=columns) + row = df['ResponseT'].loc[df['Bridges']==900].values + rounded = np.round(row[0], decimals=3) + resp_sec = np.round(1000/rounded, decimals=3) + resp_core = int(resp_sec/(1/(60*60*24))) + if worst_resp > rounded: + secs = int(worst_resp/1000) + + perf.close() + print("\nDone Tables.\nTable data output to: performance_stats.csv,\n") + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/crates/lox-library/Parsing-results/parse_data.sh b/crates/lox-library/Parsing-results/parse_data.sh new file mode 100755 index 0000000..f8d30fb --- /dev/null +++ b/crates/lox-library/Parsing-results/parse_data.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +# Parse results from Lox stat tests +echo 'Parse raw output to csv' + +python3 raw_to_csv.py + +echo 'Make plots for data' + +#python3 check_blockages.py +python3 pets_plots.py +#python3 trust_promo_plot.py +python3 make_tables.py +python3 make_steady.py diff --git a/crates/lox-library/Parsing-results/performance.py b/crates/lox-library/Parsing-results/performance.py new file mode 100644 index 0000000..0a3b58f --- /dev/null +++ b/crates/lox-library/Parsing-results/performance.py @@ -0,0 +1,63 @@ +#!/usr/bin/env python + +import sys +import pandas as pd +import matplotlib +import matplotlib.pyplot as plt +from matplotlib.lines import Line2D + + +def main(): + set_plot_options() + fig, axs = plt.subplots(1) + columns = ["Percent","Bridges", "RequestT", "Rtstdev", "ResponseS", "ResponseT", + "ReTstdev", "ResponseHT", "RHTstdev"] + df = pd.read_csv("standard_check"+".csv", usecols=columns) + df.sort_values(["Percent"], axis=0,ascending=[False], inplace=True) + bridges = df.Bridges*2*3 + axs.set_xlabel('Blocked Bridges (%)') + axs.set_ylabel('Response Time (ms)') + axs.plot(df.Percent, df.ResponseT, color='#CC4F1B', + label='Response Time for Percentage of Bridges Blocked') + axs.set_ylim(bottom=0) + axs.fill_between(df.Percent, df.ResponseT-df.ReTstdev, + df.ResponseT+df.ReTstdev, alpha=0.5, edgecolor='#CC4F1B', + facecolor='#FF9848') + fig. tight_layout(pad=1) + fig.savefig("StandardCheck.pdf") + +def set_plot_options(): + options = { + #'backend': 'PDF', + 'font.size': 18, + 'figure.figsize': (7,3.5), + 'figure.dpi': 100.0, + 'axes.grid' : True, + 'axes.xmargin' : 0, + 'axes.grid.axis' : 'y', + 'axes.axisbelow': True, + 'axes.titlesize' : 'medium', + 'axes.labelsize' : 'large', + 'axes.formatter.limits': (-6,6), + 'xtick.labelsize' : 18,#get_tick_font_size_10(), + 'ytick.labelsize' : 18, + 'lines.linewidth' : 2.0, + 'lines.markersize' : 10, + # turn on the following to embedd fonts; requires latex + 'ps.useafm' : True, + 'pdf.use14corefonts' : True, + 'text.usetex' : False, + } + + for option_key in options: + matplotlib.rcParams[option_key] = options[option_key] + + if 'figure.max_num_figures' in matplotlib.rcParams: + matplotlib.rcParams['figure.max_num_figures'] = 100 + if 'figure.max_open_warning' in matplotlib.rcParams: + matplotlib.rcParams['figure.max_open_warning'] = 100 + if 'legend.ncol' in matplotlib.rcParams: + matplotlib.rcParams['legend.ncol'] = 100 + +if __name__ == "__main__": + sys.exit(main()) diff --git a/crates/lox-library/Parsing-results/pets_plots.py b/crates/lox-library/Parsing-results/pets_plots.py new file mode 100644 index 0000000..7683c99 --- /dev/null +++ b/crates/lox-library/Parsing-results/pets_plots.py @@ -0,0 +1,62 @@ +import sys +import pandas as pd +import matplotlib +import matplotlib.pyplot as plt +from matplotlib.lines import Line2D + + +def main(): + + plt.figure(figsize=(9, 5)) + columns = ["Percent","Bridges", "RequestT", "Rtstdev", "ResponseS", "ResponseT", + "ReTstdev", "ResponseHT", "RHTstdev"] + df = pd.read_csv("standard_check"+".csv", usecols=columns) + df.sort_values(["Percent"], axis=0,ascending=[False], inplace=True) + bridges = df.Bridges*2*3 + plt.xlabel('Blocked Bridges (%)', size=20) + plt.ylabel('Response Time (ms)', size=20) + plt.tick_params(axis='x', labelsize=15) + plt.tick_params(axis='y', labelsize=15) + plt.plot(df.Percent, df.ResponseT, color='#CC4F1B', + label='Response Time for Percentage of Bridges Blocked') + plt.fill_between(df.Percent, df.ResponseT-df.ReTstdev, + df.ResponseT+df.ReTstdev, alpha=0.5, edgecolor='#CC4F1B', + facecolor='#FF9848') + plt.tight_layout(pad=1) + plt.savefig("StandardCheck.pdf") + plt.close('all') + +def set_plot_options(): + options = { + 'font.size': 12, + 'figure.figsize': (10,2), + 'figure.dpi': 100.0, + 'figure.subplot.left': 0.20, + 'figure.subplot.right': 0.97, + 'figure.subplot.bottom': 0.20, + 'figure.subplot.top': 0.90, + 'grid.color': '0.1', + 'grid.linestyle': ':', + #'grid.linewidth': 0.5, + 'axes.grid' : True, + #'axes.grid.axis' : 'y', + #'axes.axisbelow': True, + 'axes.titlesize' : 25, + 'axes.labelsize' : 25, + 'axes.formatter.limits': (-4,4), + 'xtick.labelsize' : 30,#get_tick_font_size_10(), + 'ytick.labelsize' : 30,#get_tick_font_size_10(), + 'lines.linewidth' : 2.0, + 'lines.markeredgewidth' : 0.5, + 'lines.markersize' : 15, + } + + for option_key in options: + matplotlib.rcParams[option_key] = options[option_key] + if 'figure.max_num_figures' in matplotlib.rcParams: + matplotlib.rcParams['figure.max_num_figures'] = 100 + if 'figure.max_open_warning' in matplotlib.rcParams: + matplotlib.rcParams['figure.max_open_warning'] = 100 + +if __name__ == "__main__": + sys.exit(main()) diff --git a/crates/lox-library/Parsing-results/raw_to_csv.py b/crates/lox-library/Parsing-results/raw_to_csv.py new file mode 100644 index 0000000..090cd8e --- /dev/null +++ b/crates/lox-library/Parsing-results/raw_to_csv.py @@ -0,0 +1,176 @@ +from pathlib import Path + +standard_check_file = open("standard_check"+".csv", "w") +standard_check_file.write("Percent,Bridges,RequestS,Rsstdev,RequestT,Rtstdev,ResponseS,Restdev,ResponseT,ReTstdev,ResponseHT,RHTstdev\n") + +for p in Path('.').glob('*.log'): + print(f"Parsing: {p.name.strip('.log')}\n") + with p.open() as log_file: + test_file = open(p.name.strip('.log')+".csv", "w") + test_file.write("Percent,Bridges,RequestS,Rsstdev,RequestT,Rtstdev,ResponseS,Restdev,ResponseT,ReTstdev,ResponseHT,RHTstdev\n") + bridges = 0 + c=False + red = 0 + check = 0 + level = 0 + protocol = 0 + num = 0 + req_size = 0 + req_size_std = 0 + req_time = 0 + req_time_std = 0 + resp_size = 0 + resp_size_std = 0 + resp_time = 0 + resp_time_std = 0 + resp_handle_time = 0 + resp_handle_std = 0 + endline = 0 + + # Loop over the remaining lines in the file + for line in log_file: + if "***START" in line: + bridges = line.split()[1].split("*")[0] + if "CHECK-BLOCKAGE" in line: + protocol = 1 + num = line.split("-")[6].strip('-') + if int(bridges) == 900: + check =1 + if not c: + check_b = open("check_blockage"+str(num)+".csv", "w") + check_b.write("Percent,Bridges,RequestS,Rsstdev,RequestT,Rtstdev,ResponseS,Restdev,ResponseT,ReTstdev,ResponseHT,RHTstdev\n") + c=True + elif "BLOCKAGE-MIGRATION" in line: + protocol = 2 + num = line.split("-")[6].strip('-') + elif "REDEEM" in line: + protocol = 3 + if not red: + redeem = open("redeem_invites.csv", "w") + redeem.write("Percent,Bridges,RequestS,Rsstdev,RequestT,Rtstdev,ResponseS,Restdev,ResponseT,ReTstdev,ResponseHT,RHTstdev\n") + red = 1 + elif "ISSUE" in line: + protocol = 4 + elif "OPEN" in line: + protocol = 5 + elif "TRUST-PROMOTION" in line: + protocol = 6 + if not level: + trust_promo = open("trust_promo.csv", "w") + trust_promo.write("Percent,Bridges,RequestS,Rsstdev,RequestT,Rtstdev,ResponseS,Restdev,ResponseT,ReTstdev,ResponseHT,RHTstdev\n") + elif "TRUST-MIGRATION" in line: + protocol = 7 + if not level: + mig_file = open("trust_mig.csv", "w") + mig_file.write("Percent,Bridges,RequestS,Rsstdev,RequestT,Rtstdev,ResponseS,Restdev,ResponseT,ReTstdev,ResponseHT,RHTstdev\n") + elif "LEVEL-UP-2" in line: + protocol = 8 + if not level: + level_file = open("level2.csv", "w") + level_file.write("Percent,Bridges,RequestS,Rsstdev,RequestT,Rtstdev,ResponseS,Restdev,ResponseT,ReTstdev,ResponseHT,RHTstdev\n") + elif "LEVEL-UP-3" in line: + protocol = 9 + if not level: + level_file_t = open("level3.csv", "w") + level_file_t.write("Percent,Bridges,RequestS,Rsstdev,RequestT,Rtstdev,ResponseS,Restdev,ResponseT,ReTstdev,ResponseHT,RHTstdev\n") + elif "LEVEL-UP-4" in line: + protocol = 10 + if not level: + level_file_f = open("level4.csv", "w") + level_file_f.write("Percent,Bridges,RequestS,Rsstdev,RequestT,Rtstdev,ResponseS,Restdev,ResponseT,ReTstdev,ResponseHT,RHTstdev\n") + level = 1 + elif protocol: + value = line.split(" = ") + if value[0].startswith("Average"): + if "request" in value[0]: + if "size" in value[0]: + raw_size = value[1].split(" ") + req_size = raw_size[0] + else: + if "µ" in value[1]: + micro_sec = value[1].split("µ") + raw_size = float(micro_sec[0])*0.001 + elif "m" not in value[1]: + sec = value[1][:-3] + raw_size = float(sec)*1000 + else: + raw_size = value[1][:-3] + req_time = raw_size + else: + if "size" in value[0]: + raw_size = value[1].split(" ") + resp_size = raw_size[0] + else: + if "µ" in value[1]: + micro_sec = value[1].split("µ") + raw_size = float(micro_sec[0])*0.001 + elif "m" not in value[1]: + sec = value[1][:-3] + raw_size = float(sec)*1000 + else: + raw_size = value[1][:-3] + if "handling" in value[0]: + resp_handle_time = raw_size + else: + resp_time = raw_size + elif value[0].startswith("Request"): + if "size" in value[0]: + raw_size = value[1].split(" ") + req_size_std = raw_size[0] + else: + if "µ" in value[1]: + micro_sec = value[1].split("µ") + to_sec = float(micro_sec[0])*0.001 + else: + to_sec = value[1][:-3] + req_time_std = to_sec + elif value[0].startswith("Response"): + if "size" in value[0]: + raw_size = value[1].split(" ") + resp_size_std = raw_size[0] + else: + if "µ" in value[1]: + micro_sec = value[1].split("µ") + to_sec = float(micro_sec[0])*0.001 + else: + to_sec = value[1][:-3] + if "handling" in value[0]: + resp_handle_time_std = to_sec + endline = 1 + else: + resp_time_std = to_sec + + if endline == 1: + if check == 1: + standard_check_file.write(str(num) + "," + str(bridges)+"," + str(req_size) + "," + str(req_size_std) + "," + str(req_time) + "," + str(req_time_std) + "," + str(resp_size) + "," + str(resp_size_std) + "," + str(resp_time) + "," + str(resp_time_std) + "," + str(resp_handle_time) + "," + str(resp_handle_time_std) + "\n") + check = 0 + if protocol == 1: + check_b.write(str(num) + "," + str(bridges)+"," + str(req_size) + "," + str(req_size_std) + "," + str(req_time) + "," + str(req_time_std) + "," + str(resp_size) + "," + str(resp_size_std) + "," + str(resp_time) + "," + str(resp_time_std) + "," + str(resp_handle_time) + "," + str(resp_handle_time_std) + "\n") + elif protocol == 3: + redeem.write(str(num) + "," + str(bridges)+"," + str(req_size) + "," + str(req_size_std) + "," + str(req_time) + "," + str(req_time_std) + "," + str(resp_size) + "," + str(resp_size_std) + "," + str(resp_time) + "," + str(resp_time_std) + "," + str(resp_handle_time) + "," + str(resp_handle_time_std) + "\n") + elif protocol<6: + test_file.write(str(num) + "," + str(bridges)+"," + str(req_size) + "," + str(req_size_std) + "," + str(req_time) + "," + str(req_time_std) + "," + str(resp_size) + "," + str(resp_size_std) + "," + str(resp_time) + "," + str(resp_time_std) + "," + str(resp_handle_time) + "," + str(resp_handle_time_std) + "\n") + else: + if protocol == 6: + trust_promo.write(str(num) + "," + str(bridges)+"," + str(req_size) + "," + str(req_size_std) + "," + str(req_time) + "," + str(req_time_std) + "," + str(resp_size) + "," + str(resp_size_std) + "," + str(resp_time) + "," + str(resp_time_std) + "," + str(resp_handle_time) + "," + str(resp_handle_time_std) + "\n") + if protocol == 7: + mig_file.write(str(num) + "," + str(bridges)+"," + str(req_size) + "," + str(req_size_std) + "," + str(req_time) + "," + str(req_time_std) + "," + str(resp_size) + "," + str(resp_size_std) + "," + str(resp_time) + "," + str(resp_time_std) + "," + str(resp_handle_time) + "," + str(resp_handle_time_std) + "\n") + if protocol == 8: + level_file.write(str(num) + "," + str(bridges)+"," + str(req_size) + "," + str(req_size_std) + "," + str(req_time) + "," + str(req_time_std) + "," + str(resp_size) + "," + str(resp_size_std) + "," + str(resp_time) + "," + str(resp_time_std) + "," + str(resp_handle_time) + "," + str(resp_handle_time_std) + "\n") + elif protocol == 9: + level_file_t.write(str(num) + "," + str(bridges)+"," + str(req_size) + "," + str(req_size_std) + "," + str(req_time) + "," + str(req_time_std) + "," + str(resp_size) + "," + str(resp_size_std) + "," + str(resp_time) + "," + str(resp_time_std) + "," + str(resp_handle_time) + "," + str(resp_handle_time_std) + "\n") + elif protocol == 10: + level_file_f.write(str(num) + "," + str(bridges)+"," + str(req_size) + "," + str(req_size_std) + "," + str(req_time) + "," + str(req_time_std) + "," + str(resp_size) + "," + str(resp_size_std) + "," + str(resp_time) + "," + str(resp_time_std) + "," + str(resp_handle_time) + "," + str(resp_handle_time_std) + "\n") + endline = 0 + protocol = 0 + if level: + level_file.close() + level_file_t.close() + level_file_f.close() + trust_promo.close() + mig_file.close() + if red: + redeem.close() + test_file.close() +standard_check_file.close() +print("Done.") diff --git a/crates/lox-library/Parsing-results/trust_promo.py b/crates/lox-library/Parsing-results/trust_promo.py new file mode 100644 index 0000000..c8fb0ae --- /dev/null +++ b/crates/lox-library/Parsing-results/trust_promo.py @@ -0,0 +1,86 @@ +log_file = open("trust_levels.log", "r").readlines() +trust_promo_file = open("trust_promo"+".csv", "w") +trust_promo_file.write("Bridges,RequestS,Rsstdev,RequestT,Rtstdev,ResponseS,Restdev,ResponseT,ReTstdev,ResponseHT,RHTstdev\n") + + +bridges = 0 +promo = 0 +req_size = 0 +req_size_std = 0 +req_time = 0 +req_time_std = 0 +resp_size = 0 +resp_size_std = 0 +resp_time = 0 +resp_time_std = 0 +resp_handle_time = 0 +resp_handle_std = 0 +endline = 0 + +# Loop over the remaining lines in the file +for line in log_file: + if "***START" in line: + bridges = line.split()[1].split("*")[0] + elif "TRUST-PROMOTION" in line: + promo = 1 + elif promo: + value = line.split(" = ") + if value[0].startswith("Average"): + if "request" in value[0]: + if "size" in value[0]: + raw_size = value[1].split(" ") + req_size = raw_size[0] + else: + raw_size = value[1] + req_time = raw_size[:-3] + else: + if "size" in value[0]: + raw_size = value[1].split(" ") + resp_size = raw_size[0] + else: + raw_size = value[1] + if "handling" in value[0]: + resp_handle_time = raw_size[:-3] + elif (value[1][-3]) != "m": + sec = value[1][:-3] + resp_time = float(sec)*1000 + else: + resp_time = raw_size[:-3] + elif value[0].startswith("Request"): + if "size" in value[0]: + raw_size = value[1].split(" ") + req_size_std = raw_size[0] + else: + if "µ" in value[1]: + micro_sec = value[1].split("µ") + to_sec = float(micro_sec[0])*0.001 + else: + to_sec = value[1][:-3] + req_time_std = to_sec + + elif value[0].startswith("Response"): + if "size" in value[0]: + raw_size = value[1].split(" ") + resp_size_std = raw_size[0] + elif "bytes" in value[1]: + continue + else: + if "µ" in value[1]: + micro_sec = value[1].split("µ") + to_sec = float(micro_sec[0])*0.001 + else: + to_sec = value[1][:-3] + if "handling" in value[0]: + resp_handle_time_std = to_sec + endline = 1 + else: + resp_time_std = to_sec + + if endline == 1: + if promo == 1: + trust_promo_file.write(str(bridges)+"," + str(req_size) + "," + str(req_size_std) + "," + str(req_time) + "," + str(req_time_std) + "," + str(resp_size) + "," + str(resp_size_std) + "," + str(resp_time) + "," + str(resp_time_std) + "," + str(resp_handle_time) + "," + str(resp_handle_time_std) + "\n") + promo = 0 + endline = 0 + +trust_promo_file.close() +print("Done.") diff --git a/crates/lox-library/Parsing-results/trust_promo_plot.py b/crates/lox-library/Parsing-results/trust_promo_plot.py new file mode 100644 index 0000000..7c1eaea --- /dev/null +++ b/crates/lox-library/Parsing-results/trust_promo_plot.py @@ -0,0 +1,74 @@ +import sys +import pandas as pd +import matplotlib +import matplotlib.pyplot as plt +from matplotlib.lines import Line2D + + +def main(): + + fig, axs = plt.subplots(1, 3, figsize=(24, 7)) + columns = ["Bridges", "RequestT", "Rtstdev", "ResponseS", "ResponseT", + "ReTstdev", "ResponseHT", "RHTstdev"] + df = pd.read_csv("trust_promo"+".csv", usecols=columns) + bridges = df.Bridges*2*3 + fig.supxlabel('Total Size of Bridge Pool',size=30) + axs[0].set_ylabel('Response Time (ms)', size=25) + axs[0].tick_params(axis='x', labelsize=15) + axs[0].tick_params(axis='y', labelsize=15) + axs[0].plot(bridges, df.ResponseT, color='#29135F', + label='Response Time for Trust Promotion') + axs[0].fill_between(bridges, df.ResponseT-df.ReTstdev, + df.ResponseT+df.ReTstdev, alpha=0.5, edgecolor='#29135F', + facecolor='#8967E2') + axs[1].set_ylabel('Response Size (bytes)', size=25) + axs[1].tick_params(axis='x', labelsize=15) + axs[1].tick_params(axis='y', labelsize=15) + axs[1].plot(bridges, df.ResponseS, color='#29135F', + label='Response Size for Trust Promotion') + axs[2].set_ylabel('Response Handling Time (ms)', size=25) + axs[2].tick_params(axis='x', labelsize=15) + axs[2].tick_params(axis='y', labelsize=15) + axs[2].plot(bridges, df.ResponseHT, color='#29135F', + label='Response Handling Time for Trust Promotion') + axs[2].fill_between(bridges, df.ResponseHT-df.RHTstdev, + df.ResponseHT+df.RHTstdev, alpha=0.5, edgecolor='#29135F', + facecolor='#8967E2') + fig. tight_layout(pad=1) + fig.savefig("TrustPromotion.pdf") + print("\nDone Trust Promotion Plot.\nOutput to: TrustPromotion.pdf") + +def set_plot_options(): + options = { + 'font.size': 12, + 'figure.figsize': (4,2), + 'figure.dpi': 100.0, + 'figure.subplot.left': 0.20, + 'figure.subplot.right': 0.97, + 'figure.subplot.bottom': 0.20, + 'figure.subplot.top': 0.90, + 'grid.color': '0.1', + 'grid.linestyle': ':', + #'grid.linewidth': 0.5, + 'axes.grid' : True, + #'axes.grid.axis' : 'y', + #'axes.axisbelow': True, + 'axes.titlesize' : 'large', + 'axes.labelsize' : 'x-large', + 'axes.formatter.limits': (-4,4), + 'xtick.labelsize' : 20,#get_tick_font_size_10(), + 'ytick.labelsize' : 20,#get_tick_font_size_10(), + 'lines.linewidth' : 2.0, + 'lines.markeredgewidth' : 0.5, + 'lines.markersize' : 10, + } + + for option_key in options: + matplotlib.rcParams[option_key] = options[option_key] + if 'figure.max_num_figures' in matplotlib.rcParams: + matplotlib.rcParams['figure.max_num_figures'] = 100 + if 'figure.max_open_warning' in matplotlib.rcParams: + matplotlib.rcParams['figure.max_open_warning'] = 100 + +if __name__ == "__main__": + sys.exit(main()) diff --git a/crates/lox-library/README.md b/crates/lox-library/README.md index a4e08f3..f8572e0 100644 --- a/crates/lox-library/README.md +++ b/crates/lox-library/README.md @@ -10,7 +10,7 @@ Lox is written in rust and requires `cargo` to test. [Install Rust](https://www. ./run-lox.sh ``` -### To run the tests used for our experimental results run: +### To run the full tests used for our experimental results run: ``` cargo test --release -- --nocapture TESTNAME @@ -19,9 +19,9 @@ cargo test --release -- --nocapture TESTNAME Where `TESTNAME` is one of: ``` -stats_test_trust_levels +stats_test_trust_levels stats_test_invitations -stats_test_percent_blockage_migration_05 +stats_test_percent_blockage_migration_05 stats_test_percent_blockage_migration_010 stats_test_percent_blockage_migration_15 stats_test_percent_blockage_migration_20 @@ -29,11 +29,11 @@ stats_test_percent_blockage_migration_25 stats_test_percent_blockage_migration_30 stats_test_percent_blockage_migration_35 stats_test_percent_blockage_migration_40 -stats_test_percent_blockage_migration_45 +stats_test_percent_blockage_migration_45 stats_test_percent_blockage_migration_50 stats_test_percent_blockage_migration_55 stats_test_percent_blockage_migration_60 -stats_test_percent_blockage_migration_65 +stats_test_percent_blockage_migration_65 stats_test_percent_blockage_migration_70 stats_test_percent_blockage_migration_75 stats_test_percent_blockage_migration_80 @@ -43,7 +43,22 @@ stats_test_percent_blockage_migration_95 stats_test_percent_blockage_migration_100 ``` -Each test takes approximately 20-30 hours to run. +Each test takes approximately 20-30 hours to run. However, this can be improved +by passing the `fast` feature. Using this feature, our tests are run for 100 +users instead of 10000 users and will produce results comparable to our +reported results (with larger error margins). To run individual tests with this +flag run: + +``` + cargo test --release --features=fast -- --nocapture TESTNAME + ``` + + To run all tests in fast mode and output the results to the Parsing-results + directory, run: + +``` +./run_tests_fast +``` Note that: our implementation is coded such that the reachability certificate expires at 00:00 UTC. A workaround has been included in each test to pause if it is too close to this time so the request won't fail. In reality, if the bucket is still reachable, a user could simply request a new reachability token if their request fails for this reason (a new certificate should be available prior to the outdated certificate expiring). diff --git a/crates/lox-library/run_tests_fast.sh b/crates/lox-library/run_tests_fast.sh new file mode 100755 index 0000000..a5546b9 --- /dev/null +++ b/crates/lox-library/run_tests_fast.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +cargo test --release --features=fast -- --nocapture stats_test_trust_levels > trust_levels.log +cargo test --release --features=fast -- --nocapture stats_test_invitations > invitations.log +cargo test --release --features=fast -- --nocapture stats_test_percent_blockage_migration_05 > check_blockage05.log +cargo test --release --features=fast -- --nocapture stats_test_percent_blockage_migration_010 > check_blockage010.log +cargo test --release --features=fast -- --nocapture stats_test_percent_blockage_migration_20 > check_blockage20.log +cargo test --release --features=fast -- --nocapture stats_test_percent_blockage_migration_25 > check_blockage25.log +cargo test --release --features=fast -- --nocapture stats_test_percent_blockage_migration_30 > check_blockage30.log +cargo test --release --features=fast -- --nocapture stats_test_percent_blockage_migration_35 > check_blockage35.log +cargo test --release --features=fast -- --nocapture stats_test_percent_blockage_migration_40 > check_blockage40.log +cargo test --release --features=fast -- --nocapture stats_test_percent_blockage_migration_45 > check_blockage45.log +cargo test --release --features=fast -- --nocapture stats_test_percent_blockage_migration_50 > check_blockage50.log +cargo test --release --features=fast -- --nocapture stats_test_percent_blockage_migration_55 > check_blockage55.log +cargo test --release --features=fast -- --nocapture stats_test_percent_blockage_migration_60 > check_blockage60.log +cargo test --release --features=fast -- --nocapture stats_test_percent_blockage_migration_65 > check_blockage65.log +cargo test --release --features=fast -- --nocapture stats_test_percent_blockage_migration_70 > check_blockage70.log +cargo test --release --features=fast -- --nocapture stats_test_percent_blockage_migration_75 > check_blockage75.log +cargo test --release --features=fast -- --nocapture stats_test_percent_blockage_migration_80 > check_blockage80.log +cargo test --release --features=fast -- --nocapture stats_test_percent_blockage_migration_85 > check_blockage85.log +cargo test --release --features=fast -- --nocapture stats_test_percent_blockage_migration_90 > check_blockage90.log +cargo test --release --features=fast -- --nocapture stats_test_percent_blockage_migration_95 > check_blockage95.log +cargo test --release --features=fast -- --nocapture stats_test_percent_blockage_migration_100 > check_blockage100.log +echo "Completed all tests, now parsing results" +mv *.log Parsing-results +cd Parsing-results +./parse_data.sh +echo "Parse results are in the Parsing-results folder." + diff --git a/crates/lox-library/src/tests.rs b/crates/lox-library/src/tests.rs index 1766ed4..1c9f98e 100644 --- a/crates/lox-library/src/tests.rs +++ b/crates/lox-library/src/tests.rs @@ -11,6 +11,11 @@ use std::collections::HashSet; use std::thread; use std::time::{Duration, Instant}; +#[cfg(feature = "fast")] +const USERS: usize = 100; +#[cfg(not(feature = "fast"))] +const USERS: usize = 10000; + struct PerfStat { // Report performance metrics for each test req_len: usize, @@ -751,7 +756,7 @@ fn stats_test_trust_levels() { let mut open_req_time: Vec = Vec::new(); let mut open_resp_time: Vec = Vec::new(); let mut open_resp_handle_time: Vec = Vec::new(); - for _ in 0..10000 { + for _ in 0..USERS { let h: NaiveTime = DateTime::time(&Utc::now()); if h.hour() == 23 && h.minute() == 59 { println!("Wait for UTC 00:00"); @@ -874,7 +879,7 @@ fn stats_test_invitations() { let mut red_req_time: Vec = Vec::new(); let mut red_resp_time: Vec = Vec::new(); let mut red_resp_handle_time: Vec = Vec::new(); - for _ in 0..10000 { + for _ in 0..USERS { let h: NaiveTime = DateTime::time(&Utc::now()); if h.hour() == 23 && h.minute() == 59 { @@ -925,7 +930,7 @@ fn stats_test_percent_blockage_migration_05() { for x in buckets { let mut th = TestHarness::new_buckets(x, x); let mut credentials: Vec = Vec::new(); - for _ in 0..10000 { + for _ in 0..USERS { let h: NaiveTime = DateTime::time(&Utc::now()); if h.hour() == 23 && h.minute() == 59 { println!("Wait for UTC 00:00"); @@ -958,7 +963,7 @@ fn stats_test_percent_blockage_migration_010() { for x in buckets { let mut th = TestHarness::new_buckets(x, x); let mut credentials: Vec = Vec::new(); - for _ in 0..10000 { + for _ in 0..USERS { let h: NaiveTime = DateTime::time(&Utc::now()); if h.hour() == 23 && h.minute() == 59 { println!("Wait for UTC 00:00"); @@ -991,7 +996,7 @@ fn stats_test_percent_blockage_migration_15() { for x in buckets { let mut th = TestHarness::new_buckets(x, x); let mut credentials: Vec = Vec::new(); - for _ in 0..10000 { + for _ in 0..USERS { let h: NaiveTime = DateTime::time(&Utc::now()); if h.hour() == 23 && h.minute() == 59 { println!("Wait for UTC 00:00"); @@ -1024,7 +1029,7 @@ fn stats_test_percent_blockage_migration_20() { for x in buckets { let mut th = TestHarness::new_buckets(x, x); let mut credentials: Vec = Vec::new(); - for _ in 0..10000 { + for _ in 0..USERS { let h: NaiveTime = DateTime::time(&Utc::now()); if h.hour() == 23 && h.minute() == 59 { println!("Wait for UTC 00:00"); @@ -1057,7 +1062,7 @@ fn stats_test_percent_blockage_migration_25() { for x in buckets { let mut th = TestHarness::new_buckets(x, x); let mut credentials: Vec = Vec::new(); - for _ in 0..10000 { + for _ in 0..USERS { let h: NaiveTime = DateTime::time(&Utc::now()); if h.hour() == 23 && h.minute() == 59 { println!("Wait for UTC 00:00"); @@ -1090,7 +1095,7 @@ fn stats_test_percent_blockage_migration_30() { for x in buckets { let mut th = TestHarness::new_buckets(x, x); let mut credentials: Vec = Vec::new(); - for _ in 0..10000 { + for _ in 0..USERS { let h: NaiveTime = DateTime::time(&Utc::now()); if h.hour() == 23 && h.minute() == 59 { println!("Wait for UTC 00:00"); @@ -1123,7 +1128,7 @@ fn stats_test_percent_blockage_migration_35() { for x in buckets { let mut th = TestHarness::new_buckets(x, x); let mut credentials: Vec = Vec::new(); - for _ in 0..10000 { + for _ in 0..USERS { let h: NaiveTime = DateTime::time(&Utc::now()); if h.hour() == 23 && h.minute() == 59 { println!("Wait for UTC 00:00"); @@ -1156,7 +1161,7 @@ fn stats_test_percent_blockage_migration_40() { for x in buckets { let mut th = TestHarness::new_buckets(x, x); let mut credentials: Vec = Vec::new(); - for _ in 0..10000 { + for _ in 0..USERS { let h: NaiveTime = DateTime::time(&Utc::now()); if h.hour() == 23 && h.minute() == 59 { println!("Wait for UTC 00:00"); @@ -1189,7 +1194,7 @@ fn stats_test_percent_blockage_migration_45() { for x in buckets { let mut th = TestHarness::new_buckets(x, x); let mut credentials: Vec = Vec::new(); - for _ in 0..10000 { + for _ in 0..USERS { let h: NaiveTime = DateTime::time(&Utc::now()); if h.hour() == 23 && h.minute() == 59 { println!("Wait for UTC 00:00"); @@ -1222,7 +1227,7 @@ fn stats_test_percent_blockage_migration_50() { for x in buckets { let mut th = TestHarness::new_buckets(x, x); let mut credentials: Vec = Vec::new(); - for _ in 0..10000 { + for _ in 0..USERS { let h: NaiveTime = DateTime::time(&Utc::now()); if h.hour() == 23 && h.minute() == 59 { println!("Wait for UTC 00:00"); @@ -1255,7 +1260,7 @@ fn stats_test_percent_blockage_migration_55() { for x in buckets { let mut th = TestHarness::new_buckets(x, x); let mut credentials: Vec = Vec::new(); - for _ in 0..10000 { + for _ in 0..USERS { let h: NaiveTime = DateTime::time(&Utc::now()); if h.hour() == 23 && h.minute() == 59 { println!("Wait for UTC 00:00"); @@ -1288,7 +1293,7 @@ fn stats_test_percent_blockage_migration_60() { for x in buckets { let mut th = TestHarness::new_buckets(x, x); let mut credentials: Vec = Vec::new(); - for _ in 0..10000 { + for _ in 0..USERS { let h: NaiveTime = DateTime::time(&Utc::now()); if h.hour() == 23 && h.minute() == 59 { println!("Wait for UTC 00:00"); @@ -1321,7 +1326,7 @@ fn stats_test_percent_blockage_migration_65() { for x in buckets { let mut th = TestHarness::new_buckets(x, x); let mut credentials: Vec = Vec::new(); - for _ in 0..10000 { + for _ in 0..USERS { let h: NaiveTime = DateTime::time(&Utc::now()); if h.hour() == 23 && h.minute() == 59 { println!("Wait for UTC 00:00"); @@ -1354,7 +1359,7 @@ fn stats_test_percent_blockage_migration_70() { for x in buckets { let mut th = TestHarness::new_buckets(x, x); let mut credentials: Vec = Vec::new(); - for _ in 0..10000 { + for _ in 0..USERS { let h: NaiveTime = DateTime::time(&Utc::now()); if h.hour() == 23 && h.minute() == 59 { println!("Wait for UTC 00:00"); @@ -1387,7 +1392,7 @@ fn stats_test_percent_blockage_migration_75() { for x in buckets { let mut th = TestHarness::new_buckets(x, x); let mut credentials: Vec = Vec::new(); - for _ in 0..10000 { + for _ in 0..USERS { let h: NaiveTime = DateTime::time(&Utc::now()); if h.hour() == 23 && h.minute() == 59 { println!("Wait for UTC 00:00"); @@ -1420,7 +1425,7 @@ fn stats_test_percent_blockage_migration_80() { for x in buckets { let mut th = TestHarness::new_buckets(x, x); let mut credentials: Vec = Vec::new(); - for _ in 0..10000 { + for _ in 0..USERS { let h: NaiveTime = DateTime::time(&Utc::now()); if h.hour() == 23 && h.minute() == 59 { println!("Wait for UTC 00:00"); @@ -1453,7 +1458,7 @@ fn stats_test_percent_blockage_migration_85() { for x in buckets { let mut th = TestHarness::new_buckets(x, x); let mut credentials: Vec = Vec::new(); - for _ in 0..10000 { + for _ in 0..USERS { let h: NaiveTime = DateTime::time(&Utc::now()); if h.hour() == 23 && h.minute() == 59 { println!("Wait for UTC 00:00"); @@ -1486,7 +1491,7 @@ fn stats_test_percent_blockage_migration_90() { for x in buckets { let mut th = TestHarness::new_buckets(x, x); let mut credentials: Vec = Vec::new(); - for _ in 0..10000 { + for _ in 0..USERS { let h: NaiveTime = DateTime::time(&Utc::now()); if h.hour() == 23 && h.minute() == 59 { println!("Wait for UTC 00:00"); @@ -1519,7 +1524,7 @@ fn stats_test_percent_blockage_migration_95() { for x in buckets { let mut th = TestHarness::new_buckets(x, x); let mut credentials: Vec = Vec::new(); - for _ in 0..10000 { + for _ in 0..USERS { let h: NaiveTime = DateTime::time(&Utc::now()); if h.hour() == 23 && h.minute() == 59 { println!("Wait for UTC 00:00"); @@ -1552,7 +1557,7 @@ fn stats_test_percent_blockage_migration_100() { for x in buckets { let mut th = TestHarness::new_buckets(x, x); let mut credentials: Vec = Vec::new(); - for _ in 0..10000 { + for _ in 0..USERS { let h: NaiveTime = DateTime::time(&Utc::now()); if h.hour() == 23 && h.minute() == 59 { println!("Wait for UTC 00:00");