

Public Member Functions | |
| RA_Traffic () | |
| int | loadCDF (const char *filename) |
| int | lookup (double u) |
| virtual double | value () |
| virtual double | interpolate (double u, double x1, double y1, double x2, double y2) |
| virtual double | next_interval (int &) |
| virtual double | interval () |
| virtual int | on () |
| virtual void | timeout () |
| virtual void | recv () |
| virtual void | recv (int nbytes) |
| virtual void | resume () |
| virtual void | send (int nbytes) |
| Process *& | target () |
| virtual void | process_data (int size, AppData *data) |
| virtual AppData * | get_data (int &size, AppData *req_data=0) |
| virtual void | send_data (int size, AppData *data=0) |
Protected Member Functions | |
| void | init () |
| virtual void | start () |
| virtual void | stop () |
| virtual int | command (int argc, const char *const *argv) |
Protected Attributes | |
| double | ontime_ |
| double | offtime_ |
| double | rate_ |
| double | interval_ |
| double | burstlen_ |
| unsigned int | rem_ |
| double | minCDF_ |
| double | maxCDF_ |
| int | interpolation_ |
| int | numEntry_ |
| int | maxEntry_ |
| CDFentry * | table_ |
| RNG * | rng_ |
| double | nextPkttime_ |
| int | size_ |
| int | running_ |
| TrafficTimer | timer_ |
| Agent * | agent_ |
| int | enableRecv_ |
| int | enableResume_ |
| Process * | target_ |
|
|
Definition at line 81 of file realaudio.cc. References RNG::defaultrng(), interpolation_, maxCDF_, maxEntry_, minCDF_, offtime_, ontime_, rate_, rng_, and TrafficGenerator::size_.
00081 : minCDF_(0), maxCDF_(1), maxEntry_(32), table_(0) 00082 { 00083 bind("minCDF_", &minCDF_); 00084 bind("maxCDF_", &maxCDF_); 00085 bind("interpolation_", &interpolation_); 00086 bind("maxEntry_", &maxEntry_); 00087 bind_time("burst_time_", &ontime_); 00088 bind_time("idle_time_", &offtime_); 00089 bind_bw("rate_", &rate_); 00090 bind("packetSize_", &size_); 00091 00092 rng_ = RNG::defaultrng(); 00093 } |
Here is the call graph for this function:

|
||||||||||||
|
Reimplemented from Process. Reimplemented in MediaApp, QA, EXPOO_Traffic, POO_Traffic, TrafficTrace, HttpUInvalAgent, and TcpApp. Definition at line 56 of file app.cc. References Application::agent_, Agent::attachApp(), Process::command(), Application::enableRecv_, Application::enableResume_, Application::send(), Application::start(), and Application::stop(). Referenced by TrafficTrace::command(), TcpApp::command(), POO_Traffic::command(), MediaApp::command(), and EXPOO_Traffic::command().
00057 {
00058 Tcl& tcl = Tcl::instance();
00059
00060 if (argc == 2) {
00061 if (strcmp(argv[1], "start") == 0) {
00062 // enableRecv_ only if recv() exists in Tcl
00063 tcl.evalf("[%s info class] info instprocs", name_);
00064 char result[1024];
00065 sprintf(result, " %s ", tcl.result());
00066 enableRecv_ = (strstr(result, " recv ") != 0);
00067 enableResume_ = (strstr(result, " resume ") != 0);
00068 start();
00069 return (TCL_OK);
00070 }
00071 if (strcmp(argv[1], "stop") == 0) {
00072 stop();
00073 return (TCL_OK);
00074 }
00075 if (strcmp(argv[1], "agent") == 0) {
00076 tcl.resultf("%s", agent_->name());
00077 return (TCL_OK);
00078 }
00079 }
00080 else if (argc == 3) {
00081 if (strcmp(argv[1], "attach-agent") == 0) {
00082 agent_ = (Agent*) TclObject::lookup(argv[2]);
00083 if (agent_ == 0) {
00084 tcl.resultf("no such agent %s", argv[2]);
00085 return(TCL_ERROR);
00086 }
00087 agent_->attachApp(this);
00088 return(TCL_OK);
00089 }
00090 if (strcmp(argv[1], "send") == 0) {
00091 send(atoi(argv[2]));
00092 return(TCL_OK);
00093 }
00094 }
00095 return (Process::command(argc, argv));
00096 }
|
Here is the call graph for this function:

