#include <ew.h>
Inheritance diagram for EWdetectorP:


Public Member Functions | |
| EWdetectorP () | |
| virtual | ~EWdetectorP () |
| void | updateStats (int) |
| double | getRate () |
| void | setDb (int) |
| void | setDt (int) |
| void | setLink (int, int) |
| void | setAlarm () |
| void | resetAlarm () |
| int | testAlarm () |
| void | setChange () |
| void | resetChange () |
| void | run (Packet *) |
Public Attributes | |
| int | ew_src |
| int | ew_dst |
| double | now |
| int | db_timer |
| int | dt_timer |
| int | dt_inv |
| int | db_inv |
| double | cur_rate |
| double | avg_rate |
| int | alarm |
| int | change |
| HLF | hlf |
Private Member Functions | |
| void | measure (Packet *) |
| void | detect () |
| void | updateCur () |
| void | updateAvg () |
| void | trace () |
Private Attributes | |
| PktRec | cur_p |
| PktRec | last_p |
| PktRec | last_p_db |
|
|
Definition at line 851 of file ew.cc. References PktRec::arrival, cur_p, PktRec::dept, PktRec::drop, last_p, and last_p_db.
|
|
|
Definition at line 858 of file ew.cc. References PktRec::arrival, cur_p, PktRec::dept, PktRec::drop, and last_p.
|
|
|
Implements EWdetector. Definition at line 891 of file ew.cc. References EWdetector::alarm, EWdetector::avg_rate, EWdetector::cur_rate, EW_DETECT_RANGE, EWdetector::resetAlarm(), and EWdetector::setAlarm().
00891 {
00892 if (cur_rate > avg_rate * (1 + EW_DETECT_RANGE)) {
00893 if (!alarm) {
00894 setAlarm();
00895 }
00896 } else if (cur_rate < avg_rate * (1 - EW_DETECT_RANGE)) {
00897 if (alarm)
00898 resetAlarm();
00899 }
00900 }
|
Here is the call graph for this function:

|
|
Definition at line 865 of file ew.cc. References EWdetector::cur_rate. Referenced by EWPolicy::dropPacket().
00865 {
00866 return(cur_rate);
00867 }
|
|
|
Implements EWdetector. Definition at line 919 of file ew.cc.
00919 {
00920
00921
00922 // stats on packet departure and drop are collect in policer
00923 }
|
|
|
Definition at line 213 of file ew.cc. References EWdetector::alarm, EWdetector::avg_rate, EWdetector::hlf, and HLF::reset(). Referenced by detect(), EWdetectorB::detect(), and EWdetector::EWdetector().
|
Here is the call graph for this function:

|
|
Definition at line 226 of file ew.cc. References EWdetector::change. Referenced by EWPolicy::detect(), and EWdetector::EWdetector().
00226 {
00227 change = 0;
00228 }
|
|
|
Definition at line 261 of file ew.cc. References EWdetector::change, Scheduler::clock(), EWdetector::db_inv, EWdetector::db_timer, EWdetector::detect(), EWdetector::dt_inv, EWdetector::dt_timer, Scheduler::instance(), EWdetector::measure(), EWdetector::now, EWdetector::trace(), EWdetector::updateAvg(), and EWdetector::updateCur(). Referenced by EWPolicy::applyPolicer().
00261 {
00262 // get the time
00263 now = Scheduler::instance().clock();
00264
00265 //printf("EW[%d:%d] run ", ew_src, ew_dst);
00266 // update the measurement
00267 measure(pkt);
00268
00269 // There is a timeout!
00270 if (now >= dt_timer) {
00271 // Start detection
00272 //printf("Detection timeout(%d)\n", (int)now);
00273
00274 // 1. Update the current rate from measurement
00275 updateCur();
00276
00277 // 2. Detect change and Trigger alarm if necessary
00278 // Compare the current rate with the long term average
00279 detect();
00280
00281 // 3. Update the long term averages
00282 updateAvg();
00283
00284 // setup the sleeping timer
00285 dt_timer = (int)now + dt_inv;
00286 //printf("%d\n", dt_inv);
00287
00288 change = 1;
00289 }
00290
00291 // Schedule debug
00292 if (db_inv && now >= db_timer) {
00293 //printf("debugB ");
00294 trace();
00295 db_timer = (int)now + db_inv;
00296 }
00297 }
|
Here is the call graph for this function:

|
|
Definition at line 205 of file ew.cc. References EWdetector::alarm, EWdetector::avg_rate, EWdetector::hlf, and HLF::reset(). Referenced by detect(), and EWdetectorB::detect().
|
Here is the call graph for this function:

