def let_it_go(args): consumer = FlowConsumer(Id='test', name="/%s/chunksize/dir/%s" %(args.producer, args.dstfile), fout=None, monitor_out_dir=None, size_fix = args.fixsize, window_fix = args.windowsize, rtt_fix=4.0) consumer.start() t = 0.0 g = 0.0 for a in consumer.chunkInfos: chunkinfo = a if chunkinfo.status == 2: assert chunkinfo.retxN >=1, "Illegal: retxN < 1" assert chunkinfo.endT != None, "Illegal: endT == None" t +=a.chunk_size * a.retxN g +=a.data_size else: print chunkinfo, "Warning !!!!!" i = (g/t) j = float(consumer.chunkSizeEstimator.lostN)/(consumer.chunkSizeEstimator.lostN + consumer.chunkSizeEstimator.receivedN) k = consumer.chunkSizeEstimator.get_loss_rate() print "G2T is %s" % i print "chunk loss rate is %s, receivedN is %s, lostN is %s" %(j, consumer.chunkSizeEstimator.receivedN, consumer.chunkSizeEstimator.lostN) print "packet loss rate is %s" %k fout = open("data.dat", "a") fout.write(str(j)) fout.write(" ") fout.write(str(k)) fout.write(" ") fout.write(str(i)) fout.write('\n') fout.flush() fout.close()
def start(self): args = self.args consumer = FlowConsumer(Id=self.Id, name="/%s/chunksize/dir/%s" % (args.producer, args.dstfile), fout=None, monitor_out_dir=None, size_fix=args.fixsize, window_fix=args.windowsize, rtt_fix=4.0) consumer.start() t = 0.0 g = 0.0 for a in consumer.chunkInfos: chunkinfo = a if chunkinfo.status == 2: assert chunkinfo.retxN >= 1, "Illegal: retxN < 1" assert chunkinfo.endT != None, "Illegal: endT == None" t += a.chunk_size * a.retxN g += a.data_size else: print chunkinfo, "Warning !!!!!" i = (g / t) j = float(consumer.chunkSizeEstimator.lostN) / ( consumer.chunkSizeEstimator.lostN + consumer.chunkSizeEstimator.receivedN) k = consumer.chunkSizeEstimator.get_loss_rate() print "G2T is %s" % i print "chunk loss rate is %s, receivedN is %s, lostN is %s" % ( j, consumer.chunkSizeEstimator.receivedN, consumer.chunkSizeEstimator.lostN) print "packet loss rate is %s" % k fpath = os.path.join(settings.OUT_DATA_DIR, "g2t-%s.dat" % (settings.HOST)) fout = open(fpath, "a") fout.write( "chuklossrate=%s, packetlossrate=%s, g2t=%s, chunksize=%s, winsize=%s, file=%s, src=%s, dst=%s, beginT=%s, endT=%s\n" % (j, k, i, args.fixsize, args.windowsize, args.dstfile, settings.HOST, args.producer, consumer.mydata.beginT, consumer.mydata.endT)) fout.flush() fout.close() if consumer.is_all: return True else: return False
def start(self): log.info("start consumer: %s" %(self.Id)) rst = FlowConsumer.start(self) return rst
def __init__(self, Id, name, fout, monitor_out_dir="./", enable_monitor=True, size_fix=None, window_fix=None, rtt_fix=None): FlowConsumer.__init__(self, Id=Id, name=name, fout=fout, monitor_out_dir=monitor_out_dir, size_fix=size_fix, window_fix=window_fix, rtt_fix=None)
from mydata import MyData, ChunkInfo, log from mydata import DEFAULT_CHUNK_SIZE, DEFAULT_RUN_TIMEOUT from mydata import ADAPTIVE_MOD_FLAG from mydata import CHUNK_ADDITIVE_INCREASEMENT_SIZE, CHUNK_MULTIPLICATIVE_DECREASEMENT_FACTOR, MAX_CHUNK_SIZE from ndn_flow import FlowConsumer from mydata import PACKET_HEADER_SIZE, CHUNK_HEADER_SIZE, PACKET_MTU #from datetime import datetime import os.path import signal import math PAPER="optimal-chunk-size" ITEM = "consumer" consumer = FlowConsumer(Id='test', name="/local/chunksize/dir/c.mp3", fout=None, monitor_out_dir=None, size_fix=1000, window_fix=20, rtt_fix=4.0) consumer.start() for chunkinfo in consumer.chunkInfos: pass class Consumer(FlowConsumer): pass
def start(self): args = self.args consumer = FlowConsumer( Id=self.Id, name="/%s/chunksize/dir/%s" % (args.producer, args.dstfile), fout=None, monitor_out_dir=None, size_fix=args.fixsize, window_fix=args.windowsize, rtt_fix=4.0, ) consumer.start() t = 0.0 g = 0.0 for a in consumer.chunkInfos: chunkinfo = a if chunkinfo.status == 2: assert chunkinfo.retxN >= 1, "Illegal: retxN < 1" assert chunkinfo.endT != None, "Illegal: endT == None" t += a.chunk_size * a.retxN g += a.data_size else: print chunkinfo, "Warning !!!!!" i = g / t j = float(consumer.chunkSizeEstimator.lostN) / ( consumer.chunkSizeEstimator.lostN + consumer.chunkSizeEstimator.receivedN ) k = consumer.chunkSizeEstimator.get_loss_rate() print "G2T is %s" % i print "chunk loss rate is %s, receivedN is %s, lostN is %s" % ( j, consumer.chunkSizeEstimator.receivedN, consumer.chunkSizeEstimator.lostN, ) print "packet loss rate is %s" % k fpath = os.path.join(settings.OUT_DATA_DIR, "g2t-%s.dat" % (settings.HOST)) fout = open(fpath, "a") fout.write( "chuklossrate=%s, packetlossrate=%s, g2t=%s, chunksize=%s, winsize=%s, file=%s, src=%s, dst=%s, beginT=%s, endT=%s\n" % ( j, k, i, args.fixsize, args.windowsize, args.dstfile, settings.HOST, args.producer, consumer.mydata.beginT, consumer.mydata.endT, ) ) fout.flush() fout.close() if consumer.is_all: return True else: return False
from mydata import DEFAULT_CHUNK_SIZE, DEFAULT_RUN_TIMEOUT from mydata import ADAPTIVE_MOD_FLAG from mydata import CHUNK_ADDITIVE_INCREASEMENT_SIZE, CHUNK_MULTIPLICATIVE_DECREASEMENT_FACTOR, MAX_CHUNK_SIZE from ndn_flow import FlowConsumer from mydata import PACKET_HEADER_SIZE, CHUNK_HEADER_SIZE, PACKET_MTU #from datetime import datetime import os.path import signal import math PAPER = "optimal-chunk-size" ITEM = "consumer" consumer = FlowConsumer(Id='test', name="/local/chunksize/dir/c.mp3", fout=None, monitor_out_dir=None, size_fix=1000, window_fix=20, rtt_fix=4.0) consumer.start() for chunkinfo in consumer.chunkInfos: pass class Consumer(FlowConsumer): pass