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

sumover-dev at cs.ucl.ac.uk sumover-dev at cs.ucl.ac.uk
Sat Feb 20 00:35:42 GMT 2010


Author: soohyunc
Date: Sat Feb 20 00:35:42 2010
New Revision: 4628

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

Log:

(1) average loss interval should be an integer variable
(2) tsvec_ calculation fixed (seqno was off by one)
(3) printing HISTORY items
(4) printing ALI value



Modified: vic/branches/cc/cc/tfwc_sndr.cpp
==============================================================================
--- vic/branches/cc/cc/tfwc_sndr.cpp	(original)
+++ vic/branches/cc/cc/tfwc_sndr.cpp	Sat Feb 20 00:35:42 2010
@@ -111,7 +111,7 @@
 	ts_off_ = offset;
 
 	// timestamp vector for loss history update
-	tsvec_[seqno_%TSZ - 1] = now_;
+	tsvec_[seqno_%TSZ] = now_;
 
 	//fprintf(stderr, "\t>> now_:%f, tsvec_[%d]:%f\n", 
 	//	now_, seqno_%TSZ - 1, tsvec_[seqno_%TSZ-1]);
@@ -514,14 +514,20 @@
 	tot_weight_ = 0;
 
 	// make a decision whether to include the most recent loss interval
+	fprintf(stderr, "\n\tHIST_0 [");
 	for (int i = 0; i < hsz_; i++) {
 		I_tot0_ += weight_[i] * history_[i];
 		tot_weight_ += weight_[i];
+		print_history_item(i);
 	}
+	fprintf(stderr, "]\n");
+	fprintf(stderr, "\tHIST_1 [");
 	for (int i = 1; i < hsz_ + 1; i++) {
 		I_tot1_ += weight_[i-1] * history_[i];
-		tot_weight_ += weight_[i];
+		//tot_weight_ += weight_[i];
+		print_history_item(i);
 	}
+	fprintf(stderr, "]\n");
 
 	// compare I_tot0_ and I_tot1_ and use larger value
 	if (I_tot0_ < I_tot1_)
@@ -531,5 +537,13 @@
 
 	// this is average loss interval
 	avg_interval_ = I_tot_ / tot_weight_;
-	fprintf(stderr, "now: %f\tALI: %f\n", now(), avg_interval_);
+	fprintf(stderr, "\tnow: %f\tALI: %f\n\n", now(), avg_interval_);
+}
+
+/*
+ * print history item
+ */
+void TfwcSndr::print_history_item (int i) {
+	fprintf(stderr, "%d", history_[i]);
+	if (i < hsz_ - 1) fprintf(stderr, ", ");
 }

Modified: vic/branches/cc/cc/tfwc_sndr.h
==============================================================================
--- vic/branches/cc/cc/tfwc_sndr.h	(original)
+++ vic/branches/cc/cc/tfwc_sndr.h	Sat Feb 20 00:35:42 2010
@@ -170,6 +170,7 @@
 
 	// calcuate average loss interval
 	void avg_loss_interval();
+	void print_history_item (int);
 
 	// calculate loss history
 	void loss_history();
@@ -233,7 +234,7 @@
 	double pseudo_p_;	// faked packet loss probability
 	double pseudo_interval_;// faked loss interval
 	double avg_interval_;	// average loss interval
-	double history_[HSZ+1];	// loss interval history
+	int history_[HSZ+1];	// loss interval history
 	double weight_[HSZ+1];	// weight for calculating avg loss interval
 	double I_tot_;		// total sum
 	double I_tot0_;		// from 0 to n-1



More information about the Sumover-dev mailing list