Skip to content

Commit

Permalink
diff assumed filename for clocked
Browse files Browse the repository at this point in the history
  • Loading branch information
1majom committed Oct 8, 2024
1 parent 5bb1ee0 commit d67c648
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 24 deletions.
10 changes: 5 additions & 5 deletions base_try.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ def main():
parser = argparse.ArgumentParser(description='Process some integers.')
parser.add_argument('--filename', type=str, required=True, help='Filename for the output without .txt')
parser.add_argument('--clock', action='store_true', help='Use clocked')
parser.add_argument('--tls-verify', action='store_true', help='Use tls_verify')
parser.add_argument('--tls-verify', action='store_true', help='Use tls_verify')
parser.add_argument('--track', type=str, required=True, help='Track name')
args = parser.parse_args()
clocked = args.clock
tls_verify = args.tls_verify

setLogLevel('critical')
template_for_relays = (
'RUST_LOG=debug RUST_BACKTRACE=0 '
Expand Down Expand Up @@ -105,7 +105,7 @@ def main():
net.start()
baseline_sub.cmd('ip route add 12.0.1.0/30 via 12.0.2.2')
baseline_pub.cmd('ip route add 12.0.2.0/30 via 12.0.1.2')

# Start the relay on one of the hosts
baseline_relay.cmd(template_for_relays.format(
host=baseline_relay,
Expand Down Expand Up @@ -162,11 +162,11 @@ def main():
if file_latencies:
assumed_baseline, median, percentile_99 = calculate_statistics(file_latencies)
print(f"*** assumed baseline (clocked): {assumed_baseline}")
baseline_file = f"measurements/assumed_baseline_{filename}.txt"
baseline_file = f"measurements/assumed_clocked_baseline_{filename}.txt"
with open(baseline_file, 'w') as file:
file.write(str(assumed_baseline))
net.stop()

subprocess.call(['sudo', 'pkill', '-f', 'xterm'], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)


Expand Down
49 changes: 30 additions & 19 deletions good-try.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
video_on = os.getenv("LOOKY", False)
forklift_certified = not os.getenv("NO_CERT", False)
num_of_tries = int(os.getenv("NUMERO", 1))
no_based_line = os.getenv("NO_BASE", False)
gst_shark = int(os.getenv("SHARK", 0))
topofile= os.getenv("TOPO", "tiniest_topo.yaml")
folding= os.getenv("BUILD", False)
Expand Down Expand Up @@ -76,7 +77,6 @@ def extract_latency(line):
for topo in test_set_unique:
with open(f"../cdn-optimization/datasource/{topo}", 'r') as file:
config = yaml.safe_load(file)
print(f"** Sorting out the config {topo}")
node_names = [node['name'] for node in config['nodes']]

G = nx.Graph()
Expand All @@ -87,31 +87,29 @@ def extract_latency(line):

if not is_full_mesh:
raise ValueError(f"The nodes and edges do not form a full mesh in {topo}")
if __name__ == '__main__':

for topo_idx in range(len(test_set)):
for try_idx in range(num_of_tries):
for topo_idx in range(len(test_set)):
for try_idx in range(num_of_tries):

subprocess.call(['sudo', 'mn', '-c'], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
subprocess.call(['sudo', 'pkill', '-f','gst-launch'], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
subprocess.call(['sudo', 'mn', '-c'], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
subprocess.call(['sudo', 'pkill', '-f','gst-launch'], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)

if my_debug or folding:
print("** Folding them needed binaries")
subprocess.run(['rm', 'target/debug/*'], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
subprocess.run(['sudo', '-u', the_path.user, the_path.cargopath, 'build'], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
if my_debug or folding:
print("** Folding them needed binaries")
subprocess.run(['rm', 'target/debug/*'], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
subprocess.run(['sudo', '-u', the_path.user, the_path.cargopath, 'build'], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)

sleep(5)
sleep(5)

if __name__ == '__main__':

if my_debug:
setLogLevel( 'info' )
else:
setLogLevel( 'critical' )
current_time1 = datetime.datetime.now().strftime("%Y%m%d%H%M%S")
baseline_path = os.path.join('measurements', f"assumed_baseline_{current_time1}.txt")
based_line=0.0
baseline_clk_str=""
baseline_tls_str=""



topofile = test_set[topo_idx][0]
with open(f"../cdn-optimization/datasource/{topofile}", 'r') as file:
Expand All @@ -120,17 +118,30 @@ def extract_latency(line):
config['api'] = test_set[topo_idx][1]
print(f"** Sorting out the config {topofile} with {config['mode']} and {config['api']}")

baseline_clk_str=""
baseline_tls_str=""
baseline_path_clk_str=""

if config['mode'] == 'clock':
baseline_clk_str="--clock"
baseline_path_clk_str="clocked_"
if forklift_certified:
baseline_tls_str="--tls-verify"
subprocess.call(['sudo', 'python', 'base_try.py', '--filename', f"{current_time1}",'--track',f"{config['first_hop_relay'][0]['track']}"] + ([baseline_clk_str] if baseline_clk_str else []) + ([baseline_tls_str] if baseline_tls_str else []))
try:

baseline_path = os.path.join('measurements', f"assumed_{baseline_path_clk_str}baseline_{current_time1}.txt")
based_line=0.0



if not no_based_line:
subprocess.call(['sudo', 'python', 'base_try.py', '--filename', f"{current_time1}",'--track',f"{config['first_hop_relay'][0]['track']}"] + ([baseline_clk_str] if baseline_clk_str else []) + ([baseline_tls_str] if baseline_tls_str else []))
with open(baseline_path, 'r') as file:
baseline_content = file.read().strip()
based_line = float(baseline_content)
except:
based_line=0.0
else:
based_line = 0.0
with open(baseline_path, 'w') as file:
file.write(str(based_line))


net = Mininet( topo=None, waitConnected=True, link=partial(TCLink) )
Expand Down

0 comments on commit d67c648

Please sign in to comment.