from __future__ import print_function import sys import traceLib traceFile = open(sys.argv[1], "r") traceData = traceFile.read() traceLines = traceData.split("\n") throughPut = traceLib.tcpCalcThroughput(traceLines, 0, 10, 2, 3, 1.0, 4.0) # calculate data flowing between link 2 and 3 starting from node 1 ending at at node 4 print(sys.argv[1]) print("TCP Throughput=data flowing/sec in Mb/sec is", throughPut) latency = traceLib.calcAvgLatency(traceLines, 2, 3, 1.0, 4.0) # calculate average delay between link 1 and 2 starting from node 1 ending at at node 4 pacCount = traceLib.tcpPacketCount(traceLines, 1.0, 4.0) print("The average propagation delay in miliseconds is", latency) dropAll = pacCount["DropAll"] print("the total number of TCp and ack dropped packets are ", dropAll) print("") l1 = sys.argv[1].split(".") proto, rate = l1[0].split("_output-") throughPutFile = proto + "ThroughPut.txt" latencyFile = proto + "Latency.txt" droppedPacketsFile = proto + "DroppedPackets.txt"
from __future__ import print_function import sys import traceLib traceFile=open(sys.argv[1],'r') traceData=traceFile.read() traceLines=traceData.split("\n") thru1=traceLib.tcpCalcThroughput(traceLines,0,10,2,3,1.0,4.0) #calculate data flowing between link 2 and 3 starting from node 1 ending at at node 4 from time 0 to time=5 seconds thru2=traceLib.tcpCalcThroughput(traceLines,0,10,2,3,5.0,6.0) #calculate data flowing between link 2 and 3 starting from node 5 ending at at node 6 from time 0 to time=5 seconds delay1=traceLib.calcAvgLatency(traceLines,2,3,1.0,4.0) #calculate average delay between link 1 and 2 starting from node 1 ending at at node 4 delay2=traceLib.calcAvgLatency(traceLines,2,3,5.0,6.0) #calculate average delay between link 1 and 2 starting from node 5 ending at at node 6 drop1=traceLib.tcpPacketCount(traceLines,1.0,4.0) drop2=traceLib.tcpPacketCount(traceLines,5.0,6.0) #calculate dropped packets dropTCPall1=drop1['TCPdropped']+drop1['ACKdropped'] dropTCPall2=drop2['TCPdropped']+drop2['ACKdropped'] print(sys.argv[1]) print("TCP Throughput=data flowing/sec is",thru1) print("The average delay(RTT) is",delay1)