|
||||||||||||
|
Reimplemented in MediaApp, QA, HttpApp, HttpUInvalAgent, MediaCache, MediaServer, and TcpApp. Definition at line 46 of file ns-process.cc. References abort(). Referenced by QA::check_availability(), MediaApp::get_data(), RapAgent::IpgTimeout(), and QA::output().
00047 {
00048 abort();
00049 /* NOTREACHED */
00050 return NULL; // Make msvc happy
00051 }
|
Here is the call graph for this function:

|
|
Reimplemented from TrafficGenerator. Definition at line 95 of file realaudio.cc. References Application::agent_, burstlen_, interval_, loadCDF(), offtime_, ontime_, PT_REALAUDIO, rate_, rem_, Agent::set_pkttype(), and TrafficGenerator::size_.
00096 {
00097 int res = loadCDF("offtimecdf");
00098 // int res1 = Ontime_.loadCDF("ontimecdf");
00099 timeval tv;
00100 gettimeofday(&tv, 0);
00101
00102 if (res < 0) printf("error:unable to load offtimecdf");
00103
00104 interval_ = ontime_ ;
00105 burstlen_ = (double) ( rate_ * (ontime_ + offtime_))/ (double)(size_ << 3);
00106 rem_ = 0;
00107 if (agent_)
00108 agent_->set_pkttype(PT_REALAUDIO);
00109 }
|
Here is the call graph for this function:

|
||||||||||||||||||||||||
|
Definition at line 190 of file realaudio.cc. References INTER_INTEGRAL, interpolation_, and value(). Referenced by value().
00191 {
00192 double value = y1 + (x - x1) * (y2 - y1) / (x2 - x1);
00193 if (interpolation_ == INTER_INTEGRAL) // round up
00194 return ceil(value);
00195 return value;
00196 }
|
Here is the call graph for this function:

|
|
Reimplemented in CBR_PP_Traffic, and CBR_Traffic. Definition at line 63 of file trafgen.h. Referenced by SA_Agent::sendpkt().
00063 { return 0; }
|
|
|
Definition at line 150 of file realaudio.cc. References CDFentry::cdf_, maxEntry_, numEntry_, table_, and CDFentry::val_. Referenced by init().
00151 {
00152 FILE* fp;
00153 char line[256];
00154 CDFentry* e;
00155
00156 fp = fopen(filename, "r");
00157 if (fp == 0)
00158 return 0;
00159
00160 if (table_ == 0)
00161 table_ = new CDFentry[maxEntry_];
00162 for (numEntry_=0; fgets(line, 256, fp); numEntry_++) {
00163 if (numEntry_ >= maxEntry_) { // resize the CDF table
00164 maxEntry_ *= 2;
00165 e = new CDFentry[maxEntry_];
00166 for (int i=numEntry_-1; i >= 0; i--)
00167 e[i] = table_[i];
00168 delete table_;
00169 table_ = e;
00170 }
00171 e = &table_[numEntry_];
00172 // Use * and l together raises a warning
00173 sscanf(line, "%lf %*f %lf", &e->val_, &e->cdf_);
00174 }
00175 return numEntry_;
00176 }
|
|
|
Definition at line 198 of file realaudio.cc. References CDFentry::cdf_, numEntry_, and table_. Referenced by value().
00199 {
00200 // always return an index whose value is >= u
00201 int lo, hi, mid;
00202 if (u <= table_[0].cdf_)
00203 return 0;
00204 for (lo=1, hi=numEntry_-1; lo < hi; ) {
00205 mid = (lo + hi) / 2;
00206 if (u > table_[mid].cdf_)
00207 lo = mid + 1;
00208 else hi = mid;
00209 }
00210 return lo;
00211 }
|
|
|
Implements TrafficGenerator. Definition at line 111 of file realaudio.cc. References burstlen_, offtime_, ontime_, rate_, rem_, TrafficGenerator::size_, and value().
00112 {
00113 // double t = Ontime_.value() ;
00114 double o = value() ; //off-time is taken from CDF
00115
00116 double t = ontime_ ; //fixed on-time
00117 // double o = offtime_ ;
00118
00119 // o = o * ran ;
00120
00121 if (rem_ == 0) {
00122 /* compute number of packets in next burst */
00123 rem_ = int(burstlen_ + .5);
00124
00125 //recalculate the number of packet sent during ON-period if
00126 // off-time is mutliple of 1.8s
00127 if (o > offtime_ ) {
00128 double b =
00129 // (double) ( rate_ * (ontime_ + o))/ (double)(size_ << 3);
00130 (double) ( rate_ * (t + o))/ (double)(size_ << 3);
00131 rem_ = int(b);
00132 }
00133
00134 // if (ran > 0.8 ) rem_++ ;
00135 // if (ran < 0.2 ) rem_-- ;
00136
00137 /* make sure we got at least 1 */
00138 if (rem_<= 0)
00139 rem_ = 1;
00140 /* start of an idle period, compute idle time */
00141 t += o ;
00142 }
00143 rem_--;
00144
00145 size = size_;
00146 return(t);
00147
00148 }
|
Here is the call graph for this function:

