[ns] deque function of MyQueue class NOT being called
Parag Kulkarni
kulkarniparag at gmail.com
Fri Apr 1 11:18:32 PST 2005
Dear ns-users,
I wrote my new Active Queue Management scheme (MyQueue). I did
the following
- added myqueue.cc and myqueue.h under ns-2.27/queue/
- added myqueue.o in Makefile
- added default values for the variables in tcl/lib/ns-default.tcl
I am logging debug info in C++. The code runs ok except that
myqueue->deque() function is called only once on the arrival of the
first packet. It is never called thereafter. The simulation runs to
the end and the queue basically behaves like drop tail (since deque is
not being called more than once, the queue size reaches max value and
behaves like a droptail queue)
Simulation Topology --> n sources sending to a bottleneck router which
in turn forwards it to a traffic sink.
My deque functions looks like this
Packet* MyQueue::deque() {
double now = Scheduler::instance().clock();
Packet *p = q_->deque();
hdr_cmn* ch;
if (p != 0) {
ch = hdr_cmn::access(p);
int pklen = 8*ch->size(); // pklen in bits
qlen_bits_ -= pklen; // decrement qlen_bits
q_len_ -= 1; // decrement qlen in pkts
if(q_len_<0)
q_len_=0;
// compute average queue length
ave_q_len_ = (1-qw_)*ave_q_len_+ qw_*q_len_;
total_bits_sent_ += pklen;
total_pkts_sent_ += 1;
}
// to compute link-utilisation
if(total_pkts_sent_ == 1) {
// this is when the first pkt is being sent
start_time_ = now; // set start time to now.
total_bits_sent_= 0; // reset total_bits_sent to 0
}
else {
link_utilisation_ = total_bits_sent_ /
((now-start_time_)*link_bw_);
}
return (p);
}// end of function MyQueue:deque()
I already read chapter7 from the ns manual which talks about blocking
unblocking. Checked out the deque of other queueing strategies
(DropTail / RED) and my deque function looks more or less the same.
Have checked the archives too but no luck. Can anybody please help me
out with this problem as to why deque is NOT being called. Any
pointers will be appreciated.
Thanks a lot in advance.
Parag
More information about the Ns-users
mailing list