Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members

JoBS Class Reference

#include <jobs.h>

Inheritance diagram for JoBS:

Inheritance graph
[legend]
Collaboration diagram for JoBS:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 JoBS ()
virtual int command (int argc, const char *const *argv)
void enque (Packet *)
Packetdeque ()
virtual void recv (Packet *, Handler *)
virtual void recv (Packet *p, const char *s)
virtual void updateStats (int queuesize)
void resume ()
int blocked () const
void unblock ()
void block ()
int limit ()
int length ()
int byteLength ()
virtual double utilization (void)
virtual void reset ()
virtual void destroy ()
void enqueue (QueueElem< T > *e)
QueueElem< T > * dequeue ()
void detach (QueueElem< T > *e)
QueueElem< T > * getHead ()
int is_empty () const
int size () const
NsObjecttarget ()
virtual void drop (Packet *p)
virtual void recvOnly (Packet *)
virtual void delay_bind_init_all ()
virtual int delay_bind_dispatch (const char *varName, const char *localName, TclObject *tracer)
int isdebug () const
virtual void debug (const char *fmt,...)

Public Attributes

int link_id_

Protected Member Functions

void reset ()
void utilUpdate (double int_begin, double int_end, int link_state)
virtual void drop (Packet *p, const char *s)
void send (Packet *p, Handler *h)
void handle (Event *)

Protected Attributes

long total_backlog_Pkts_
long total_backlog_Bits_
double mean_pkt_size_
int drop_front_
int trace_hop_
int adc_resolution_type_
int shared_buffer_
LinkDelaylink_
char * file_name_
int sampling_period_
PacketQueuecls_ [NO_CLASSES+1]
int concerned_RDC_ [NO_CLASSES+1]
int concerned_RLC_ [NO_CLASSES+1]
int concerned_ADC_ [NO_CLASSES+1]
int concerned_ALC_ [NO_CLASSES+1]
int concerned_ARC_ [NO_CLASSES+1]
double RDC_ [NO_CLASSES+1]
double RLC_ [NO_CLASSES+1]
double ADC_ [NO_CLASSES+1]
double ALC_ [NO_CLASSES+1]
double ARC_ [NO_CLASSES+1]
double loss_prod_others_ [NO_CLASSES+1]
double prod_others_ [NO_CLASSES+1]
double service_rate_ [NO_CLASSES+1]
double current_loss_ [NO_CLASSES+1]
double Rin_ [NO_CLASSES+1]
double Rout_ [NO_CLASSES+1]
double Rout_th_ [NO_CLASSES+1]
double Arrival_ [NO_CLASSES+1]
double last_rate_update_ [NO_CLASSES+1]
int qlim_
int blocked_
int unblock_on_resume_
QueueHandler qh_
PacketQueuepq_
double true_ave_
double total_time_
double last_change_
double old_util_
double util_weight_
QueueElem< T > * head_
QueueElem< T > * tail_
int size_
NsObjecttarget_
NsObjectdrop_
int debug_

Private Member Functions

void updateError ()
double projDelay (int)
double * assignRateDropsADC ()
double * adjustRatesRDC ()
int minRatesNeeded (int)
void arvAccounting (Packet *)
int pickDroppedRLC (int)
void dropTail (int, int)
void dropFront (int, int)
int enforceWC ()
void updateStats (Packet *, int)

Private Attributes

int idle_
double idletime_
int pkt_count_
double min_share_
double last_arrival_
double sliding_inter_
double sliding_avg_pkt_size_
double sliding_arv_pkts_
double sliding_arv_pkts_c [NO_CLASSES+1]
double sliding_serviced_pkts_ [NO_CLASSES+1]
double sliding_serviced_bits_ [NO_CLASSES+1]
double sliding_class_service_rate_ [NO_CLASSES+1]
double sliding_class_delay_ [NO_CLASSES+1]
double last_xmit_ [NO_CLASSES+1]
long backlog_Bits_ [NO_CLASSES+1]
long backlog_Pkts_ [NO_CLASSES+1]
double error_ [NO_CLASSES+1]
double min_rate_ [NO_CLASSES+1]
double min_drop_ [NO_CLASSES+1]
double max_drop_ [NO_CLASSES+1]
double Rout_last_up_ [NO_CLASSES+1]
double avg_elapsed_ [NO_CLASSES+1]
double excess_drops_ [NO_CLASSES+1]
double util_
double Kp_static_
double Kp_dynamic_
int ABS_present_
double monitoring_window_
double last_monitor_update_
FILE * hop_trace_

Constructor & Destructor Documentation

JoBS::JoBS  ) 
 

Definition at line 63 of file jobs.cc.

References ABS_present_, ADC_, adc_resolution_type_, ALC_, avg_elapsed_, backlog_Bits_, backlog_Pkts_, cls_, current_loss_, drop_front_, error_, excess_drops_, FALSE, idle_, INFINITY, last_arrival_, last_monitor_update_, last_rate_update_, last_xmit_, max_drop_, mean_pkt_size_, min_drop_, min_rate_, monitoring_window_, NO_CLASSES, pkt_count_, RDC_, Rin_, RLC_, Rout_, Rout_last_up_, Rout_th_, service_rate_, shared_buffer_, sliding_arv_pkts_, sliding_arv_pkts_c, sliding_class_delay_, sliding_class_service_rate_, sliding_serviced_bits_, sliding_serviced_pkts_, total_backlog_Bits_, total_backlog_Pkts_, trace_hop_, and util_.

00063            : link_(NULL) {
00064         for (int i=1; i<=NO_CLASSES; i++) 
00065                 cls_[i] = new PacketQueue;
00066 
00067         bind_bool("drop_front_", &drop_front_);
00068         bind_bool("trace_hop_", &trace_hop_);
00069         bind("mean_pkt_size_", &mean_pkt_size_);  // avg pkt size
00070         bind("adc_resolution_type_", &adc_resolution_type_);
00071         bind_bool("shared_buffer_", &shared_buffer_);
00072         total_backlog_Pkts_     = 0;
00073         total_backlog_Bits_     = 0;
00074         pkt_count_ = 0;
00075         idle_ = 1;
00076         ABS_present_ = FALSE;
00077         monitoring_window_ = 0;
00078         last_arrival_ = 0;
00079         last_monitor_update_ = 0;
00080         sliding_arv_pkts_=0;
00081         util_ = 0;
00082 
00083         for (int i=1; i<=NO_CLASSES; i++) {
00084                 RDC_[i] = (double)i; 
00085                 RLC_[i] = (double)i;
00086                 ADC_[i] = INFINITY;
00087                 ALC_[i] = INFINITY;
00088                 sliding_serviced_pkts_[i] = 0;
00089                 sliding_serviced_bits_[i] = 0;
00090                 sliding_arv_pkts_c[i] = 0;
00091                 sliding_class_delay_[i] = 0;
00092                 sliding_class_service_rate_[i] = 0;
00093                 last_xmit_[i] = 0;
00094                 
00095                 avg_elapsed_[i] = 0.0;
00096                 excess_drops_[i] = 0.0;
00097                 Rout_last_up_[i] = 0.0;
00098                 min_drop_[i] = 0.0;
00099                 max_drop_[i] = 1.0;
00100                 error_[i] = 0.0;
00101                 min_rate_[i] = 0.0;
00102                 backlog_Pkts_[i] = 0;
00103                 backlog_Bits_[i] = 0;
00104                 service_rate_[i] = 0;
00105                 current_loss_[i] = 0;
00106                 Rout_[i] = 0;
00107                 Rin_[i] = 0;
00108                 Rout_th_[i] = 0;
00109                 last_rate_update_[i] = 0;
00110         }  
00111 }


Member Function Documentation

double * JoBS::adjustRatesRDC  )  [private]
 

Definition at line 558 of file jobs.cc.

References Scheduler::clock(), cls_, concerned_RDC_, error_, PacketQueue::head(), Scheduler::instance(), Kp_dynamic_, Kp_static_, link_, max, min_rate_, min_share_, NO_CLASSES, pow(), PRECISION_ERROR, Rin_, service_rate_, updateError(), and util_.

Referenced by enque().

00558                              {
00559         int i, j;
00560         int RDC_Classes, activeClasses;
00561         double* result;
00562         double credit, available, lower_bound, upper_bound;
00563         double bk;
00564         double cur_time;
00565         
00566         cur_time = Scheduler::instance().clock(); 
00567   
00568         activeClasses = 0;
00569         RDC_Classes = 0;
00570 
00571         upper_bound = link_ -> bandwidth();
00572 
00573         for (i = 1; i <= NO_CLASSES; i++)
00574                 if (cls_[i]->head() != NULL) {
00575                         activeClasses++;
00576                         if (concerned_RDC_[i]) 
00577                                 RDC_Classes++;
00578                         else 
00579                                 upper_bound -= service_rate_[i];
00580                 }
00581 
00582         result = new double[NO_CLASSES+1];
00583 
00584         if (result == NULL) 
00585                 return NULL;
00586 
00587         for (i = 0; i <= NO_CLASSES; i++) 
00588                 result[i] = 0;
00589 
00590         if (upper_bound < PRECISION_ERROR || activeClasses == 0) return result;
00591         
00592         credit = 0;
00593         lower_bound = 0;
00594         
00595         updateError();
00596         min_share_ = 1.0;
00597         bk = 0;
00598         
00599         for (i = 1; i <= NO_CLASSES; i++) 
00600                 if (concerned_RDC_[i])
00601                         bk += Rin_[i];
00602 
00603         for (i = 1; i <= NO_CLASSES; i++) 
00604                 if ((double)Rin_[i]/(double)bk < min_share_)
00605                         min_share_ = (double)Rin_[i]/(double)bk;
00606   
00607         /*
00608          * note that the formula for Kp is slightly different 
00609          * from the formula derived in CS-2001-21. 
00610          * the formula used here provides better results 
00611          * at the expense of more complicated computations.
00612          */
00613         
00614         Kp_dynamic_ = Kp_static_*pow(upper_bound, 2.)*min_share_*util_*max(util_, 1.0);
00615 
00616         credit = 0;
00617         for (i = 1; i <= NO_CLASSES; i++) {
00618                 if ((cls_[i]->head() != NULL)&&(concerned_RDC_[i])) {
00619                         result[i] = Kp_dynamic_*(error_[i]); 
00620                 }
00621         }
00622 
00623         // saturation 
00624 
00625         for (i = 1; i <= NO_CLASSES; i++) 
00626                 if (cls_[i]->head() != NULL) {
00627                         if (concerned_RDC_[i]) {
00628                                 lower_bound += max(0, min_rate_[i]);
00629                         } 
00630                 }
00631 
00632         for (i = 1; i <= NO_CLASSES; i++) {
00633                 if ((concerned_RDC_[i])&&(result[i] + service_rate_[i] > upper_bound)) {
00634                         for (j = 0; j <= NO_CLASSES; j++) {
00635                                 if (concerned_RDC_[j]) {
00636                                         if (j == i) 
00637                                                 result[j] = (upper_bound-service_rate_[j])  
00638                                                     + min_rate_[j] - lower_bound;
00639                                         else
00640                                                 result[j] = -service_rate_[j]+min_rate_[j];
00641                                 }
00642                         }
00643                         return result;
00644                 }
00645                 if (concerned_RDC_[i] && result[i] + service_rate_[i] < min_rate_[i]) {
00646                         credit += service_rate_[i]+result[i]-min_rate_[i]; 
00647                         // "credit" is in fact a negative number
00648                         result[i] = -service_rate_[i]+min_rate_[i];
00649                 }
00650         }
00651 
00652         for (i = NO_CLASSES; (i > 0)&&(credit < 0); i--) {
00653                 if ((cls_[i]->head() != NULL)&&(concerned_RDC_[i])) {
00654                         available = result[i] + service_rate_[i]-min_rate_[i];
00655                         if (available >= -credit) {
00656                                 result[i] += credit;
00657                                 credit = 0;
00658                         } else {
00659                                 result[i] -= available;
00660                                 credit += available;
00661                         }      
00662                 }
00663         }
00664         return result;
00665 }

Here is the call graph for this function:

void JoBS::arvAccounting Packet  )  [private]
 

Definition at line 1120 of file jobs.cc.

