die_num_SN_ctp = [0] die_num_RL_ctp = [0] die_num_LF_ctp = [0] die_time_ctp = [0] die_ctp = set() #support counter counter_r = 0 counter_s = 0 counter_d_SN = 0 counter_d_RL = 0 counter_d_LF = 0 #duplicates counter_d = 0 cal_prop_ctp = calprop.prop_ctp(FileDict, result) cal_prop_orw = calprop.prop_orw(FileDict, result) leaf_set = cal_prop_ctp['Leaf'] relay_set = cal_prop_ctp['Relay'] dirn_set = cal_prop_ctp['Dir_Neig'] a = len(dirn_set) b = len(relay_set) c = len(leaf_set) print "CTP:", a, b, c firstsee_ctp={} for msg in CtpDebugMsgs: if msg.node not in firstsee_ctp: firstsee_ctp[msg.node] = msg.timestamp if msg.timestamp >= time_TH: #if msg.node == 77:
die_num_SN_ctp = [0] die_num_RL_ctp = [0] die_num_LF_ctp = [0] die_time_ctp = [0] die_ctp = set() #support counter counter_r = 0 counter_s = 0 counter_d_SN = 0 counter_d_RL = 0 counter_d_LF = 0 #duplicates counter_d = 0 cal_prop_ctp = calprop.prop_ctp(FileDict, result) cal_prop_orw = calprop.prop_orw(FileDict, result) leaf_set = cal_prop_ctp['Leaf'] relay_set = cal_prop_ctp['Relay'] dirn_set = cal_prop_ctp['Dir_Neig'] a = len(dirn_set) b = len(relay_set) c = len(leaf_set) print "CTP:", a, b, c firstsee_ctp = {} for msg in CtpDebugMsgs: if msg.node not in firstsee_ctp: firstsee_ctp[msg.node] = msg.timestamp if msg.timestamp >= time_TH: #if msg.node == 77:
import matplotlib import pylab as pl from numpy import mean from numpy import absolute import numpy from tools.functions import * import scipy.misc as misc from tools import calprop resultc = command.main(sys.argv[1:]) FileDict, props = command.getfile(resultc) CtpDebugMsgs = FileDict['CtpDebug'] OrwDebugMsgs = FileDict['OrwDebug'] OrwNtMsgs = FileDict['OrwNt'] props_orw = calprop.prop_orw(FileDict, resultc) props_ctp = calprop.prop_ctp(FileDict, resultc) '''for node in props_orw['Fwd_Load']: print "Node {} Fwd_Load {}".format(node, props_orw['Fwd_Load'][node])''' TWIST = resultc['twist'] if resultc['twist'] == True: base_path = '/media/Data/ThesisData/Twist/' FileCollection_orw = ['trace_20140515_132005.1.txt', 'trace_20140515_160513.3.txt', 'trace_20140515_185012.5.txt', 'trace_20140515_210915.7.txt', 'trace_20140515_232715.9.txt', 'trace_20140516_031415.11.txt'] #'trace_20140518_231215.38.txt'] FileCollection_ctp = ['trace_20140515_120916.0.txt', 'trace_20140515_145530.2.txt',
CtpdebugMsgs, _, _, CtpdataMsgs = Treader.load(base_path + limited_ctp) time_ratio = 1000000.0 ''' resultc = command.main(sys.argv[1:]) FileDict, props = command.getfile(resultc) time_ratio = props['timeratio'] SINK_ID = props['SINK_ID'] prefix = props['prefix'] ELIMIT = resultc['lim'] TWIST = resultc['twist'] time_TH = props['time_TH'] CtpdataMsgs = FileDict['CtpData'] CtpdebugMsgs = FileDict['CtpDebug'] props_ctp = calprop.prop_ctp(FileDict, resultc) props_orw = calprop.prop_orw(FileDict, resultc) loadmax = max(max(props_ctp['Fwd_Load'].values()), max(props_orw['Fwd_Load'].values())) #Average hops avg_hops_ctp = props_ctp['Avg_Hops'] dir_neig_ctp = props_ctp['Dir_Neig'] relay_ctp = props_ctp['Relay'] leaf_ctp = props_ctp['Leaf'] print "CTP D R L:", len(dir_neig_ctp), len(relay_ctp), len(leaf_ctp) dir_neig_orw = props_orw['Dir_Neig'] relay_orw = props_orw['Relay'] leaf_orw = props_orw['Leaf'] print "ORW D R L:", len(dir_neig_orw), len(relay_orw), len(leaf_orw)