More corrections. Now everything is ready for real tests
diff --git a/utils/load-stats.cc b/utils/load-stats.cc
index 8a663e3..66786fd 100644
--- a/utils/load-stats.cc
+++ b/utils/load-stats.cc
@@ -23,22 +23,26 @@
using namespace ns3;
-const double EXP_1 = exp (-5.0/60.0); /* 1/exp(5sec/1min) */
-const double EXP_5 = exp (-5.0/300.0); /* 1/exp(5sec/5min) */
-const double EXP_15 = exp (-5.0/900.0); /* 1/exp(5sec/15min) */
+// const double EXP_1 = (1-2.0/6.0);//exp (-1.0/5.0); /* 1/exp(1sec/5sec) */
+// const double EXP_2 = (1-2.0/31.0);//exp (-1.0/30.0); /* 1/exp(1sec/30sec) */
+// const double EXP_3 = (1-2.0/61.0);//exp (-1.0/60.0); /* 1/exp(1sec/60sec) */
-const double EPSILON = 0.000001;
+const double EXP_1 = exp (-1.0/5.0); /* 1/exp(1sec/5sec) */
+const double EXP_2 = exp (-1.0/30.0); /* 1/exp(1sec/30sec) */
+const double EXP_3 = exp (-1.0/60.0); /* 1/exp(1sec/60sec) */
NS_LOG_COMPONENT_DEFINE ("LoadStats");
namespace ndnSIM
{
+const double LoadStats::PRECISION = 0.1;
+
LoadStats::LoadStats ()
: counter_ (0)
, avg1_ (0)
- , avg5_ (0)
- , avg15_ (0)
+ , avg2_ (0)
+ , avg3_ (0)
{
}
@@ -48,9 +52,9 @@
// NS_LOG_FUNCTION (this);
// do magic
- avg1_ = EXP_1 * avg1_ + (1 - EXP_1) * counter_;
- avg5_ = EXP_1 * avg5_ + (1 - EXP_5) * counter_;
- avg15_ = EXP_1 * avg15_ + (1 - EXP_15) * counter_;
+ avg1_ = EXP_1 * avg1_ + (1 - EXP_1) * counter_;
+ avg2_ = EXP_2 * avg2_ + (1 - EXP_2) * counter_;
+ avg3_ = EXP_3 * avg3_ + (1 - EXP_3) * counter_;
counter_ = 0;
}
@@ -76,22 +80,22 @@
LoadStats::stats_tuple
LoadStats::GetStats () const
{
- return stats_tuple (avg1_, avg5_, avg15_);
+ return stats_tuple (avg1_, avg2_, avg3_);
}
bool
LoadStats::IsZero () const
{
return (counter_ == 0 &&
- avg1_ < EPSILON &&
- avg5_ < EPSILON &&
- avg15_ < EPSILON);
+ avg1_ < PRECISION &&
+ avg2_ < PRECISION &&
+ avg3_ < PRECISION);
}
std::ostream &
operator << (std::ostream &os, const LoadStats &stats)
{
- os << stats.avg1_ << ", " << stats.avg5_ << ", " << stats.avg15_;
+ os << stats.avg1_ << ", " << stats.avg2_ << ", " << stats.avg3_;
return os;
}