12.07.2015 Views

The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ...

The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ...

The ns Manual (formerly ns Notes and Documentation)1 - NM Lab at ...

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>The</strong> following functio<strong>ns</strong>, init-monitor <strong>and</strong> <strong>at</strong>tach-monitor, are used to cre<strong>at</strong>e a set of objects used to monitor queuesizes of a queue associ<strong>at</strong>ed with a link. <strong>The</strong>y are defined as follows:SimpleLink i<strong>ns</strong>tproc <strong>at</strong>tach-monitors { i<strong>ns</strong>noop outsnoop dropsnoop qmon } {$self i<strong>ns</strong>tvar queue_ head_ snoopIn_ snoopOut_ snoopDrop_$self i<strong>ns</strong>tvar drophead_ qMonitor_set snoopIn_ $i<strong>ns</strong>noopset snoopOut_ $outsnoopset snoopDrop_ $dropsnoop$snoopIn_ target $head_set head_ $snoopIn_$snoopOut_ target [$queue_ target]$queue_ target $snoopOut_$snoopDrop_ target [$drophead_ target]$drophead_ target $snoopDrop_}$snoopIn_ set-monitor $qmon$snoopOut_ set-monitor $qmon$snoopDrop_ set-monitor $qmo<strong>ns</strong>et qMonitor_ $qmon## I<strong>ns</strong>ert objects th<strong>at</strong> allow us to monitor the queue size# of this link. Return the name of the object th<strong>at</strong># can be queried to determine the average queue size.#SimpleLink i<strong>ns</strong>tproc init-monitor { <strong>ns</strong> qtrace sampleInterval} {$self i<strong>ns</strong>tvar qMonitor_ <strong>ns</strong>_ qtrace_ sampleInterval_set <strong>ns</strong>_ $<strong>ns</strong>set qtrace_ $qtraceset sampleInterval_ $sampleIntervalset qMonitor_ [new QueueMonitor]$self <strong>at</strong>tach-monitors [new SnoopQueue/In] \[new SnoopQueue/Out] [new SnoopQueue/Drop] $qMonitor_}set bytesInt_ [new Integr<strong>at</strong>or]$qMonitor_ set-bytes-integr<strong>at</strong>or $bytesInt_set pktsInt_ [new Integr<strong>at</strong>or]$qMonitor_ set-pkts-integr<strong>at</strong>or $pktsInt_return $qMonitor_<strong>The</strong>se functio<strong>ns</strong> establish queue monitoring on the SimpleLink object in the simul<strong>at</strong>or <strong>ns</strong>. Queue monitoring is implementedby co<strong>ns</strong>tructing three SnoopQueue objects <strong>and</strong> one QueueMonitor object. <strong>The</strong> SnoopQueue objects arelinked in around a Queue in a way similar to Trace objects. <strong>The</strong> SnoopQueue/In(Out) object monitors packet arrivals(departures)<strong>and</strong> reports them to an associ<strong>at</strong>ed QueueMonitor agent. In addition, a SnoopQueue/Out object is233

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!