|
|
Reimplemented in POO_Traffic. Definition at line 64 of file trafgen.h. Referenced by SA_Agent::stoponidle(), and SA_Agent::timeout().
00064 { return 0; }
|
|
||||||||||||
|
Reimplemented in MediaApp, HttpApp, HttpMInvalCache, HttpUInvalAgent, MediaCache, MediaClient, and TcpApp. Definition at line 41 of file ns-process.cc. References abort(). Referenced by HttpUInvalAgent::process_data(), UdpAgent::recv(), RapAgent::recv(), and Process::send_data().
00042 {
00043 abort();
00044 }
|
Here is the call graph for this function:

|
|
Reimplemented in TcpApp. Definition at line 115 of file app.cc. References Application::enableRecv_. Referenced by SimpleTcpAgent::recv(), Agent::recv(), and Agent::recvBytes().
00116 {
00117 if (! enableRecv_)
00118 return;
00119 Tcl& tcl = Tcl::instance();
00120 tcl.evalf("%s recv %d", name_, nbytes);
00121 }
|
|
|
Definition at line 67 of file trafgen.h.
00067 {}
|
|
|
Reimplemented from Application. Definition at line 68 of file trafgen.h.
00068 {}
|
|
|
Definition at line 109 of file app.cc. References Application::agent_, and Agent::sendmsg(). Referenced by Application::command(), TcpApp::send(), and TrafficGenerator::timeout().
|
Here is the call graph for this function:

|
||||||||||||
|
Definition at line 106 of file ns-process.h. References Process::process_data(), and Process::target_. Referenced by TcpApp::process_data(), and MediaApp::process_data().
00106 {
00107 if (target_)
00108 target_->process_data(size, data);
00109 }
|
Here is the call graph for this function:

|
|
Reimplemented from Application. Reimplemented in CBR_PP_Traffic, and CBR_Traffic. Definition at line 49 of file trafgen.cc. References TrafficGenerator::init(), TrafficGenerator::next_interval(), TrafficGenerator::nextPkttime_, TimerHandler::resched(), TrafficGenerator::running_, TrafficGenerator::size_, and TrafficGenerator::timer_.
00050 {
00051 init();
00052 running_ = 1;
00053 nextPkttime_ = next_interval(size_);
00054 timer_.resched(nextPkttime_);
00055 // Enable line below if you want to send immediately upon start
00056 //timeout();
00057 }
|
Here is the call graph for this function:

|
|
Reimplemented from Application. Definition at line 60 of file trafgen.cc. References TimerHandler::cancel(), TrafficGenerator::running_, and TrafficGenerator::timer_.
|
Here is the call graph for this function:

|
|
Definition at line 97 of file ns-process.h. References Process::target_. Referenced by QA::check_availability(), Process::command(), HttpApp::command(), MediaApp::get_data(), QA::output(), and TcpApp::process_data().
00097 { return target_; }
|
|
|
Reimplemented in CBR_PP_Traffic, EXPOO_Traffic, and TrafficTrace. Definition at line 68 of file trafgen.cc. References TrafficGenerator::next_interval(), TrafficGenerator::nextPkttime_, TimerHandler::resched(), TrafficGenerator::running_, Application::send(), TrafficGenerator::size_, and TrafficGenerator::timer_. Referenced by TrafficTimer::expire(), and CBR_Traffic::start().
00069 {
00070 if (! running_)
00071 return;
00072
00073 /* send a packet */
00074 send(size_);
00075 /* figure out when to send the next one */
00076 nextPkttime_ = next_interval(size_);
00077 /* schedule it */
00078 if (nextPkttime_ > 0)
00079 timer_.resched(nextPkttime_);
00080 else
00081 running_ = 0;
00082 }
|
Here is the call graph for this function:

