[Sumover-dev] [svn commit] r4787 - vic/branches/cc/cc

sumover-dev at cs.ucl.ac.uk sumover-dev at cs.ucl.ac.uk
Wed Apr 28 20:16:25 BST 2010


Author: soohyunc
Date: Wed Apr 28 20:16:25 2010
New Revision: 4787

Modified:
   vic/branches/cc/cc/tfwc_sndr.cpp
   vic/branches/cc/cc/tfwc_sndr.h

Log:
EWMA packet size estimation has two coefficient
	high coeff when frames have more than one packet
	low coeff when frames have only one packet

this is because the packet size is extremly small when frames have only one
packet, making the whole EWMA process fluctuating too much.

So, we have two EWMA equation to estimate the packet size.




Modified: vic/branches/cc/cc/tfwc_sndr.cpp
==============================================================================
--- vic/branches/cc/cc/tfwc_sndr.cpp	(original)
+++ vic/branches/cc/cc/tfwc_sndr.cpp	Wed Apr 28 20:16:25 2010
@@ -147,7 +147,8 @@
 	asize_ = 0;
 	pcnt_ = 0;
 	psize_ = 0;
-	lambda_ = .75;
+	lambda1_ = .75;
+	lambda2_ = .15;
 }
 
 void TfwcSndr::tfwc_sndr_send(pktbuf* pb, double now) {
@@ -163,16 +164,22 @@
 	record_[seqno_%PSR] = pb->len;
 	//print_psize(now_, record_[seqno_%PSR]);
 
-	// arithmetic average
+	// arithmetic average packet size (per frame)
 	asize_ += pb->len;
-	asize_ /= ++pcnt_;
+	pcnt_++;
 
 	// tag finished (end of frame)
 	if (!(pb->tag)) {
+		asize_ /= pcnt_;
 		// EWMA'd packet size
-		psize_ = lambda_ * asize_ + (1 - lambda_) * psize_;	
-		pcnt_ = 0;
+		if (pcnt_ != 1)
+		psize_ = lambda1_ * asize_ + (1 - lambda1_) * psize_;
+		else
+		psize_ = lambda2_ * asize_ + (1 - lambda2_) * psize_;
+
+		asize_ = 0; pcnt_ = 0;
 	}
+	//print_psize(now_, psize_, pb->len);
 
 	// timestamp vector for loss history update
 	tsvec_[seqno_%TSZ] = now_-SKEW;

Modified: vic/branches/cc/cc/tfwc_sndr.h
==============================================================================
--- vic/branches/cc/cc/tfwc_sndr.h	(original)
+++ vic/branches/cc/cc/tfwc_sndr.h	Wed Apr 28 20:16:25 2010
@@ -178,7 +178,8 @@
 	int asize_;		// average packet size per frame
 	int pcnt_;		// packet counter per frame
 	int psize_;		// EWMA packet size 
-	double lambda_;	// EWMA coeff
+	double lambda1_;	// EWMA coeff
+	double lambda2_;	// EWMA coeff
 
 private:
 	// update RTT
@@ -318,6 +319,11 @@
 	fprintf(stderr, "\tnow: %f\tcwnd: %d\n", so_recv_, cwnd_);
 	}
 
+	// print bcwnd for debugging
+	inline void print_bcwnd (double now, int w) {
+	fprintf(stderr, "\tnow: %f\tbcwnd: %d\n", now, w);
+	}
+
 	// print received XR chunk info
 	inline void print_xr_info(const char* str, const int i) {
 	fprintf(stderr,
@@ -368,8 +374,8 @@
 	}
 
 	// print packet size
-	inline void print_psize(double now, int size) {
-	fprintf(stderr, "\tnow: %f psize: %d\n", now, size);
+	inline void print_psize(double now, int size, int len) {
+	fprintf(stderr, "\tnow: %f psize: %d real: %d\n", now, size, len);
 	}
 
 	int ndtp_;		// number of data packet sent



More information about the Sumover-dev mailing list