References hdr_ip::access(), hdr_cmn::access(), Arrival_, avg_elapsed_, backlog_Bits_, backlog_Pkts_, Scheduler::clock(), cls_, current_loss_, PacketQueue::head(), Scheduler::instance(), last_rate_update_, max, max_drop_, min, min_drop_, NO_CLASSES, Rin_, Rout_, Rout_th_, service_rate_, Queue< T >::size(), total_backlog_Bits_, and total_backlog_Pkts_.

Referenced by enque().

01120                                           {
01121         int i;
01122         double cur_time;
01123         hdr_cmn* cm_h;
01124         hdr_cmn* cm_h1;
01125         hdr_cmn* cm_h2; 
01126         hdr_ip*  ip_h; 
01127         
01128         cur_time = Scheduler::instance().clock();
01129         cm_h = hdr_cmn::access(thePacket);
01130         ip_h = hdr_ip::access(thePacket);
01131         
01132         /* Update curves */
01133         
01134         Arrival_[ip_h -> prio()]      += 8*cm_h -> size();
01135         Rin_    [ip_h -> prio()]      += 8*cm_h -> size();
01136         if (last_rate_update_[ip_h -> prio()] == 0) {
01137                 last_rate_update_[ip_h -> prio()] = cur_time;
01138         } else {
01139                 Rout_th_ [ip_h -> prio()]      += (cur_time-last_rate_update_[ip_h -> prio()])*service_rate_[ip_h -> prio()];
01140                 last_rate_update_[ip_h -> prio()] = cur_time;
01141         }
01142         backlog_Pkts_[ip_h -> prio()] ++;
01143         backlog_Bits_[ip_h -> prio()] += 8*cm_h -> size();
01144         total_backlog_Bits_ += 8*cm_h -> size();
01145         total_backlog_Pkts_ ++;
01146         
01147         for (i = 1; i <= NO_CLASSES; i++) {
01148                 if (Arrival_[i] > 0) {
01149                         current_loss_[i] = (double)(Arrival_[i] - Rin_[i])/(double)(Arrival_[i]);
01150                         min_drop_[i] = (double)(max(0.0, (1.0-(double)(Rin_[i])/(double)Arrival_[i])));
01151                         max_drop_[i] = (double)(min(1.0, (1.0-(double)((double)Rout_[i]/(double)Arrival_[i]))));        
01152                 } else {
01153                         current_loss_[i] = 0;
01154                         min_drop_[i] = 0.0;
01155                         max_drop_[i] = 0.0;
01156                 }
01157                 
01158                 if (cls_[i]->head() != NULL) {
01159                         cm_h1 = hdr_cmn::access(cls_[i]->head());
01160                         cm_h2 = hdr_cmn::access(cls_[i]->tail());
01161                         avg_elapsed_[i] = (2*cur_time - cm_h1 -> ts_ - cm_h2 -> ts_)/((backlog_Pkts_[i]>1)? 2.0 :1.0);
01162                 }
01163         }
01164         return;
01165 }

Here is the call graph for this function:

double * JoBS::assignRateDropsADC  )  [private]
 

Definition at line 672 of file jobs.cc.

References hdr_cmn::access(), ADC_, adc_resolution_type_, ALC_, ARC_, Arrival_, backlog_Bits_, Scheduler::clock(), cls_, concerned_ADC_, concerned_ARC_, current_loss_, drop_front_, dropFront(), dropTail(), FALSE, PacketQueue::head(), INFINITY, Scheduler::instance(), max, min_rate_, NO_CLASSES, pickDroppedRLC(), RESOLVE_ADC, service_rate_, SHARED_PAIN, Queue< T >::size(), Connector::target(), TRUE, hdr_cmn::ts_, and WITH_UPDATE.

Referenced by enque().

00672                                  {
00673         double* x;
00674         //double myRatios[NO_CLASSES+1];
00675         double c[NO_CLASSES+1], n[NO_CLASSES];
00676         double k[NO_CLASSES+1], target[NO_CLASSES+1];
00677         double available[NO_CLASSES+1];
00678         double toDrop;
00679         int lowest, highest;
00680         int victim_class, keep_going;
00681         int i;
00682         Packet* p; 
00683         hdr_cmn* cm_h; 
00684         double cur_time = Scheduler::instance().clock(); 
00685         
00686         x = new double[NO_CLASSES+1];
00687         
00688         if (x == NULL) return NULL;
00689         
00690         for (i = 0;i <= NO_CLASSES; i++) 
00691                 x[i] = 0;
00692         
00693         keep_going = TRUE;
00694         
00695         for (i = 1; i <= NO_CLASSES; i++) {
00696                 if (cls_[i]->head() != NULL) {
00697                         p = cls_[i]->head();
00698                         cm_h = hdr_cmn::access(p);
00699                         n[i] = (double)service_rate_[i];
00700                         k[i] = (double)backlog_Bits_[i];
00701                         available[i] = service_rate_[i];
00702                         
00703                         if (concerned_ADC_[i]) { 
00704                                 c[i] = (double)max((double)ADC_[i]-(cur_time-cm_h->ts_),1e-10);
00705                                 target[i] = (double)k[i]/(double)c[i];
00706                                 available[i] = -(target[i] - n[i]); 
00707                         } 
00708                         if (concerned_ARC_[i]) { 
00709                                 if (n[i] - ARC_[i] < available[i])
00710                                         available[i] = n[i] - ARC_[i];
00711                         }
00712                 } else {
00713                         available[i] = service_rate_[i];
00714                         n[i] = 0;
00715                         k[i] = 0;
00716                         c[i] = 0;
00717                 }
00718         }
00719         
00720         // Step 1: Adjust rates 
00721         
00722         highest = 1;
00723         lowest  = NO_CLASSES;
00724         
00725         while ((highest < NO_CLASSES+1)&&(available[highest] >= 0))
00726                 highest++; // which is the highest class that needs more service? 
00727         while ((lowest > 0)&&(available[lowest] <= 0))
00728                 lowest--;  // which is the lowest class that needs less service? 
00729         
00730         
00731         while ((highest != NO_CLASSES+1)&&(lowest != 0)) {
00732                 // give the excess service from lowest to highest 
00733                 if (available[lowest]+available[highest] > 0) {
00734                         // Still some "credit" left 
00735                         // Give all that is needed by "highest" 
00736                         n[lowest]  -= -available[highest];
00737                         n[highest] += -available[highest];
00738                         
00739                         available[lowest]  -= -available[highest];
00740                         available[highest] = 0;
00741                         
00742                         while ((highest < NO_CLASSES+1)&&(available[highest] >= 0))
00743                                 highest++;  // which is the highest class that needs more service? 
00744                         
00745                 } else if (available[lowest]+available[highest] == 0) {
00746                         // No more credit left but it's fine 
00747                         n[lowest]  -= -available[highest];
00748                         n[highest] += -available[highest];
00749                         
00750                         available[highest] = 0;
00751                         available[lowest]  = 0;
00752                         
00753                         while ((highest < NO_CLASSES+1)&&(available[highest] >= 0))
00754                                 highest++;  // which is the highest class that needs more service? 
00755                         while ((lowest > 0)&&(available[lowest] <= 0))
00756                                 lowest--;   // which is the lowest class that needs less service? 
00757 
00758                 } else if (available[lowest]+available[highest] < 0) {
00759                         // No more credit left and we need to switch to another class 
00760                         n[lowest]  -= available[lowest];
00761                         n[highest] += available[lowest];
00762 
00763                         available[highest] += available[lowest];
00764                         available[lowest]  = 0;
00765                         
00766                         while ((lowest > 0)&&(available[lowest] <= 0))
00767                                 lowest--;  // which is the lowest class that needs less service? 
00768                 }
00769         }
00770         
00771         for (i = 1; i <= NO_CLASSES; i++) {
00772                 if (cls_[i]->head() != NULL)
00773                         x[i] = n[i] - (double)service_rate_[i];
00774                 else 
00775                         x[i] = - (double)service_rate_[i] ;
00776         }
00777         
00778         // Step 2: Adjust drops 
00779         
00780         if (highest != NO_CLASSES+1) {
00781                 // Some class still needs additional service 
00782                 if (adc_resolution_type_ == SHARED_PAIN) {
00783                         // Drop from all classes
00784                         toDrop = 0;
00785                         for (i = 1; i <= NO_CLASSES; i++) 
00786                                 if (available[i] < 0 && concerned_ADC_[i] && cls_[i]->head()) 
00787                                         toDrop += k[i] - c[i]*n[i];
00788                         
00789                         while ((toDrop > 0)&&(keep_going)) {
00790                                 victim_class = pickDroppedRLC(RESOLVE_ADC);
00791                                 if (drop_front_) 
00792                                         p = cls_[victim_class] -> head();
00793                                 else
00794                                         p = cls_[victim_class] -> tail();
00795               
00796                                 cm_h = hdr_cmn::access(p);
00797 
00798                                 if (current_loss_[victim_class]+(double)8*cm_h -> size()/(double)Arrival_[victim_class] > ALC_[victim_class]) {
00799                                         keep_going = FALSE;
00800                                 } else {
00801                                         toDrop -= (double)8*cm_h -> size();
00802 
00803                                         if (drop_front_) 
00804                                                 dropFront(victim_class, WITH_UPDATE);
00805                                         else
00806                                                 dropTail(victim_class, WITH_UPDATE);
00807                                 }
00808                         }       
00809                 } else {
00810                         // Drop solely from the class(es) that need(s) more service
00811                         for (i = 1; i <= NO_CLASSES; i++) {
00812                                 if (available[i] < 0 && cls_[i] -> head()) {
00813                                         k[i] = c[i]*n[i];       
00814 
00815                                         while ((backlog_Bits_[i] > k[i])&&(keep_going)) {
00816                                                 if (drop_front_) {
00817                                                         p = cls_[i] -> head();
00818                                                         cm_h = hdr_cmn::access(p);
00819                                                         if (current_loss_[i]+(double)8*cm_h -> size()/(double)Arrival_[i] > ALC_[i]) {
00820                                                                 keep_going = FALSE;
00821                                                         } else 
00822                                                                 dropFront(i, WITH_UPDATE);
00823                                                 } else {
00824                                                         p = cls_[i] -> tail();
00825                                                         cm_h = hdr_cmn::access(p);
00826                                                         if (current_loss_[i]+(double)8*cm_h -> size()/(double)Arrival_[i] > ALC_[i]) {
00827                                                                 keep_going = FALSE;
00828                                                         } else 
00829                                                                 dropTail(i, WITH_UPDATE);
00830                                                 }
00831                                         }
00832                                         k[i] = backlog_Bits_[i];
00833                                 }
00834                         }      
00835                 }
00836         } 
00837 
00838         for (i = 1; i <= NO_CLASSES; i++) 
00839                 if (cls_[i]->head() && concerned_ADC_[i]) {
00840                         if (c[i] > 0) {
00841                                 if (concerned_ADC_[i] && !concerned_ARC_[i]) {
00842                                         min_rate_[i] = (double)k[i]/(double)c[i];
00843                                 } else 
00844                                         min_rate_[i] = (double)n[i];
00845                         } else {
00846                                 min_rate_[i] = INFINITY;
00847                         }
00848                 } else  if (cls_[i]->head() && concerned_ARC_[i]) {
00849                         min_rate_[i] = n[i];
00850                 } else {
00851                   min_rate_[i] = 0.0;    
00852                 }
00853         return (x);
00854 }

Here is the call graph for this function:

template<class T>
void Queue< T >::block  )  [inline, inherited]
 

Definition at line 131 of file queue.h.

References Queue< T >::blocked_.

00131 { blocked_ = 1; }

template<class T>
int Queue< T >::blocked  )  const [inline, inherited]
 

Definition at line 129 of file queue.h.

References Queue< T >::blocked_.

Referenced by CBQClass::recv().

00129 { return (blocked_ == 1); }

template<class T>
int Queue< T >::byteLength  )  [inline, inherited]
 

Definition at line 135 of file queue.h.

References PacketQueue::byteLength(), and Queue< T >::pq_.