|
|
Definition at line 222 of file ew.cc. References EWdetector::change.
00222 {
00223 change = 1;
00224 }
|
|
|
Definition at line 194 of file ew.cc. References EWdetector::db_inv. Referenced by EWPolicy::detectBr(), and EWPolicy::detectPr().
00194 {
00195 db_inv = inv;
00196 //printf("DB: %d\n", db_inv);
00197 };
|
|
|
Definition at line 190 of file ew.cc. References EWdetector::dt_inv. Referenced by EWPolicy::detectBr(), and EWPolicy::detectPr().
00190 {
00191 dt_inv = inv;
00192 //printf("DT: %d\n", dt_inv);
00193 };
|
|
||||||||||||
|
Definition at line 199 of file ew.cc. References EWdetector::ew_dst, and EWdetector::ew_src. Referenced by EWPolicy::detectBr(), and EWPolicy::detectPr().
|
|
|
Definition at line 231 of file ew.cc. References EWdetector::alarm, EWdetector::change, and EW_UNCHANGE. Referenced by EWPolicy::detect().
00231 {
00232 if (!change)
00233 return(EW_UNCHANGE);
00234 else
00235 return(alarm);
00236 }
|
|
|
Implements EWdetector. Definition at line 926 of file ew.cc. References EWdetector::alarm, PktRec::arrival, EWdetector::avg_rate, cur_p, EWdetector::cur_rate, PktRec::dept, PktRec::drop, last_p_db, and EWdetector::now.
00926 {
00927 printf("P %d %.2f %.2f %d %d %d %d %d %d %d\n",
00928 (int)now, cur_rate, avg_rate, alarm,
00929 cur_p.arrival - last_p_db.arrival,
00930 cur_p.dept - last_p_db.dept,
00931 cur_p.drop - last_p_db.drop,
00932 cur_p.arrival, cur_p.dept, cur_p.drop);
00933
00934 last_p_db.arrival = cur_p.arrival;
00935 last_p_db.dept = cur_p.dept;
00936 last_p_db.drop = cur_p.drop;
00937 }
|
|
|
Reimplemented from EWdetector. |
|
|
Implements EWdetector. Definition at line 903 of file ew.cc. References PktRec::arrival, cur_p, EWdetector::cur_rate, PktRec::dept, PktRec::drop, EWdetector::dt_inv, and last_p.
|
|
|
Definition at line 870 of file ew.cc. References PktRec::arrival, cur_p, PktRec::dept, PktRec::drop, PKT_ARRIVAL, PKT_DEPT, and PKT_DROP. Referenced by EWPolicy::applyPolicer().
00870 {
00871 // Packet arrival
00872 if (flag == PKT_ARRIVAL) {
00873 cur_p.arrival++;
00874 return;
00875 }
00876
00877 // Packet departure
00878 if (flag == PKT_DEPT) {
00879 cur_p.dept++;
00880 return;
00881 }
00882
00883 // Packet dropped
00884 if (flag == PKT_DROP) {
00885 cur_p.drop++;
00886 return;
00887 }
00888 }
|
|
|
Definition at line 201 of file ew.h. Referenced by EWdetectorB::computeDropP(), detect(), EWdetectorB::detect(), EWdetector::resetAlarm(), EWdetector::setAlarm(), EWdetector::testAlarm(), trace(), EWdetectorB::trace(), and EWdetector::updateAvg(). |
|
|
Definition at line 198 of file ew.h. Referenced by EWdetectorB::computeDropP(), detect(), EWdetectorB::detect(), EWdetector::EWdetector(), EWdetector::resetAlarm(), EWdetector::setAlarm(), trace(), EWdetectorB::trace(), and EWdetector::updateAvg(). |
|
|
Definition at line 203 of file ew.h. Referenced by EWdetector::resetChange(), EWdetector::run(), EWdetector::setChange(), and EWdetector::testAlarm(). |
|
|
Definition at line 236 of file ew.h. Referenced by EWdetectorP(), trace(), updateCur(), updateStats(), and ~EWdetectorP(). |
|
|
Definition at line 198 of file ew.h. Referenced by EWdetectorB::computeDropP(), detect(), EWdetectorB::detect(), EWdetector::EWdetector(), getRate(), trace(), EWdetectorB::trace(), EWdetector::updateAvg(), updateCur(), and EWdetectorB::updateCur(). |
|
|
Definition at line 195 of file ew.h. Referenced by EWdetector::run(), and EWdetector::setDb(). |
|
|
Definition at line 193 of file ew.h. Referenced by EWdetector::EWdetector(), and EWdetector::run(). |
|
|
Definition at line 195 of file ew.h. Referenced by EWdetector::run(), EWdetector::setDt(), EWdetectorB::timeoutAList(), and updateCur(). |
|
|
Definition at line 193 of file ew.h. Referenced by EWdetector::EWdetector(), and EWdetector::run(). |
|
|
Definition at line 187 of file ew.h. Referenced by EWdetector::EWdetector(), and EWdetector::setLink(). |
|
|
Definition at line 187 of file ew.h. Referenced by EWdetector::EWdetector(), and EWdetector::setLink(). |
|
|
Definition at line 206 of file ew.h. Referenced by EWdetector::EWdetector(), EWdetector::resetAlarm(), EWdetector::setAlarm(), and EWdetector::updateAvg(). |
|
|
Definition at line 236 of file ew.h. Referenced by EWdetectorP(), updateCur(), and ~EWdetectorP(). |
|
|
Definition at line 236 of file ew.h. Referenced by EWdetectorP(), and trace(). |
|
|
Definition at line 190 of file ew.h. Referenced by EWdetectorB::newAListEntry(), EWdetectorB::printAList(), EWdetectorB::printSWin(), EWdetector::run(), EWdetectorB::timeoutAList(), trace(), EWdetectorB::trace(), and EWdetectorB::updateAList(). |
1.3.3