|
|
Definition at line 178 of file realaudio.cc. References CDFentry::cdf_, interpolate(), interpolation_, lookup(), maxCDF_, minCDF_, numEntry_, rng_, table_, and RNG::uniform(). Referenced by interpolate(), and next_interval().
00179 {
00180 if (numEntry_ <= 0)
00181 return 0;
00182 double u = rng_->uniform(minCDF_, maxCDF_);
00183 int mid = lookup(u);
00184 if (mid && interpolation_ && u < table_[mid].cdf_)
00185 return interpolate(u, table_[mid-1].cdf_, table_[mid-1].val_,
00186 table_[mid].cdf_, table_[mid].val_);
00187 return table_[mid].val_;
00188 }
|
Here is the call graph for this function:

|
|
Definition at line 60 of file app.h. Referenced by Application::command(), init(), POO_Traffic::init(), EXPOO_Traffic::init(), CBR_Traffic::init(), CBR_PP_Traffic::init(), QA::rap(), MediaApp::rap(), Application::send(), TcpApp::TcpApp(), TrafficTrace::timeout(), TelnetApp::timeout(), EXPOO_Traffic::timeout(), CBR_PP_Traffic::timeout(), and TcpApp::~TcpApp(). |
|
|
Definition at line 58 of file realaudio.cc. Referenced by init(), and next_interval(). |
|
|
Definition at line 61 of file app.h. Referenced by Application::command(), and Application::recv(). |
|
|
Definition at line 62 of file app.h. Referenced by Application::command(), and Application::resume(). |
|
|
Definition at line 62 of file realaudio.cc. Referenced by interpolate(), RA_Traffic(), and value(). |
|
|
Definition at line 57 of file realaudio.cc. Referenced by init(). |
|
|
Definition at line 61 of file realaudio.cc. Referenced by RA_Traffic(), and value(). |
|
|
Definition at line 64 of file realaudio.cc. Referenced by loadCDF(), and RA_Traffic(). |
|
|
Definition at line 60 of file realaudio.cc. Referenced by RA_Traffic(), and value(). |
|
|
Definition at line 74 of file trafgen.h. Referenced by TrafficGenerator::start(), TrafficGenerator::timeout(), TrafficTrace::timeout(), EXPOO_Traffic::timeout(), and CBR_PP_Traffic::timeout(). |
|
|
Definition at line 63 of file realaudio.cc. |
|
|
Definition at line 55 of file realaudio.cc. Referenced by init(), next_interval(), and RA_Traffic(). |
|
|
Definition at line 54 of file realaudio.cc. Referenced by init(), next_interval(), and RA_Traffic(). |
|
|
Definition at line 56 of file realaudio.cc. Referenced by init(), next_interval(), and RA_Traffic(). |
|
|
Definition at line 59 of file realaudio.cc. Referenced by init(), and next_interval(). |
|
|
Definition at line 66 of file realaudio.cc. Referenced by RA_Traffic(), and value(). |
|
|
Definition at line 76 of file trafgen.h. Referenced by TrafficGenerator::start(), CBR_Traffic::start(), CBR_PP_Traffic::start(), TrafficGenerator::stop(), TrafficGenerator::timeout(), TrafficTrace::timeout(), EXPOO_Traffic::timeout(), and CBR_PP_Traffic::timeout(). |
|
|
|
Definition at line 65 of file realaudio.cc. |
|
|
Definition at line 113 of file ns-process.h. Referenced by HttpUInvalAgent::command(), Process::Process(), HttpUInvalAgent::process_data(), Process::send_data(), and Process::target(). |
|
|
Definition at line 77 of file trafgen.h. Referenced by TrafficGenerator::start(), TrafficGenerator::stop(), TrafficGenerator::timeout(), TrafficTrace::timeout(), EXPOO_Traffic::timeout(), and CBR_PP_Traffic::timeout(). |
1.3.3