00135 { return pq_->byteLength(); }   /* number of bytes *

Here is the call graph for this function:

int JoBS::command int  argc,
const char *const *  argv
[virtual]
 

Reimplemented from Connector.

Definition at line 113 of file jobs.cc.

References abort(), ABS_present_, ADC_, ALC_, ARC_, Connector::command(), concerned_ADC_, concerned_ALC_, concerned_ARC_, concerned_RDC_, concerned_RLC_, FALSE, file_name_, hop_trace_, INFINITY, Kp_static_, link_, link_id_, loss_prod_others_, mean_pkt_size_, NO_CLASSES, prod_others_, RDC_, RLC_, sampling_period_, service_rate_, trace_hop_, and TRUE.

00113                                                   {
00114         Tcl& tcl = Tcl::instance();
00115         double tmp[NO_CLASSES+1];
00116 
00117         if (argc >= NO_CLASSES+2) { /* input RDCs/RLCs/ADCs/ALCs */
00118                 if (strcmp(argv[1], "init-rdcs") == 0) {
00119                         RDC_[0] = -1;
00120                         for (int i=1; i<=NO_CLASSES; i++) {
00121                                 RDC_[i] = atof(argv[i+1]);
00122                                 if (RDC_[i] == -1)
00123                                         concerned_RDC_[i] = FALSE;
00124                                 else
00125                                   concerned_RDC_[i] = TRUE;
00126                         }
00127                         for (int i=1; i<=NO_CLASSES;i++) {
00128                                 tmp[i] = 1.0;
00129                                 for (int j = 1; j <= i-1; j++) 
00130                                   if (concerned_RDC_[j]) tmp[i] *= RDC_[j];
00131                         }
00132 
00133                         for (int i=1; i<=NO_CLASSES; i++) {
00134                                 prod_others_[i] = 1.0;
00135                                 for (int j = 1; j <= NO_CLASSES; j++) 
00136                                         if ((j != i)&&(concerned_RDC_[j]))
00137                                           prod_others_[i] *= tmp[j];
00138                         }
00139                         if (argc == NO_CLASSES+2) {
00140                                 fprintf(stdout, "\nConfigured RDC, with:\n");
00141                                 for (int i=1; i<=NO_CLASSES; i++) {
00142                                         fprintf(stdout, "\tClass %d: ",i);
00143                                         if (concerned_RDC_[i]) 
00144                                                 fprintf(stdout, "\t%f\t(%f)\n", (double)RDC_[i], (double) prod_others_[i]);
00145                                         else 
00146                                                 fprintf(stdout, "\tNot concerned\n");
00147                                 }
00148                         }
00149                         return (TCL_OK);
00150                 }
00151 
00152                 if (strcmp(argv[1], "init-rlcs") == 0) {
00153                         RLC_[0] = -1;
00154                         for (int i=1; i<=NO_CLASSES; i++) {
00155                                 RLC_[i] = atof(argv[i+1]);
00156                                 if (RLC_[i] == -1)
00157                                         concerned_RLC_[i] = FALSE;
00158                                 else
00159                                         concerned_RLC_[i] = TRUE;
00160                         }
00161 
00162                         for (int i=1; i<=NO_CLASSES;i++) {
00163                                 tmp[i] = 1.0;
00164                                 for (int j = 1; j <= i-1; j++) 
00165                                         if (concerned_RLC_[j]) 
00166                                                 tmp[i] *= RLC_[j];
00167                         }
00168 
00169                         for (int i=1; i<=NO_CLASSES; i++) {
00170                                 loss_prod_others_[i] = 1.0;
00171                                 for (int j = 1; j <= NO_CLASSES; j++) 
00172                                         if ((j != i)&&(concerned_RLC_[j]))
00173                                                 loss_prod_others_[i] *= tmp[j];
00174                         }
00175                         if (argc == NO_CLASSES+2) {
00176                                 fprintf(stdout, "\nConfigured RLC, with:\n");
00177                                 for (int i=1; i<=NO_CLASSES; i++) {
00178                                         fprintf(stdout, "\tClass %d: ",i);
00179                                         if (concerned_RLC_[i]) 
00180                                                 fprintf(stdout, "\t%f\t(%f)\n", (double)RLC_[i], (double)loss_prod_others_[i]);
00181                                         else 
00182                                                 fprintf(stdout, "\tNot concerned\n");
00183                                 }
00184                         }
00185                         
00186                         return (TCL_OK);
00187                 }
00188                 if (strcmp(argv[1], "init-adcs") == 0) {
00189                         ADC_[0] = -1;
00190                         for (int i=1; i<=NO_CLASSES; i++) {
00191                                 ADC_[i] = atof(argv[i+1]);
00192                                 if (ADC_[i] == -1) {
00193                                         concerned_ADC_[i] = FALSE;
00194                                         ADC_[i] = INFINITY;
00195                                 } else {
00196                                         concerned_ADC_[i] = TRUE;
00197                                         ABS_present_ = TRUE;
00198                                 }
00199                         }
00200                         if (argc == NO_CLASSES+2) {
00201                                 fprintf(stdout, "\nConfigured ADC, with:\n");
00202                                 for (int i=1; i<=NO_CLASSES; i++) {
00203                                         fprintf(stdout, "\tClass %d: ", i);
00204                                         if (concerned_ADC_[i]) 
00205                                                 fprintf(stdout, "\t%f secs\n", (double)ADC_[i]);
00206                                         else 
00207                                                 fprintf(stdout, "\tNot concerned\n");
00208                                 }
00209                         }
00210 
00211                         return (TCL_OK);
00212                 }
00213                 if (strcmp(argv[1], "init-alcs") == 0) {
00214                         ALC_[0] = -1;
00215                         for (int i=1; i<=NO_CLASSES; i++) {
00216                                 ALC_[i] = atof(argv[i+1]);
00217                                 if (ALC_[i] == -1) {
00218                                         concerned_ALC_[i] = FALSE;
00219                                         ALC_[i] = INFINITY;
00220                                 } else
00221                                         concerned_ALC_[i] = TRUE;
00222                         }
00223                         if (argc == NO_CLASSES+2) {
00224                                 fprintf(stdout, "\nConfigured ALC, with:\n");
00225                                 for (int i=1; i<=NO_CLASSES; i++) {
00226                                         fprintf(stdout, "\tClass %d: ",i);
00227                                         if (concerned_ALC_[i])  
00228                                                 fprintf(stdout, "\t%f\n", (double)ALC_[i]);
00229                                         else 
00230                                                 fprintf(stdout, "\tNot concerned\n");   
00231                                 }
00232                         }
00233                         return (TCL_OK);
00234                 }
00235                 if (strcmp(argv[1], "init-arcs") == 0) {
00236                         ARC_[0] = -1;
00237                         for (int i=1; i<=NO_CLASSES; i++) {
00238                                 ARC_[i] = atof(argv[i+1]);
00239                                 if (ARC_[i] == -1) {
00240                                         concerned_ARC_[i] = FALSE;
00241                                         ARC_[i] = 0;
00242                                 } else {
00243                                         concerned_ARC_[i] = TRUE;
00244                                         ABS_present_ = TRUE;
00245                                 }
00246                         }
00247                         if (argc == NO_CLASSES+2) {
00248                                 fprintf(stdout, "\nConfigured ARC, with:\n");
00249                                 for (int i=1; i<=NO_CLASSES; i++) {
00250                                         fprintf(stdout, "\tClass %d: ",i);
00251                                         if (concerned_ARC_[i])  
00252                                                 fprintf(stdout, "\t%f\n", (double)ARC_[i]);
00253                                         else 
00254                                                 fprintf(stdout, "\tNot concerned\n");   
00255                                 }
00256                         }
00257                         return (TCL_OK);
00258                 }
00259         } else if (argc == 3) {
00260                 if (strcmp(argv[1], "link") == 0) {
00261                         LinkDelay* del = (LinkDelay*)TclObject::lookup(argv[2]);
00262                         if (del == 0) {
00263                                 tcl.resultf("JoBS: no LinkDelay object %s",
00264                                             argv[2]);
00265                                 return(TCL_ERROR);
00266                         }
00267                         link_ = del;
00268                         for (int i=1; i <= NO_CLASSES; i++)
00269                                 service_rate_[i] = 0;
00270                         return (TCL_OK);
00271                 }
00272                 if (strcmp(argv[1], "sampling-period") == 0) {
00273                         sampling_period_ = atoi(argv[2]);
00274                         if (sampling_period_ < 0) {
00275                                 fprintf(stderr, "JoBS: sampling period must be positive!!\n");
00276                                 abort();
00277                                 return (TCL_ERROR); // __NOT REACHED__
00278                         } else 
00279                                 return (TCL_OK);      
00280                 }
00281                 if (strcmp(argv[1], "id") == 0) {
00282                         link_id_ = (int)atof(argv[2]);
00283                         return (TCL_OK);
00284                 }
00285                 if (strcmp(argv[1], "trace-file") == 0) {
00286                         file_name_ = new(char[500]);
00287                         strcpy(file_name_, argv[2]);
00288                         if (strcmp(file_name_, "null")) {
00289                                 trace_hop_ = true;
00290                         } else {
00291                                 trace_hop_ = false;
00292                         }
00293                         return (TCL_OK);
00294                 }
00295         } else if (argc == 2) {
00296                 if (strcmp(argv[1], "initialize") == 0) {
00297                         double myMaxPi=0;
00298                         for (int i = 1; i <= NO_CLASSES; i++) 
00299                                 if (prod_others_[i] > myMaxPi) 
00300                                         myMaxPi = prod_others_[i];
00301 
00302                         Kp_static_ = -2/(double)(myMaxPi*mean_pkt_size_*sampling_period_);
00303 
00304       // Open files
00305                         if (trace_hop_) {
00306                                 if ((hop_trace_ = fopen(file_name_, "w"))==NULL) {
00307                                         fprintf(stderr, "Problem with opening the per-hop trace file: %s\n", file_name_);
00308                                         abort();          
00309                                 }
00310                         }    
00311                         return (TCL_OK);
00312                 }
00313                 if (strcmp(argv[1], "copyright-info") == 0) {
00314                         fprintf(stdout, "\n----------------------------------------------------------\n\n");
00315                         fprintf(stdout, "JoBS scheduler/dropper [prototype ns-2 implementation]\n");
00316                         fprintf(stdout, "Version 1.0 (CVS Revision: $Id: jobs.cc,v 1.2 2003/02/04 20:45:55 xuanc Exp $)\n\n");
00317                         fprintf(stdout, "ns-2 implementation by Nicolas Christin <nicolas@cs.virginia.edu>\n");
00318                         fprintf(stdout, "JoBS algorithms proposed by Nicolas Christin and Jorg Liebeherr.\n");
00319                         fprintf(stdout, "Grateful acknowledgments to Tarek Abdelzaher for his help and comments.\n");
00320                         fprintf(stdout, "Visit http://qosbox.cs.virginia.edu for more\n");
00321                         fprintf(stdout, "information.\n\n");
00322                         fprintf(stdout, "Copyright (c) 2000-2002 by the Rector and Board of Visitors of the\n");
00323                         fprintf(stdout, "University of Virginia.\n");
00324                         fprintf(stdout, "All Rights Reserved.\n");
00325                         fprintf(stdout, "----------------------------------------------------------\n\n");
00326                         return (TCL_OK);
00327                 }
00328         }
00329         return (Queue::command(argc, argv));
00330 }

Here is the call graph for this function:

void NsObject::debug const char *  fmt,
... 
[virtual, inherited]
 

Definition at line 102 of file object.cc.

References NsObject::debug_.

00103 {
00104         if (!debug_)
00105                 return;
00106         va_list ap;
00107         va_start(ap, fmt);
00108         vprintf(fmt, ap);
00109 }

int NsObject::delay_bind_dispatch const char *  varName,
const char *  localName,
TclObject tracer
[virtual, inherited]
 

Reimplemented in BayFullTcpAgent, Agent, MPLSAddressClassifier, LDPAgent, FullTcpAgent, SackFullTcpAgent, RFC793eduTcpAgent, TcpSink, TcpAgent, and VegasTcpAgent.

Definition at line 63 of file object.cc.

References NsObject::debug_.

Referenced by MPLSAddressClassifier::delay_bind_dispatch(), and Agent::delay_bind_dispatch().

