timestamp_backer=dp.read_file('edison/data/0%.txt',0)##edison sender zero_data=dp.data_process_2(timestamp_former,timestamp_backer) timestamp_former=dp.read_file('edison/data/20%.txt',3)##edison receiver timestamp_backer=dp.read_file('edison/data/20%.txt',0)##edison sender ten_data=dp.data_process_2(timestamp_former,timestamp_backer) timestamp_former=dp.read_file('edison/data/50%.txt',3)##edison receiver timestamp_backer=dp.read_file('edison/data/50%.txt',0)##edison sender five_data=dp.data_process_2(timestamp_former,timestamp_backer) timestamp_former=dp.read_file('edison/data/90%.txt',3)##edison receiver timestamp_backer=dp.read_file('edison/data/90%.txt',0)##edison sender nine_data=dp.data_process_2(timestamp_former,timestamp_backer) zero_statistics=dp.compute_statistics(zero_data) ten_statistics=dp.compute_statistics(ten_data) five_statistics=dp.compute_statistics(five_data) nine_statistics=dp.compute_statistics(nine_data) statistics=[zero_statistics,ten_statistics,five_statistics, nine_statistics] error_data=[zero_data,ten_data,five_data,nine_data] title='Network delay (Mac_receiver-Edison_send)' ''' timestamp_former=dp.read_file('arduino/data/0%.txt',2)##edison receiver timestamp_backer=dp.read_file('edison/data/0%.txt',0)##edison sender zero_data=dp.data_process_2(timestamp_former,timestamp_backer) timestamp_former=dp.read_file('arduino/data/20%.txt',2)##edison receiver timestamp_backer=dp.read_file('edison/data/20%.txt',0)##edison sender
title='Tsa-Tse without background traffic ' elif index==2: timestamp_former=dp.read_file('edison/data.txt',0) timestamp_backer=dp.read_file("serial/data.txt",2) title='Edison-Serial' elif index==3: timestamp_former=dp.read_file('edison/data3.txt',3)##edison receiver timestamp_backer=dp.read_file('edison/data3.txt',0)##edison sender ###if sync ? ie , remove offset?? #timestamp_backer=dp.time_sync(timestamp_backer,offset) title='Network delay (Mac_receiver-Edison_send)' elif index==4: title='ptpd' ##error=former-backer if index!=4: error_data=dp.data_process_2(timestamp_former,timestamp_backer) print error_data if error_data:## check list is empty statistics=[dp.compute_statistics(error_data)] ''' elif index==4: error_data=offset statistics=[[0,0,0]] ''' #print offset #print error_data #print statistics draw.curve(error_data,title,statistics)
if board=="arduino": ## for 1 hz readline=open("save/scalable/different_freq/arduino_1Hz.txt","rb") for line in readline: send=line.split(":")[0]## for arduino sendTime.append(send) sendInterval=CounterInterval(sendTime) ##for arduino Title="arduino sender's sampling error in "+freq+"hz" elif board=="edison": if freq=="1":## for 1 Hz readline=open("edison/edison_1023.txt","rb") for line in readline: send=line.split(":")[0]## for arduino sendTime.append(send) sendInterval=getRealClockInterval(sendTime)## for edison Title="edison's sampling period for 1023" else:## for all data readline=open("edison/edison_all_timer.txt","rb") for line in readline: send=line.split(" ")[1]## for edison all data sendTime.append(send) sendInterval=getRealClockIntervalForMillisecond(sendTime)## for edison statistics=[dp.compute_statistics(sendInterval)] Title="edison's sampling period for all data" draw.curve(sendInterval,Title,statistics) sendSamplingBias=getSamplingBias(sendInterval,float(freq)) statistics=[dp.compute_statistics(sendSamplingBias)] draw.curve(sendSamplingBias,Title,statistics)