00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052 #ifndef JOBS_H
00053 #define JOBS_H
00054
00055 #include <stdlib.h>
00056 #include <string.h>
00057 #include <math.h>
00058 #include "queue.h"
00059 #include "template.h"
00060 #include "random.h"
00061 #include "flags.h"
00062 #include "delay.h"
00063 #include "marker.h"
00064
00065
00066 #ifndef INFINITY
00067 # ifdef __SUNPRO_CC
00068 # include <values.h>
00069 # define INFINITY MAXDOUBLE
00070 # else
00071 # define INFINITY +1.0e499
00072 # endif
00073 #endif
00074 #define PRECISION_ERROR +1.0e-10
00075 #define TOL 0.02 // Tolerance in the constraints (2%)
00076 #define MON_WINDOW_SIZE 0.5 // Size of the moving average window
00077 #define RESET_STATS 0
00078 #define UPDATE_STATS 1
00079
00080
00081 #define WITH_UPDATE 3
00082 #define WITHOUT_UPDATE 4
00083
00084
00085 #define ORIGINAL_JOBS 0
00086 #define SHARED_PAIN 1
00087
00088 #define RESOLVE_OVERFLOW 0
00089 #define RESOLVE_ADC 1
00090
00091
00092 #define min(x, y) ((x) < (y) ? (x) : (y))
00093 #define max(x, y) ((x) >= (y) ? (x) : (y))
00094
00095
00096 class JoBS : public Queue {
00097
00098 public:
00099 JoBS();
00100 virtual int command(int argc, const char*const* argv);
00101 void enque(Packet*);
00102 Packet* deque();
00103 int link_id_;
00104
00105 protected:
00106
00107 long total_backlog_Pkts_;
00108 long total_backlog_Bits_;
00109 double mean_pkt_size_;
00110 int drop_front_;
00111 int trace_hop_;
00112 int adc_resolution_type_;
00113
00114
00115 int shared_buffer_;
00116
00117 LinkDelay* link_;
00118 char* file_name_;
00119 int sampling_period_;
00120 PacketQueue* cls_[NO_CLASSES+1];
00121 int concerned_RDC_[NO_CLASSES+1];
00122 int concerned_RLC_[NO_CLASSES+1];
00123 int concerned_ADC_[NO_CLASSES+1];
00124 int concerned_ALC_[NO_CLASSES+1];
00125 int concerned_ARC_[NO_CLASSES+1];
00126 double RDC_[NO_CLASSES+1];
00127 double RLC_[NO_CLASSES+1];
00128 double ADC_[NO_CLASSES+1];
00129 double ALC_[NO_CLASSES+1];
00130 double ARC_[NO_CLASSES+1];
00131
00132 double loss_prod_others_[NO_CLASSES+1];
00133 double prod_others_ [NO_CLASSES+1];
00134 double service_rate_[NO_CLASSES+1];
00135 double current_loss_[NO_CLASSES+1];
00136 double Rin_ [NO_CLASSES+1];
00137 double Rout_ [NO_CLASSES+1];
00138 double Rout_th_ [NO_CLASSES+1];
00139 double Arrival_ [NO_CLASSES+1];
00140 double last_rate_update_[NO_CLASSES+1];
00141
00142 private:
00143
00144
00145
00146 void updateError();
00147 double projDelay(int);
00148 double* assignRateDropsADC();
00149 double* adjustRatesRDC();
00150 int minRatesNeeded(int);
00151 void arvAccounting(Packet*);
00152 int pickDroppedRLC(int);
00153 void dropTail(int, int);
00154 void dropFront(int, int);
00155 int enforceWC();
00156 void updateStats(Packet*, int);
00157
00158
00159
00160 int idle_;
00161 double idletime_;
00162 int pkt_count_;
00163 double min_share_;
00164 double last_arrival_;
00165
00166
00167 double sliding_inter_;
00168 double sliding_avg_pkt_size_;
00169 double sliding_arv_pkts_;
00170 double sliding_arv_pkts_c[NO_CLASSES+1];
00171 double sliding_serviced_pkts_[NO_CLASSES+1];
00172 double sliding_serviced_bits_[NO_CLASSES+1];
00173 double sliding_class_service_rate_[NO_CLASSES+1];
00174 double sliding_class_delay_[NO_CLASSES+1];
00175
00176
00177
00178 double last_xmit_[NO_CLASSES+1];
00179 long backlog_Bits_ [NO_CLASSES+1];
00180 long backlog_Pkts_ [NO_CLASSES+1];
00181 double error_ [NO_CLASSES+1];
00182 double min_rate_ [NO_CLASSES+1];
00183 double min_drop_ [NO_CLASSES+1];
00184 double max_drop_ [NO_CLASSES+1];
00185 double Rout_last_up_ [NO_CLASSES+1];
00186 double avg_elapsed_ [NO_CLASSES+1];
00187 double excess_drops_ [NO_CLASSES+1];
00188
00189 double util_;
00190 double Kp_static_;
00191 double Kp_dynamic_;
00192 int ABS_present_;
00193 double monitoring_window_;
00194 double last_monitor_update_;
00195 FILE* hop_trace_;
00196 };
00197
00198 #endif
00199