00064 {
00065         if (delay_bind_bool(varName, localName, "debug_", &debug_, tracer)) 
00066                 return TCL_OK;
00067         return TclObject::delay_bind_dispatch(varName, localName, tracer);
00068 }

void NsObject::delay_bind_init_all  )  [virtual, inherited]
 

Reimplemented in BayFullTcpAgent, Agent, MPLSAddressClassifier, LDPAgent, FullTcpAgent, SackFullTcpAgent, RFC793eduTcpAgent, TcpSink, TcpAgent, and VegasTcpAgent.

Definition at line 57 of file object.cc.

Referenced by MPLSAddressClassifier::delay_bind_init_all(), and Agent::delay_bind_init_all().

00058 {
00059         delay_bind_init_one("debug_");
00060 }

Packet * JoBS::deque  )  [virtual]
 

Implements Queue< T >.

Definition at line 336 of file jobs.cc.

References hdr_cmn::access(), backlog_Bits_, backlog_Pkts_, LinkDelay::bandwidth(), Scheduler::clock(), cls_, PacketQueue::deque(), PacketQueue::head(), idle_, idletime_, INFINITY, Scheduler::instance(), last_xmit_, link_, NO_CLASSES, Rout_, Rout_last_up_, Rout_th_, hdr_cmn::size(), sliding_class_delay_, sliding_serviced_bits_, sliding_serviced_pkts_, total_backlog_Bits_, total_backlog_Pkts_, and hdr_cmn::ts_.

00336                     { // Lower classes are better. 
00337         double  cur_time  = Scheduler::instance().clock(); 
00338         double  error;
00339         double  maxError;
00340         int     svc_class = 0;
00341   
00342         error = 0;
00343 
00344         // Fast translation of service rates into packet forwarding decisions
00345 
00346         maxError = -INFINITY;
00347         for (int i=1; i<=NO_CLASSES; i++) {
00348                 if (cls_[i]->head()) {
00349                         error = (double)Rout_th_[i] - Rout_[i];
00350                         if (error > maxError) {
00351                                 maxError = error;
00352                                 svc_class = i;
00353                         }
00354                 }
00355         }
00356 
00357         if (svc_class == 0) {
00358                 idle_ = 1;
00359                 if (&Scheduler::instance() != NULL)
00360                         idletime_ = cur_time;
00361                 else
00362                         idletime_ = 0.0;
00363                 return NULL; /* Idle system */
00364         } else {
00365                 idle_ = 0;
00366                 Packet* p = cls_[svc_class]->deque();
00367                 hdr_cmn* cm_h = hdr_cmn::access(p);
00368     
00369                 total_backlog_Pkts_--;
00370                 total_backlog_Bits_ -= 8*cm_h->size();
00371                 backlog_Pkts_[svc_class]--;
00372                 backlog_Bits_[svc_class] -= 8*cm_h->size();
00373                 Rout_[svc_class] += 8*cm_h->size();
00374                 Rout_last_up_[svc_class] = cur_time;
00375                 
00376                 sliding_serviced_pkts_[svc_class] ++;
00377                 sliding_serviced_bits_[svc_class] += 8*cm_h->size();
00378                 sliding_class_delay_[svc_class] 
00379                   = ((sliding_serviced_pkts_[svc_class]-1)*(sliding_class_delay_[svc_class])
00380                      +(cur_time-cm_h->ts_))/(sliding_serviced_pkts_[svc_class]);
00381                 last_xmit_[svc_class] = cur_time+(8.*cm_h->size()/(double)link_->bandwidth());
00382                 return(p);
00383         }
00384 }

Here is the call graph for this function:

template<class T>
QueueElem<T>* Queue< T >::dequeue  )  [inline, inherited]
 

Definition at line 378 of file mcache.h.

References Queue< T >::head_, QueueElem< T >::next(), QueueElem< T >::next_, Queue< T >::size_, and Queue< T >::tail_.

Referenced by Queue< T >::detach(), and MediaServer::get_next_segment().

00378                                 {
00379                 QueueElem<T> *p = head_;
00380                 if (head_ != 0) 
00381                         head_ = head_->next();
00382                 if (head_ == 0)
00383                         tail_ = 0;
00384                 p->next_ = 0;
00385                 size_--;
00386                 if (size_ == 0) 
00387                         assert((head_ == 0) && (tail_ == 0));
00388                 return p;
00389         }

Here is the call graph for this function:

template<class T>
virtual void Queue< T >::destroy  )  [inline, virtual, inherited]
 

Definition at line 358 of file mcache.h.

References QueueElem< T >::data(), Queue< T >::head_, and QueueElem< T >::next().

00358                                {
00359                 QueueElem<T> *p = head_, *q;
00360                 while (p != NULL) {
00361                         q = p;
00362                         p = p->next();
00363                         delete q->data();
00364                         delete q;
00365                 }
00366                 head_ = NULL;
00367         }

Here is the call graph for this function:

template<class T>
void Queue< T >::detach QueueElem< T > *  e  )  [inline, inherited]
 

Definition at line 390 of file mcache.h.

References Queue< T >::dequeue(), Queue< T >::head_, QueueElem< T >::next_, Queue< T >::size_, and Queue< T >::tail_.

Referenced by MediaServer::command().

00390                                      {
00391                 assert(head_ != 0);
00392                 if (head_ == e) {
00393                         dequeue();
00394                         return;
00395                 }
00396                 QueueElem<T> *p = head_;
00397                 while (p != NULL) {
00398                         if (p->next_ != e)
00399                                 p = p->next_;
00400                         else
00401                                 break;
00402                 }
00403                 assert(p != NULL);
00404                 p->next_ = e->next_;
00405                 if (tail_ == e)
00406                         tail_ = p;
00407                 size_--;
00408                 if (size_ == 0) 
00409                         assert((head_ == 0) && (tail_ == 0));
00410         }

Here is the call graph for this function:

void Connector::drop Packet p,
const char *  s
[protected, virtual, inherited]
 

Definition at line 114 of file connector.cc.

References Connector::drop_, Packet::free(), and NsObject::recv().

00115 {
00116         if (drop_ != 0)
00117                 drop_->recv(p, s);
00118         else
00119                 Packet::free(p);
00120 }

Here is the call graph for this function:

void Connector::drop Packet p  )  [virtual, inherited]
 

Definition at line 106 of file connector.cc.

References Connector::drop_, Packet::free(), and NsObject::recv().

Referenced by DSRAgent::acceptRouteReply(), ARPTable::arpresolve(), dropFront(), Vq::dropPacketForECN(), DSRAgent::dropSendBuff(), dropTail(), dsREDQueue::edrop(), Vq::enque(), SRR::enque(), SimpleIntServ::enque(), SFQ::enque(), rtqueue::enque(), RIOQueue::enque(), REMQueue::enque(), REDQueue::enque(), RedPDQueue::enque(), PIQueue::enque(), Marker::enque(), GK::enque(), dsREDQueue::enque(), DRR::enque(), DropTail::enque(), Demarker::enque(), aodv_rqueue::enque(), toraAgent::forward(), AODV::forward(), LandmarkAgent::ForwardPacket(), DSDV_Agent::forwardPacket(), DSRAgent::getRouteForPacket(), Snoop::handle(), DSRAgent::handleFlowForwarding(), DSRAgent::handleForwarding(), DSDV_Agent::lost_link(), TCPTapAgent::processpkt(), CMUPriQueue::prq_enqueue(), rtqueue::purge(), imepAgent::purgeReXmitQ(), SessionTTLChecker::recv(), TTLChecker::recv(), toraAgent::recv(), FullTcpAgent::recv(), BayFullTcpAgent::recv(), TBF::recv(), SatLL::recv(), LL::recv(), GAFPartner::recv(), FloodAgent::recv(), Filter::recv(), DynamicLink::recv(), DSDV_Agent::recv(), AODV::recv(), AODV::recvError(), PriQueue::recvHighPriority(), AODV::recvReply(), toraAgent::reset(), Queue< T >::reset(), LinkDelay::reset(), AODV::rt_ll_failed(), AODV::rt_purge(), AODV::rt_resolve(), toraAgent::rtRoutePacket(), TCPTapAgent::sendpkt(), TapAgent::sendpkt(), IPTapAgent::sendpkt(), AODV::sendRequest(), SatLL::sendUp(), LL::sendUp(), PriQueue::Terminate(), DSRAgent::Terminate(), CMUPriQueue::Terminate(), ARPTable::Terminate(), and DSRAgent::undeliverablePkt().

00107 {
00108         if (drop_ != 0)
00109                 drop_->recv(p);
00110         else
00111                 Packet::free(p);
00112 }

Here is the call graph for this function:

void JoBS::dropFront int  ,
int 
[private]
 

Definition at line 1091 of file jobs.cc.

References hdr_cmn::access(), Arrival_, backlog_Bits_, backlog_Pkts_, cls_, current_loss_, Connector::drop(), min_drop_, NO_CLASSES, Rin_, Queue< T >::size(), hdr_cmn::size(), total_backlog_Bits_, total_backlog_Pkts_, and WITH_UPDATE.

Referenced by assignRateDropsADC(), and enque().

01091                                            {
01092         Packet *p;
01093         hdr_cmn *cm_h;
01094         
01095         p = cls_[prio] -> head();
01096         cm_h = hdr_cmn::access(p);
01097         total_backlog_Pkts_ --;
01098         total_backlog_Bits_ -= 8*cm_h->size();
01099         backlog_Pkts_[prio] --;
01100         backlog_Bits_[prio] -= 8*cm_h->size();
01101         Rin_[prio] -= 8*cm_h->size();
01102         if (strategy == WITH_UPDATE) {
01103                 for (int i = 1; i <= NO_CLASSES; i++) 
01104                         current_loss_[i] = min_drop_[i];
01105                 current_loss_[prio] += (double)8*cm_h -> size() 
01106                   /(double)Arrival_[prio];
01107         }
01108         cls_[prio] -> remove(p);
01109         drop(p);
01110         return;
01111 }  

Here is the call graph for this function:

void JoBS::dropTail int  ,
int 
[private]
 

Definition at line 1063 of file jobs.cc.

References hdr_cmn::access(), Arrival_, backlog_Bits_, backlog_Pkts_, cls_, current_loss_, Connector::drop(), min_drop_, NO_CLASSES, Rin_, Queue< T >::size(), hdr_cmn::size(), total_backlog_Bits_, total_backlog_Pkts_, and WITH_UPDATE.

Referenced by assignRateDropsADC(), and enque().

01063                                           {
01064         Packet *p;
01065         hdr_cmn *cm_h;
01066         
01067         p = cls_[prio] -> tail();
01068         cm_h = hdr_cmn::access(p);
01069         
01070         total_backlog_Pkts_ --;
01071         total_backlog_Bits_ -= 8*cm_h->size();
01072         backlog_Pkts_[prio] --;
01073         backlog_Bits_[prio] -= 8*cm_h->size();
01074         Rin_[prio] -= 8*cm_h->size();
01075         if (strategy == WITH_UPDATE) {
01076                 for (int i = 1; i <= NO_CLASSES; i++) 
01077                         current_loss_[i] = min_drop_[i];
01078                 current_loss_[prio] += (double)8*cm_h -> size() 
01079                     /(double)Arrival_[prio];
01080         }
01081         cls_[prio] -> remove(p);
01082         drop(p);
01083         return;
01084 }

Here is the call graph for this function:

int JoBS::enforceWC  )  [private]
 

Definition at line 522 of file jobs.cc.

References LinkDelay::bandwidth(), cls_, FALSE, PacketQueue::head(), link_, NO_CLASSES, PRECISION_ERROR, service_rate_, and TRUE.

Referenced by enque().

00522                     {
00523         int i;
00524         int activeClasses;
00525         int updated;
00526         
00527         updated = FALSE;
00528         activeClasses = 0;
00529         
00530         for (i = 1; i <= NO_CLASSES; i++) {
00531                 if (cls_[i]->head()) 
00532                         activeClasses++;
00533                 if ((cls_[i] -> head() && service_rate_[i] <= PRECISION_ERROR)
00534                     ||(cls_[i] -> head() == NULL && service_rate_[i] > 0)) 
00535                   updated = TRUE;
00536         }
00537 
00538         if (updated) {
00539                 for (i = 1; i <= NO_CLASSES; i++) {
00540                         if (cls_[i]->head() == NULL) {
00541                                 service_rate_[i] = 0;
00542                         } else {
00543                                 if (activeClasses > 0)
00544                                         service_rate_[i] = link_->bandwidth()/(double)activeClasses;
00545                                 else 
00546                                         service_rate_[i] = 0 ;
00547                         }
00548                 }
00549         }
00550         
00551         return (updated);
00552 }

