Reverting back exponential averaging for LoadStats. Disabling two long-term time granularities (affects entry lifetime).
diff --git a/utils/load-stats.cc b/utils/load-stats.cc
index a7559b3..d785845 100644
--- a/utils/load-stats.cc
+++ b/utils/load-stats.cc
@@ -20,7 +20,6 @@
#include "load-stats.h"
#include "ns3/log.h"
-#include "ns3/simulator.h"
// 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) */
@@ -41,13 +40,7 @@
LoadStats::LoadStats ()
: counter_ (0)
, avg1_ (0)
- , avg1Counter_ (0)
- , avg1CounterOld_ (0)
-
, avg2_ (0)
- , avg2Counter_ (0)
- , avg2CounterOld_ (0)
-
, avg3_ (0)
{
}
@@ -58,25 +51,8 @@
// NS_LOG_FUNCTION (this);
// do magic
- // avg1_ = EXP_1 * avg1_ + (1 - EXP_1) * counter_;
-
- // highly experimental
- // avg1Counter_ += counter_;
- // avg1_ = 1.0 * (avg1Counter_ - avg1CounterOld_) / 1.0/*Seconds(1.0).ToDouble (Time::S)*/;
- // avg1CounterOld_ = avg1Counter_;
- // avg1LastUpdate_ = Simulator::Now ();
- avg1_ = counter_;
-
+ avg1_ = EXP_1 * avg1_ + (1 - EXP_1) * counter_;
// avg2_ = EXP_2 * avg2_ + (1 - EXP_2) * counter_;
-
- avg2Counter_ += counter_;
- if (Simulator::Now () - avg2LastUpdate_ >= Seconds (5.0))
- {
- avg2_ = 1.0 * (avg2Counter_ - avg2CounterOld_) / (Simulator::Now () - avg2LastUpdate_).ToDouble (Time::S);
- avg2CounterOld_ = avg2Counter_;
- avg2LastUpdate_ = Simulator::Now ();
- }
-
// avg3_ = EXP_3 * avg3_ + (1 - EXP_3) * counter_;
counter_ = 0;
diff --git a/utils/load-stats.h b/utils/load-stats.h
index 816998e..3e71753 100644
--- a/utils/load-stats.h
+++ b/utils/load-stats.h
@@ -62,18 +62,10 @@
IsZero () const;
private:
- uint64_t counter_;
+ uint32_t counter_;
double avg1_;
- uint64_t avg1Counter_;
- uint64_t avg1CounterOld_;
- Time avg1LastUpdate_;
-
double avg2_;
- uint64_t avg2Counter_;
- uint64_t avg2CounterOld_;
- Time avg2LastUpdate_;
-
double avg3_;
friend std::ostream &