def get_network_stats(n_file): setup = n_file.split("/")[-1].split("_") # A few checks assert setup[0] == "0" # The corresponding file contains no info assert setup[3] == "NETWORK" # What to call the participating pair of nodes node_names = {} node_names['n0'] = setup[1] node_names['n1'] = setup[2] with open(n_file, 'r') as f: lines = f.readlines() stats = {} for line in lines: if line.startswith('0:') or line.startswith('1:'): assert line.strip()[-3:] in node_names.values() elif line.startswith("Network Bytes:"): metadata = {} metadata.update(node_names.copy()) num_msg_bytes = line.split(":")[1].strip() metadata["bytes"] = num_msg_bytes elif line.startswith('ns:'): lat_str = line.split(":")[1].strip() latencies = lat_str.split(" ") latencies = list(map(int, latencies)) stats[metadata["bytes"]] = ls.LatencyStats(latencies, metadata) return stats
def get_lstats(summary): try: latencies = summary['all_lat'] summary['all_lat'] = ls.LatencyStats(latencies, out_time_unit='ms') except: pass
nodes = [] for res in results: s = get_network_stats(res) sub_exp.append(s) for msg_bytes,stat in s.iteritems(): md = stat.get_metadata() nodes.append(md['n0']) nodes.append(md['n1']) #num_msg_bytes = md['bytes'] if msg_bytes not in all_latencies: all_latencies[msg_bytes] = [] all_latencies[msg_bytes].append(stat.get_latencies()) for k,v in all_latencies.iteritems(): metadata = {} metadata['bytes'] = k all_latencies[k] = ls.LatencyStats(v,metadata) sub_exp.append(all_latencies) all_exps.append(sub_exp) all_nodes.append(sorted(list(set(nodes)))) else: opened = False timedate = [] print("Experiment count: {}".format(exp_cnt)) if _timedate == []: # ofile = "{}{}_{}*.out".format(result_dir,0,output_f) ofile = "{}/0_{}*".format(result_dir,output_f) res_list = sorted(glob.glob(ofile),key=os.path.getmtime,reverse=True) if res_list == 0: continue print(output_f) for x in range(exp_cnt):