Here is the call graph for this function:

void JoBS::enque Packet  )  [virtual]
 

Implements Queue< T >.

Definition at line 390 of file jobs.cc.

References abort(), ABS_present_, hdr_cmn::access(), hdr_ip::access(), adjustRatesRDC(), ALC_, Arrival_, arvAccounting(), assignRateDropsADC(), backlog_Pkts_, Scheduler::clock(), cls_, concerned_ALC_, concerned_RLC_, current_loss_, drop_front_, dropFront(), dropTail(), enforceWC(), PacketQueue::enque(), idle_, Scheduler::instance(), last_monitor_update_, last_rate_update_, minRatesNeeded(), MON_WINDOW_SIZE, monitoring_window_, NO_CLASSES, pickDroppedRLC(), pkt_count_, hdr_ip::prio_, Queue< T >::qlim_, RESET_STATS, RESOLVE_OVERFLOW, Rin_, Rout_, Rout_last_up_, Rout_th_, sampling_period_, service_rate_, shared_buffer_, Queue< T >::size(), total_backlog_Pkts_, hdr_cmn::ts_, UPDATE_STATS, updateStats(), and WITH_UPDATE.

00390                             {
00391         double* DeltaR;
00392         int i;
00393         hdr_ip*  ip_h = hdr_ip::access(pkt);
00394         hdr_cmn* cm_h = hdr_cmn::access(pkt);
00395         
00396         int prio = ip_h->prio_;
00397         if ((prio < 1) || (prio > NO_CLASSES)) {
00398                 printf("Bad priority value\n");
00399                 abort();
00400         }
00401   
00402         double cur_time = Scheduler::instance().clock(); 
00403         cm_h->ts_ = cur_time; // timestamp the packet
00404         cls_[prio]->enque(pkt);
00405         
00406         monitoring_window_ -= cur_time-last_monitor_update_;
00407         last_monitor_update_ = cur_time;
00408         if (monitoring_window_ <= 0) {
00409                 updateStats(pkt, RESET_STATS);
00410                 monitoring_window_ = MON_WINDOW_SIZE;
00411         } else {
00412                 updateStats(pkt, UPDATE_STATS);
00413         }
00414         
00415         // Reset arrival, input, and service curves if the scheduler is 
00416         // not busy
00417 
00418         if (idle_) {
00419                 for (i=1; i<= NO_CLASSES; i++) {
00420                   Arrival_[i]=0.0;
00421                   Rin_[i]=0.0;
00422                   Rout_[i]=0.0;
00423                   Rout_th_[i]=0.0;
00424                   last_rate_update_[i] = 0;
00425                   Rout_last_up_[i] = cur_time;
00426                   idle_ = 0;
00427                 }
00428         }
00429         
00430         arvAccounting(pkt);
00431         
00432         /* Is the buffer full? */  
00433         if (!shared_buffer_ && backlog_Pkts_[prio] > qlim_/NO_CLASSES) {
00434                 /* separate buffers: no guarantees on packet drops 
00435                  * can be offered
00436                  * thus we drop the incoming packet
00437                  */
00438                 if (drop_front_)
00439                         dropFront(prio, WITH_UPDATE);
00440                 else
00441                         dropTail(prio, WITH_UPDATE);    
00442         } else {
00443           /* shared buffer */
00444                 if (total_backlog_Pkts_ > qlim_) {
00445                         if (!concerned_RLC_[prio]) {
00446                                 if (!concerned_ALC_[prio]) {
00447                                         // No ALC, no RLC on that class. Drop the incoming packet.
00448                                         if (drop_front_)
00449                                                 dropFront(prio, WITH_UPDATE);
00450                                         else
00451                                                 dropTail(prio, WITH_UPDATE);
00452                                 } else {
00453                                         // No RLC on that class. Drop the incoming packet if you can...
00454                                         if (current_loss_[prio]+(double)8*cm_h -> size()/(double)Arrival_[prio] <= ALC_[prio]) {
00455                                                 if (drop_front_)
00456                                                         dropFront(prio, WITH_UPDATE);
00457                                                 else        
00458                                                         dropTail(prio, WITH_UPDATE);
00459                                         } else {
00460                                                 // If it doesn't work, pick another class
00461                                                 if (drop_front_)
00462                                                         dropFront(pickDroppedRLC(RESOLVE_OVERFLOW), WITH_UPDATE);
00463                                                 else        
00464                                                         dropTail(pickDroppedRLC(RESOLVE_OVERFLOW), WITH_UPDATE);
00465                                         }
00466                                 }
00467                         } else {
00468                                 // RLC on that class (w/ or w/o ALC), pick a class according to the RLC
00469                           if (drop_front_)
00470                                 dropFront(pickDroppedRLC(RESOLVE_OVERFLOW), WITH_UPDATE);
00471                           else      
00472                                 dropTail(pickDroppedRLC(RESOLVE_OVERFLOW), WITH_UPDATE);
00473                         }
00474                 }
00475         }
00476         pkt_count_ ++;
00477         enforceWC(); // Change rates if some classes have entered/left the system
00478         // since the last update
00479 
00480         if ((ABS_present_)&&(!minRatesNeeded(ip_h -> prio()))) {
00481                 DeltaR = assignRateDropsADC();   
00482 
00483                 if (DeltaR != NULL) {
00484                         for (i = 1; i <= NO_CLASSES; i++) 
00485                                 service_rate_[i] += DeltaR[i];
00486                         delete []DeltaR; 
00487                 }
00488 
00489                 DeltaR = adjustRatesRDC();
00490                 
00491                 if (DeltaR) {
00492                         for (i = 1; i <= NO_CLASSES; i++) 
00493                                 service_rate_[i] += DeltaR[i];
00494                         delete []DeltaR;   
00495                 }
00496 
00497                 pkt_count_ = 0;
00498 
00499         } else if (pkt_count_ >= sampling_period_) {
00500                 /* Is it time for a new evaluation of the system? */
00501                 DeltaR = adjustRatesRDC();
00502                 if (DeltaR != NULL) {
00503                         for (i = 1; i <= NO_CLASSES; i++)
00504                                 service_rate_[i] += DeltaR[i];
00505                         delete []DeltaR;
00506                 } 
00507                 pkt_count_ = 0;
00508         }
00509         return;
00510 }

Here is the call graph for this function:

template<class T>
void Queue< T >::enqueue QueueElem< T > *  e  )  [inline, inherited]
 

Definition at line 369 of file mcache.h.

References QueueElem< T >::append(), Queue< T >::head_, Queue< T >::size_, and Queue< T >::tail_.

Referenced by MediaServer::command(), and MediaServer::get_next_segment().

00369                                       {
00370                 if (tail_ == 0)
00371                         head_ = tail_ = e;
00372                 else {
00373                         tail_->append(e);
00374                         tail_ = e;
00375                 }
00376                 size_++;
00377         }

Here is the call graph for this function:

template<class T>
QueueElem<T>* Queue< T >::getHead  )  [inline, inherited]
 

Definition at line 411 of file mcache.h.

References Queue< T >::head_.

Referenced by MediaServer::find_prefinfo().

00411 { return head_; }

void NsObject::handle Event  )  [protected, virtual, inherited]
 

Implements Handler.

Reimplemented in LinkDelay, LL, AckRecons, and Snoop.

Definition at line 91 of file object.cc.

References NsObject::recv().

00092 {
00093         recv((Packet*)e);
00094 }

Here is the call graph for this function:

template<class T>
int Queue< T >::is_empty  )  const [inline, inherited]
 

Definition at line 412 of file mcache.h.

References Queue< T >::size_.

Referenced by MediaServer::command(), and MediaServer::get_next_segment().

00412 { return (size_ == 0); }

int NsObject::isdebug  )  const [inline, inherited]
 

Definition at line 61 of file object.h.

References NsObject::debug_.

00061 { return debug_; }

template<class T>
int Queue< T >::length  )  [inline, inherited]
 

Reimplemented in DRR, and SRR.

Definition at line 133 of file queue.h.

References PacketQueue::length(), and Queue< T >::pq_.

Referenced by REMQueue::run_updaterule(), Snoop::snoop_data(), and updateStats().

00133 { return pq_->length(); }       /* number of pkts currently in

Here is the call graph for this function:

template<class T>
int Queue< T >::limit  )  [inline, inherited]
 

Definition at line 132 of file queue.h.

References Queue< T >::qlim_.

Referenced by dsREDQueue::reset(), and Snoop::snoop_data().

00132 { return qlim_; }

int JoBS::minRatesNeeded int   )  [private]
 

Definition at line 904 of file jobs.cc.

References hdr_cmn::access(), ADC_, ARC_, backlog_Bits_, Scheduler::clock(), cls_, concerned_ADC_, concerned_ARC_, FALSE, PacketQueue::head(), INFINITY, Scheduler::instance(), min_rate_, NO_CLASSES, service_rate_, TRUE, and hdr_cmn::ts_.

Referenced by enque().

00904                                      {
00905         int result;
00906         int i;
00907         double cur_time;
00908         Packet* p;
00909         hdr_cmn* cm_h; 
00910 
00911         cur_time = Scheduler::instance().clock();
00912         result = TRUE;
00913   
00914         for (i = 1; i <= NO_CLASSES; i++) {
00915                 if (cls_[i]->head() != 0 && (concerned_ADC_[i] || concerned_ARC_[i])) {
00916                         p = cls_[i]->head();
00917                         cm_h = hdr_cmn::access(p);
00918 
00919                         if (concerned_ADC_[i]) { 
00920                                 if ((ADC_[i] - (cur_time-cm_h->ts_)) > 0 ) {
00921                                         // min rate needed for ADC
00922                                         min_rate_[i] = (double)(backlog_Bits_[i])
00923                                             /(double)(ADC_[i] - (cur_time-cm_h->ts_));
00924                                         if (concerned_ARC_[i] && ARC_[i] > min_rate_[i]) {
00925                                                 // min rate needed for ADC+ARC
00926                                                 min_rate_[i] = ARC_[i];
00927                                         }
00928                                 } else 
00929                                         min_rate_[i] = INFINITY;        
00930                         } else if (concerned_ARC_[i]) {
00931                                 // no ADC, an ARC
00932                                 min_rate_[i] = ARC_[i];
00933                         }
00934                         if (min_rate_[i] > service_rate_[i]) 
00935                                 result = FALSE;
00936                 } else 
00937                         min_rate_[i] = 0.0;
00938         }
00939         return result;
00940 }

Here is the call graph for this function:

int JoBS::pickDroppedRLC int   )  [private]
 

Definition at line 961 of file jobs.cc.

References abort(), hdr_cmn::access(), ALC_, Arrival_, Scheduler::clock(), cls_, concerned_RLC_, current_loss_, drop_front_, PacketQueue::head(), INFINITY, Scheduler::instance(), link_id_, loss_prod_others_, NO_CLASSES, RESOLVE_OVERFLOW, and Queue< T >::size().

Referenced by assignRateDropsADC(), and enque().

00961                                  {
00962         double Mean;
00963         double loss_error[NO_CLASSES+1];
00964         int i, activeClasses, backloggedClasses;
00965         int class_dropped;
00966         double maxError;
00967         double maxALC;
00968         double cur_time  = Scheduler::instance().clock(); 
00969 
00970         hdr_cmn* cm_h; 
00971         
00972         class_dropped = -1;
00973         maxError = 0;
00974         Mean = 0;
00975         activeClasses = 0;
00976         backloggedClasses = 0;
00977         
00978         for (i = 1; i <= NO_CLASSES; i++) 
00979                 if (cls_[i]->head() != NULL) {
00980                         backloggedClasses ++;
00981                         if (concerned_RLC_[i]) {
00982                                 Mean += loss_prod_others_[i]*current_loss_[i];
00983                                 activeClasses ++;
00984                         }    
00985                 }
00986         
00987         if (activeClasses > 0) 
00988                 Mean /= (double)activeClasses;
00989         else if (backloggedClasses == 0) {
00990                 fprintf(stderr, "JoBS::pickDroppedRLC() called but there's no backlog!\n");
00991                 abort();
00992         }
00993 
00994         if (activeClasses == 0) 
00995                 class_dropped = NO_CLASSES+1; // no classes are concerned by RLCs (NO_CLASSES+1 means "ignore RLC")
00996         else {
00997                 for (i = 1; i <= NO_CLASSES; i++) 
00998                         if ((cls_[i]->head() != NULL)&&(concerned_RLC_[i])) 
00999                                 loss_error[i]=loss_prod_others_[i]*current_loss_[i]-Mean;
01000                         else 
01001                                 loss_error[i] = INFINITY; 
01002     
01003                 for (i = 1; i <= NO_CLASSES; i++)
01004                         if ((cls_[i]->head() != NULL)&&(loss_error[i] <= maxError)) {
01005                                 maxError = loss_error[i]; // Find out which class is the most below the mean
01006                                 class_dropped = i;   // It's the one that needs to be dropped
01007                                 // Ties are broken in favor of the higher priority classes (i.e., if
01008                                 // two classes present the same deviation, the lower priority class 
01009                                 // will get dropped).
01010                         } 
01011                 
01012                 if (class_dropped != -1) {
01013                         if (drop_front_)
01014                                 cm_h = hdr_cmn::access(cls_[class_dropped] -> head());
01015                         else
01016                                 cm_h = hdr_cmn::access(cls_[class_dropped] -> tail());
01017 
01018                         if (current_loss_[class_dropped]+(double)8*cm_h -> size()/(double)Arrival_[class_dropped] > ALC_[class_dropped])
01019                                 class_dropped = NO_CLASSES+1; // the class to drop for meeting the RLC will defeat the ALC: ignore RLC.
01020                 } else 
01021                         class_dropped = NO_CLASSES+1;
01022         }
01023 
01024         if (class_dropped != -1) { // this test is here only for "safety purposes" 
01025                 // it should always return true at this point.
01026                 if (class_dropped == NO_CLASSES+1) {
01027                         maxALC = -INFINITY;
01028                         for (i = 1; i <= NO_CLASSES; i++) {
01029                                 if (cls_[i] -> tail() != NULL) {
01030                                         if (ALC_[i]-current_loss_[i] > maxALC);
01031                                         maxALC = ALC_[i]-current_loss_[i]; // pick the class which is the furthest from its ALC
01032                                         class_dropped = i;
01033                                 }
01034                         }
01035                         if (drop_front_)
01036                           cm_h = hdr_cmn::access(cls_[class_dropped]->head());
01037                         else
01038                           cm_h = hdr_cmn::access(cls_[class_dropped]->tail());
01039                         if ((mode == RESOLVE_OVERFLOW)
01040                             &&(current_loss_[class_dropped]+(double)8*cm_h -> size()/(double)Arrival_[class_dropped] > ALC_[class_dropped])) {
01041 
01042                                 fprintf(stderr, "*** Warning at time t=%f: ALC violated in class %d on link %d\n(reason: buffer overflow impossible to resolve otherwise)\nPkt size=%d bits\told_loss[%d]=%f\tnew_loss[%d]=%f\tArrival_[%d]=%f\tALC[%d]=%f\n",
01043                                         cur_time, link_id_,
01044                                         class_dropped, 8*cm_h -> size(),
01045                                         class_dropped, current_loss_[class_dropped],
01046                                         class_dropped, current_loss_[class_dropped]+(double)8*cm_h -> size()/(double)Arrival_[class_dropped],
01047                                         class_dropped, (double)Arrival_[class_dropped],
01048                                         class_dropped, ALC_[class_dropped]);
01049                         }
01050                 }               
01051         } else {
01052                 fprintf(stderr, "Trying to drop a packet, but there's nothing in any queue!\n");
01053                 abort();
01054         }
01055         return class_dropped;
01056 }

Here is the call graph for this function:

double JoBS::projDelay int   )  [private]
 

Definition at line 946 of file jobs.cc.

References hdr_cmn::access(), Scheduler::clock(), cls_, PacketQueue::head(), and Scheduler::instance().

Referenced by updateError().

00946                             {
00947         double cur_time  = Scheduler::instance().clock(); 
00948         if (cls_[i]->head() != NULL) {
00949                 Packet* p = cls_[i]->head();
00950                 hdr_cmn* cm_h = hdr_cmn::access(p);
00951                 return (cur_time - cm_h -> ts_);
00952         } else return 0.0; // __NOT REACHED__
00953 }

Here is the call graph for this function:

void NsObject::recv Packet p,
const char *  s
[virtual, inherited]
 

Reimplemented in CMUTrace.

Definition at line 96 of file object.cc.

References Packet::free().

00097 {
00098         Packet::free(p);
00099 }

Here is the call graph for this function:

template<class T>
void Queue< T >::recv Packet ,
Handler
[virtual, inherited]
 

Reimplemented from Connector.

Reimplemented in CBQueue, FQ, and PriQueue.

Definition at line 101 of file queue.cc.

References Queue< T >::blocked_, Scheduler::clock(), Queue< T >::deque(), Queue< T >::enque(), Scheduler::instance(), Queue< T >::last_change_, Queue< T >::qh_, NsObject::recv(), Connector::target_, and Queue< T >::utilUpdate().

Referenced by PriQueue::recv().

00102 {
00103         double now = Scheduler::instance().clock();
00104         enque(p);
00105         if (!blocked_) {
00106                 /*
00107                  * We're not blocked.  Get a packet and send it on.
00108                  * We perform an extra check because the queue
00109                  * might drop the packet even if it was
00110                  * previously empty!  (e.g., RED can do this.)
00111                  */
00112                 p = deque();
00113                 if (p != 0) {
00114                         utilUpdate(last_change_, now, blocked_);
00115                         last_change_ = now;
00116                         blocked_ = 1;
00117                         target_->recv(p, &qh_);
00118                 }
00119         }
00120 }

Here is the call graph for this function:

virtual void NsObject::recvOnly Packet  )  [inline, virtual, inherited]
 

Reimplemented in Agent, and Trace.

Definition at line 56 of file object.h.

Referenced by Trace::recvOnly().

00056 {};

template<class T>
virtual void Queue< T >::reset  )  [inline, virtual, inherited]
 

Reimplemented from NsObject.

Reimplemented in dsREDQueue, CBQueue, DropTail, PIQueue, RedPDQueue, REDQueue, REMQueue, and RIOQueue.

Definition at line 349 of file mcache.h.

References Queue< T >::head_, and QueueElem< T >::next().

00349                              {
00350                 QueueElem<T> *p = head_, *q;
00351                 while (p != NULL) {
00352                         q = p;
00353                         p = p->next();
00354                         delete q;
00355                 }
00356                 head_ = NULL;
00357         }

Here is the call graph for this function:

template<class T>
void Queue< T >::reset  )  [protected, virtual, inherited]
 

Reimplemented from NsObject.

Reimplemented in dsREDQueue, CBQueue, DropTail, PIQueue, RedPDQueue, REDQueue, REMQueue, and RIOQueue.

Definition at line 174 of file queue.cc.

References Queue< T >::deque(), Connector::drop(), Queue< T >::total_time_, and Queue< T >::true_ave_.

Referenced by REDQueue::reset(), PIQueue::reset(), dsREDQueue::reset(), and DropTail::reset().

00175 {
00176         Packet* p;
00177         total_time_ = 0.0;
00178         true_ave_ = 0.0;
00179         while ((p = deque()) != 0)
00180                 drop(p);
00181 }

Here is the call graph for this function:

template<class T>
void Queue< T >::resume  )  [inherited]
 

Definition at line 154 of file queue.cc.

References Queue< T >::blocked_, Scheduler::clock(), Queue< T >::deque(), Scheduler::instance(), Queue< T >::last_change_, Queue< T >::qh_, NsObject::recv(), Connector::target_, Queue< T >::unblock_on_resume_, and Queue< T >::utilUpdate().

Referenced by WRR_CBQueue::deque(), CBQueue::deque(), and QueueHandler::handle().

00155 {
00156         double now = Scheduler::instance().clock();
00157         Packet* p = deque();
00158         if (p != 0) {
00159                 target_->recv(p, &qh_);
00160         } else {
00161                 if (unblock_on_resume_) {
00162                         utilUpdate(last_change_, now, blocked_);
00163                         last_change_ = now;
00164                         blocked_ = 0;
00165                 }
00166                 else {
00167                         utilUpdate(last_change_, now, blocked_);
00168                         last_change_ = now;
00169                         blocked_ = 1;
00170                 }
00171         }
00172 }

Here is the call graph for this function:

void Connector::send Packet p,
Handler h
[inline, protected, inherited]
 

Reimplemented in Agent, and LinkDelay.

Definition at line 54 of file connector.h.

References NsObject::recv(), and Connector::target_.

Referenced by SessionTTLChecker::recv(), TTLChecker::recv(), DequeTrace::recv(), Trace::recv(), TraceIpMac::recv(), TraceIp::recv(), SatDequeTrace::recv(), SALink::recv(), SnoopQueueEDrop::recv(), SnoopQueueTagger::recv(), SnoopQueueDrop::recv(), SnoopQueueOut::recv(), SnoopQueueIn::recv(), PktCounter::recv(), NetworkInterface::recv(), MeasureMod::recv(), Filter::recv(), Connector::recv(), CMUTrace::recv(), CBQClass::recv(), and AddSR::recv().

00054 { target_->recv(p, h); }

Here is the call graph for this function:

template<class T>
int Queue< T >::size  )  const [inline, inherited]
 

Definition at line 413 of file mcache.h.

References Queue< T >::size_.

Referenced by arvAccounting(), assignRateDropsADC(), dsREDQueue::deque(), dropFront(), dropTail(), RedPDQueue::enque(), enque(), MediaServer::get_next_segment(), pickDroppedRLC(), and FQ::recv().

00413 { return size_; }

NsObject* Connector::target  )  [inline, inherited]
 

Definition at line 48 of file connector.h.

References Connector::target_.

Referenced by assignRateDropsADC(), FQ::deque(), QSAgent::recv(), and MIPMHAgent::reg().

00048 { return target_; }

template<class T>
void Queue< T >::unblock  )  [inline, inherited]
 

Definition at line 130 of file queue.h.

References Queue< T >::blocked_.

00130 { blocked_ = 0; }

void JoBS::updateError  )  [private]
 

Definition at line 862 of file jobs.cc.

References abort(), cls_, concerned_RDC_, error_, PacketQueue::head(), NO_CLASSES, prod_others_, and projDelay().

Referenced by adjustRatesRDC().

00862                        {
00863         int i;
00864         int activeClasses, backloggedClasses;
00865         double meanWeightedDelay;
00866 
00867         meanWeightedDelay = 0;
00868         activeClasses = 0 ; 
00869         backloggedClasses = 0;
00870         
00871         for (i = 1; i <= NO_CLASSES; i++) 
00872                 if (cls_[i]->head() != NULL) {
00873                         backloggedClasses++;
00874                         if (concerned_RDC_[i]) {
00875                                 meanWeightedDelay += prod_others_[i]*projDelay(i);
00876                                 activeClasses ++;
00877                         }    
00878                 }
00879 
00880         if (activeClasses > 0) 
00881                 meanWeightedDelay /= (double)activeClasses;
00882         else if (backloggedClasses == 0) {
00883                 fprintf(stderr, "JoBS::updateError() called but there's no backlog!\n");
00884                 abort();
00885         }
00886         
00887         for (i = 1; i <= NO_CLASSES; i++) 
00888                 if ((cls_[i]->head() != NULL)&&(concerned_RDC_[i])) {
00889                         error_[i] = meanWeightedDelay-prod_others_[i]*projDelay(i);
00890                 } else {
00891                         error_[i] = 0.0; // either the class isn't concerned, or it's not backlogged
00892                         // in any case, the rate shouldn't be adjusted.
00893                 }
00894         return;
00895 }

Here is the call graph for this function:

template<class T>
void Queue< T >::updateStats int  queuesize  )  [virtual, inherited]
 

Definition at line 141 of file queue.cc.

References Scheduler::clock(), Scheduler::instance(), Queue< T >::total_time_, and Queue< T >::true_ave_.

Referenced by REDQueue::deque(), DropTail::deque(), REDQueue::enque(), and DropTail::enque().

00142 {
00143         double now = Scheduler::instance().clock();
00144         double newtime = now - total_time_;
00145         if (newtime > 0.0) {
00146                 double oldave = true_ave_;
00147                 double oldtime = total_time_;
00148                 double newtime = now - total_time_;
00149                 true_ave_ = (oldtime * oldave + newtime * queuesize) /now;
00150                 total_time_ = now;
00151         }
00152 }

Here is the call graph for this function:

void JoBS::updateStats Packet ,
int 
[private]
 

Definition at line 1169 of file jobs.cc.

References hdr_ip::access(), hdr_cmn::access(), LinkDelay::bandwidth(), Scheduler::clock(), cls_, current_loss_, hop_trace_, Scheduler::instance(), last_arrival_, Queue< T >::length(), link_, max, MON_WINDOW_SIZE, NO_CLASSES, hdr_ip::prio(), RESET_STATS, hdr_cmn::size(), sliding_arv_pkts_, sliding_arv_pkts_c, sliding_avg_pkt_size_, sliding_class_delay_, sliding_class_service_rate_, sliding_inter_, sliding_serviced_bits_, sliding_serviced_pkts_, trace_hop_, UPDATE_STATS, and util_.

Referenced by enque().

01169                                             {
01170         double cur_time = Scheduler::instance().clock();
01171         hdr_cmn* cm_h;
01172         hdr_ip* ip_h;
01173         
01174         cm_h = hdr_cmn::access(p);
01175         ip_h = hdr_ip::access(p);
01176         if (action == UPDATE_STATS) {
01177                 sliding_arv_pkts_++;
01178                 sliding_arv_pkts_c[ip_h->prio()]++;
01179                 sliding_inter_ = (cur_time - last_arrival_ + sliding_inter_ * (sliding_arv_pkts_-1))
01180                     /(double)sliding_arv_pkts_;
01181                 sliding_avg_pkt_size_ = (sliding_avg_pkt_size_*(sliding_arv_pkts_ - 1) + 8*cm_h->size())
01182                     /(double)sliding_arv_pkts_; 
01183                 last_arrival_ = cur_time;
01184         } else if (action == RESET_STATS) {
01185                 if (trace_hop_) {
01186                         fprintf(hop_trace_, "%f\t", cur_time);
01187                         for (int i=1;i<=NO_CLASSES;i++) {
01188                                 fprintf(hop_trace_, "%.8f\t", max(current_loss_[i],0.00000001));
01189                         }
01190                         for (int i=1;i<=NO_CLASSES;i++) {
01191                                 fprintf(hop_trace_, "%.8f\t", max(sliding_class_delay_[i],0.00000001));
01192                         }
01193                         for (int i=1;i<=NO_CLASSES;i++) {
01194                                 sliding_class_service_rate_[i] = sliding_serviced_bits_[i]/(double)MON_WINDOW_SIZE;
01195                                 fprintf(hop_trace_, "%.0f\t", max(sliding_class_service_rate_[i], 1));
01196                                 sliding_serviced_pkts_[i] = 0;
01197                                 sliding_serviced_bits_[i] = 0;
01198                                 sliding_class_delay_[i] = 0;
01199                                 sliding_class_service_rate_[i] = 0;
01200                         }
01201                         for (int i=1;i<=NO_CLASSES;i++) {
01202                                 fprintf(hop_trace_, "%.0f\t", (double)cls_[i]->length());
01203                         }
01204                         fprintf(hop_trace_, "\n");
01205                 }
01206                 sliding_arv_pkts_ = 1;
01207                 sliding_arv_pkts_c[ip_h->prio()] = 1;
01208                 sliding_inter_ = cur_time - last_arrival_;
01209                 sliding_avg_pkt_size_ = 8*cm_h->size();
01210                 last_arrival_ = cur_time;
01211         }
01212         util_ = sliding_avg_pkt_size_ / (sliding_inter_*link_->bandwidth());
01213         return;
01214 }

Here is the call graph for this function:

template<class T>
double Queue< T >::utilization void   )  [virtual, inherited]
 

Definition at line 130 of file queue.cc.

References Queue< T >::blocked_, Scheduler::clock(), Scheduler::instance(), Queue< T >::last_change_, Queue< T >::old_util_, and Queue< T >::utilUpdate().

Referenced by QSAgent::recv().

00131 {
00132         double now = Scheduler::instance().clock();
00133         
00134         utilUpdate(last_change_, now, blocked_);
00135         last_change_ = now;
00136 
00137         return old_util_;
00138                         
00139 }

Here is the call graph for this function:

template<class T>
void Queue< T >::utilUpdate double  int_begin,
double  int_end,
int  link_state
[protected, inherited]
 

Definition at line 122 of file queue.cc.

References Queue< T >::old_util_, and Queue< T >::util_weight_.

Referenced by Queue< T >::recv(), Queue< T >::resume(), and Queue< T >::utilization().

00122                                                                        {
00123 double decay;
00124 
00125         decay = exp(-util_weight_ * (int_end - int_begin));
00126         old_util_ = link_state + (old_util_ - link_state) * decay;
00127 
00128 }


Member Data Documentation

int JoBS::ABS_present_ [private]
 

Definition at line 185 of file jobs.h.

Referenced by command(), enque(), and JoBS().

double JoBS::ADC_[NO_CLASSES+1] [protected]
 

Definition at line 121 of file jobs.h.

Referenced by assignRateDropsADC(), command(), JoBS(), and minRatesNeeded().

int JoBS::adc_resolution_type_ [protected]
 

Definition at line 105 of file jobs.h.

Referenced by assignRateDropsADC(), and JoBS().

double JoBS::ALC_[NO_CLASSES+1] [protected]
 

Definition at line 122 of file jobs.h.

Referenced by assignRateDropsADC(), command(), enque(), JoBS(), and pickDroppedRLC().

double JoBS::ARC_[NO_CLASSES+1] [protected]
 

Definition at line 123 of file jobs.h.

Referenced by assignRateDropsADC(), command(), and minRatesNeeded().

double JoBS::Arrival_[NO_CLASSES+1] [protected]
 

Definition at line 132 of file jobs.h.

Referenced by arvAccounting(), assignRateDropsADC(), dropFront(), dropTail(), enque(), and pickDroppedRLC().

double JoBS::avg_elapsed_[NO_CLASSES+1] [private]
 

Definition at line 179 of file jobs.h.

Referenced by arvAccounting(), and JoBS().

long JoBS::backlog_Bits_[NO_CLASSES+1] [private]
 

Definition at line 172 of file jobs.h.

Referenced by arvAccounting(), assignRateDropsADC(), deque(), dropFront(), dropTail(), JoBS(), and minRatesNeeded().

long JoBS::backlog_Pkts_[NO_CLASSES+1] [private]
 

Definition at line 173 of file jobs.h.

Referenced by arvAccounting(), deque(), dropFront(), dropTail(), enque(), and JoBS().

template<class T>
int Queue< T >::blocked_ [protected, inherited]
 

Definition at line 143 of file queue.h.

Referenced by Queue< T >::block(), Queue< T >::blocked(), Queue< T >::Queue(), Queue< T >::recv(), FQ::recv(), CBQueue::recv(), PriQueue::recvHighPriority(), Queue< T >::resume(), CBQueue::sched(), Queue< T >::unblock(), and Queue< T >::utilization().

PacketQueue* JoBS::cls_[NO_CLASSES+1] [protected]
 

Definition at line 113 of file jobs.h.

Referenced by adjustRatesRDC(), arvAccounting(), assignRateDropsADC(), deque(), dropFront(), dropTail(), enforceWC(), enque(), JoBS(), minRatesNeeded(), pickDroppedRLC(), projDelay(), updateError(), and updateStats().

int JoBS::concerned_ADC_[NO_CLASSES+1] [protected]
 

Definition at line 116 of file jobs.h.

Referenced by assignRateDropsADC(), command(), and minRatesNeeded().

int JoBS::concerned_ALC_[NO_CLASSES+1] [protected]
 

Definition at line 117 of file jobs.h.

Referenced by command(), and enque().

int JoBS::concerned_ARC_[NO_CLASSES+1] [protected]
 

Definition at line 118 of file jobs.h.

Referenced by assignRateDropsADC(), command(), and minRatesNeeded().

int JoBS::concerned_RDC_[NO_CLASSES+1] [protected]
 

Definition at line 114 of file jobs.h.

Referenced by adjustRatesRDC(), command(), and updateError().

int JoBS::concerned_RLC_[NO_CLASSES+1] [protected]
 

Definition at line 115 of file jobs.h.

Referenced by command(), enque(), and pickDroppedRLC().

double JoBS::current_loss_[NO_CLASSES+1] [protected]
 

Definition at line 128 of file jobs.h.

Referenced by arvAccounting(), assignRateDropsADC(), dropFront(), dropTail(), enque(), JoBS(), pickDroppedRLC(), and updateStats().

int NsObject::debug_ [protected, inherited]
 

Reimplemented in FECModel, FloodAgent, and LandmarkAgent.

Definition at line 66 of file object.h.

Referenced by REDQueue::command(), RedPDQueue::command(), PushbackQueue::command(), NsObject::debug(), NsObject::delay_bind_dispatch(), RedPDQueue::enque(), PushbackQueue::enque(), NsObject::isdebug(), NsObject::NsObject(), TfrcAgent::recv(), PushbackQueue::reportDrop(), and REDQueue::reset().

NsObject* Connector::drop_ [protected, inherited]
 

Definition at line 57 of file connector.h.

Referenced by Connector::command(), Connector::drop(), and ErrorModel::recv().

int JoBS::drop_front_ [protected]
 

Definition at line 103 of file jobs.h.

Referenced by assignRateDropsADC(), enque(), JoBS(), and pickDroppedRLC().

double JoBS::error_[NO_CLASSES+1] [private]
 

Definition at line 174 of file jobs.h.

Referenced by adjustRatesRDC(), JoBS(), and updateError().

double JoBS::excess_drops_[NO_CLASSES+1] [private]
 

Definition at line 180 of file jobs.h.

Referenced by JoBS().

char* JoBS::file_name_ [protected]
 

Definition at line 111 of file jobs.h.

Referenced by command().

template<class T>
QueueElem<T>* Queue< T >::head_ [protected, inherited]
 

Definition at line 416 of file mcache.h.

Referenced by Queue< T >::dequeue(), Queue< T >::destroy(), Queue< T >::detach(), Queue< T >::enqueue(), Queue< T >::getHead(), Queue< T >::Queue(), Queue< T >::reset(), and Queue< T >::~Queue().

FILE* JoBS::hop_trace_ [private]
 

Definition at line 188 of file jobs.h.

Referenced by command(), and updateStats().

int JoBS::idle_ [private]
 

Definition at line 153 of file jobs.h.

Referenced by deque(), enque(), and JoBS().

double JoBS::idletime_ [private]
 

Definition at line 154 of file jobs.h.

Referenced by deque().

double JoBS::Kp_dynamic_ [private]
 

Definition at line 184 of file jobs.h.

Referenced by adjustRatesRDC().

double JoBS::Kp_static_ [private]
 

Definition at line 183 of file jobs.h.

Referenced by adjustRatesRDC(), and command().

double JoBS::last_arrival_ [private]
 

Definition at line 157 of file jobs.h.

Referenced by JoBS(), and updateStats().

template<class T>
double Queue< T >::last_change_ [protected, inherited]
 

Definition at line 154 of file queue.h.

Referenced by Queue< T >::recv(), Queue< T >::resume(), and Queue< T >::utilization().

double JoBS::last_monitor_update_ [private]
 

Definition at line 187 of file jobs.h.

Referenced by enque(), and JoBS().

double JoBS::last_rate_update_[NO_CLASSES+1] [protected]
 

Definition at line 133 of file jobs.h.

Referenced by arvAccounting(), enque(), and JoBS().

double JoBS::last_xmit_[NO_CLASSES+1] [private]
 

Definition at line 171 of file jobs.h.

Referenced by deque(), and JoBS().

LinkDelay* JoBS::link_ [protected]
 

Definition at line 110 of file jobs.h.

Referenced by adjustRatesRDC(), command(), deque(), enforceWC(), and updateStats().

int JoBS::link_id_
 

Definition at line 96 of file jobs.h.

Referenced by command(), and pickDroppedRLC().

double JoBS::loss_prod_others_[NO_CLASSES+1] [protected]
 

Definition at line 125 of file jobs.h.

Referenced by command(), and pickDroppedRLC().

double JoBS::max_drop_[NO_CLASSES+1] [private]
 

Definition at line 177 of file jobs.h.

Referenced by arvAccounting(), and JoBS().

double JoBS::mean_pkt_size_ [protected]
 

Definition at line 102 of file jobs.h.

Referenced by command(), and JoBS().

double JoBS::min_drop_[NO_CLASSES+1] [private]
 

Definition at line 176 of file jobs.h.

Referenced by arvAccounting(), dropFront(), dropTail(), and JoBS().

double JoBS::min_rate_[NO_CLASSES+1] [private]
 

Definition at line 175 of file jobs.h.

Referenced by adjustRatesRDC(), assignRateDropsADC(), JoBS(), and minRatesNeeded().

double JoBS::min_share_ [private]
 

Definition at line 156 of file jobs.h.

Referenced by adjustRatesRDC().

double JoBS::monitoring_window_ [private]
 

Definition at line 186 of file jobs.h.

Referenced by enque(), and JoBS().

template<class T>
double Queue< T >::old_util_ [protected, inherited]
 

Definition at line 155 of file queue.h.

Referenced by Queue< T >::utilization(), and Queue< T >::utilUpdate().

int JoBS::pkt_count_ [private]
 

Definition at line 155 of file jobs.h.

Referenced by enque(), and JoBS().

template<class T>
PacketQueue* Queue< T >::pq_ [protected, inherited]
 

Definition at line 146 of file queue.h.

Referenced by Queue< T >::byteLength(), Vq::command(), REMQueue::command(), REDQueue::command(), PIQueue::command(), GK::command(), DropTail::command(), DropTail::DropTail(), GK::GK(), Queue< T >::length(), SemanticRIOQueue::pickPacketForECN(), SemanticREDQueue::pickPacketForECN(), SemanticRIOQueue::pickPacketToDrop(), SemanticREDQueue::pickPacketToDrop(), PIQueue::PIQueue(), REDQueue::REDQueue(), REMQueue::REMQueue(), and Vq::Vq().

double JoBS::prod_others_[NO_CLASSES+1] [protected]
 

Definition at line 126 of file jobs.h.

Referenced by command(), and updateError().

template<class T>
QueueHandler Queue< T >::qh_ [protected, inherited]
 

Definition at line 145 of file queue.h.

Referenced by Queue< T >::recv(), FQ::recv(), PriQueue::recvHighPriority(), Queue< T >::resume(), and CBQueue::sched().

template<class T>
int Queue< T >::qlim_ [protected, inherited]
 

Definition at line 142 of file queue.h.

Referenced by Vq::checkPacketForECN(), Vq::enque(), SRR::enque(), RIOQueue::enque(), REMQueue::enque(), REDQueue::enque(), PIQueue::enque(), Marker::enque(), enque(), GK::enque(), DropTail::enque(), Demarker::enque(), Queue< T >::limit(), RIOQueue::print_edp(), REDQueue::print_edp(), Queue< T >::Queue(), and PriQueue::recvHighPriority().

double JoBS::RDC_[NO_CLASSES+1] [protected]
 

Definition at line 119 of file jobs.h.

Referenced by command(), and JoBS().

double JoBS::Rin_[NO_CLASSES+1] [protected]
 

Definition at line 129 of file jobs.h.

Referenced by adjustRatesRDC(), arvAccounting(), dropFront(), dropTail(), enque(), and JoBS().

double JoBS::RLC_[NO_CLASSES+1] [protected]
 

Definition at line 120 of file jobs.h.

Referenced by command(), and JoBS().

double JoBS::Rout_[NO_CLASSES+1] [protected]
 

Definition at line 130 of file jobs.h.

Referenced by arvAccounting(), deque(), enque(), and JoBS().

double JoBS::Rout_last_up_[NO_CLASSES+1] [private]
 

Definition at line 178 of file jobs.h.

Referenced by deque(), enque(), and JoBS().

double JoBS::Rout_th_[NO_CLASSES+1] [protected]
 

Definition at line 131 of file jobs.h.

Referenced by arvAccounting(), deque(), enque(), and JoBS().

int JoBS::sampling_period_ [protected]
 

Definition at line 112 of file jobs.h.

Referenced by command(), and enque().

double JoBS::service_rate_[NO_CLASSES+1] [protected]
 

Definition at line 127 of file jobs.h.

Referenced by adjustRatesRDC(), arvAccounting(), assignRateDropsADC(), command(), enforceWC(), enque(), JoBS(), and minRatesNeeded().

int JoBS::shared_buffer_ [protected]
 

Definition at line 108 of file jobs.h.

Referenced by enque(), and JoBS().

template<class T>
int Queue< T >::size_ [protected, inherited]
 

Definition at line 417 of file mcache.h.

Referenced by Queue< T >::dequeue(), Queue< T >::detach(), Queue< T >::enqueue(), Queue< T >::is_empty(), Queue< T >::Queue(), and Queue< T >::size().

double JoBS::sliding_arv_pkts_ [private]
 

Definition at line 162 of file jobs.h.

Referenced by JoBS(), and updateStats().

double JoBS::sliding_arv_pkts_c[NO_CLASSES+1] [private]
 

Definition at line 163 of file jobs.h.

Referenced by JoBS(), and updateStats().

double JoBS::sliding_avg_pkt_size_ [private]
 

Definition at line 161 of file jobs.h.

Referenced by updateStats().

double JoBS::sliding_class_delay_[NO_CLASSES+1] [private]
 

Definition at line 167 of file jobs.h.

Referenced by deque(), JoBS(), and updateStats().

double JoBS::sliding_class_service_rate_[NO_CLASSES+1] [private]
 

Definition at line 166 of file jobs.h.

Referenced by JoBS(), and updateStats().

double JoBS::sliding_inter_ [private]
 

Definition at line 160 of file jobs.h.

Referenced by updateStats().

double JoBS::sliding_serviced_bits_[NO_CLASSES+1] [private]
 

Definition at line 165 of file jobs.h.

Referenced by deque(), JoBS(), and updateStats().

double JoBS::sliding_serviced_pkts_[NO_CLASSES+1] [private]
 

Definition at line 164 of file jobs.h.

Referenced by deque(), JoBS(), and updateStats().

template<class T>
QueueElem<T> * Queue< T >::tail_ [protected, inherited]
 

Definition at line 416 of file mcache.h.

Referenced by Queue< T >::dequeue(), Queue< T >::detach(), Queue< T >::enqueue(), and Queue< T >::Queue().

NsObject* Connector::target_ [protected, inherited]
 

Definition at line 56 of file connector.h.

Referenced by SRAgent::command(), SA_Agent::command(), IvsReceiver::command(), MultiFieldFilter::command(), Filter::command(), Connector::command(), DiffusionAgent::DiffusionAgent(), DSRAgent::DSRAgent(), PromotionTimer::expire(), FloodingAgent::FloodingAgent(), toraAgent::forward(), AODV::forward(), LandmarkAgent::ForwardPacket(), DSDV_Agent::forwardPacket(), SensorQueryAgent::generate_query(), DSDVTriggerHandler::handle(), AckRecons::handle(), DSRAgent::handlePacketReceipt(), DSDV_Agent::helper_callback(), AODV::initialized(), DSDV_Agent::lost_link(), OmniMcastAgent::OmniMcastAgent(), LandmarkAgent::periodic_callback(), LandmarkAgent::ProcessHierUpdate(), TCPTapAgent::processpkt(), IPTapAgent::processpkt(), CMUPriQueue::prq_enqueue(), CMUPriQueue::prq_resume(), DequeTrace::recv(), Trace::recv(), TraceIpMac::recv(), TraceIp::recv(), TBF::recv(), SRMAgent::recv(), SSMSRMAgent::recv(), SatDequeTrace::recv(), SAack_Agent::recv(), Queue< T >::recv(), PingResponder::recv(), MIPEncapsulator::recv(), LmsAgent::recv(), HackLossyLink::recv(), GAFPartner::recv(), FQ::recv(), FloodAgent::recv(), ErrorModel::recv(), DynamicLink::recv(), DumbAgent::recv(), DSRAgent::recv(), DelayModel::recv(), LinkDelay::recv(), CtrMcastDecap::recv(), CtrMcastEncap::recv(), CMUTrace::recv(), PriQueue::recvHighPriority(), Trace::recvOnly(), TapAgent::recvpkt(), Queue< T >::resume(), LinkDelay::send(), Connector::send(), Agent::send(), MIPBSAgent::send_ads(), SRMAgent::send_ctrl(), SSMSRMAgent::send_ctrl(), MFTPSndAgent::send_data(), LmsSender::send_dmcast(), LmsReceiver::send_dmcast(), LmsAgent::send_downstream(), SSMSRMAgent::send_glb_sess(), LmsSender::send_lms_pkt(), SSMSRMAgent::send_loc_sess(), MFTPRcvAgent::send_nak(), LmsReceiver::send_nak(), LmsReceiver::send_refresh(), SSMSRMAgent::send_rep_sess(), SRMAgent::send_sess(), MIPMHAgent::send_sols(), LmsSender::send_spm(), MFTPSndAgent::send_status_request(), LmsAgent::send_upstream(), LandmarkAgent::SendChangedTagListUpdate(), AODV::sendError(), AODV::sendHello(), UdpAgent::sendmsg(), SRMAgent::sendmsg(), SA_Agent::sendmsg(), RTPAgent::sendmsg(), LmsSender::sendmsg(), DSDV_Agent::sendOutBCastPkt(), SA_Agent::sendpkt(), rtProtoDV::sendpkt(), RTPAgent::sendpkt(), RTCPAgent::sendpkt(), IvsSource::sendpkt(), AODV::sendReply(), AODV::sendRequest(), LmsSender::solicit_naks(), Connector::target(), TBF::timeout(), and toraAgent::tora_output().

long JoBS::total_backlog_Bits_ [protected]
 

Definition at line 101 of file jobs.h.

Referenced by arvAccounting(), deque(), dropFront(), dropTail(), and JoBS().

long JoBS::total_backlog_Pkts_ [protected]
 

Definition at line 100 of file jobs.h.

Referenced by arvAccounting(), deque(), dropFront(), dropTail(), enque(), and JoBS().

template<class T>
double Queue< T >::total_time_ [protected, inherited]
 

Definition at line 150 of file queue.h.

Referenced by REDQueue::print_summarystats(), DropTail::print_summarystats(), Queue< T >::reset(), and Queue< T >::updateStats().

int JoBS::trace_hop_ [protected]
 

Definition at line 104 of file jobs.h.

Referenced by command(), JoBS(), and updateStats().

template<class T>
double Queue< T >::true_ave_ [protected, inherited]
 

Definition at line 149 of file queue.h.

Referenced by REDQueue::print_summarystats(), DropTail::print_summarystats(), Queue< T >::reset(), and Queue< T >::updateStats().

template<class T>
int Queue< T >::unblock_on_resume_ [protected, inherited]
 

Definition at line 144 of file queue.h.

Referenced by Queue< T >::Queue(), and Queue< T >::resume().

double JoBS::util_ [private]
 

Definition at line 182 of file jobs.h.

Referenced by adjustRatesRDC(), JoBS(), and updateStats().

template<class T>
double Queue< T >::util_weight_ [protected, inherited]
 

Definition at line 156 of file queue.h.

Referenced by Queue< T >::Queue(), and Queue< T >::utilUpdate().


The documentation for this class was generated from the following files:
Generated on Tue Apr 20 12:54:27 2004 for NS2.26SourcesOriginal by doxygen 1.3.3