J-Sim v1.2.1-p7 API

drcl.inet.core.queue
Class RED

java.lang.Object
  extended bydrcl.DrclObj
      extended bydrcl.comp.queue.QLogic
          extended bydrcl.inet.core.queue.RED
All Implemented Interfaces:
java.lang.Cloneable, ObjectDuplicable, java.io.Serializable
Direct Known Subclasses:
FRED

public class RED
extends QLogic

The Random Early Detection (RED) queue logic.

See Also:
Serialized Form

Field Summary
protected  Port avgQSizePort
          Port to output average queue size change event
protected  double bw
          Link bandwidth (bps), for computing ptc.
protected  long count
          # of packets since last early drop.
protected static java.lang.String DTYPE_FORCED
           
protected static java.lang.String DTYPE_NONE
           
protected static java.lang.String DTYPE_UNFORCED
           
static java.lang.String EVENT_AVG_QSIZE
          Name of the average queue size change event.
protected  double idletime
          Start of the current idle period.
protected  boolean mark
          The mark flag, true for marking CE bit instead of early dropping.
protected  double max_p
          Maximum dropping probability.
protected  int mean_pktsize
          Mean packet size (byte), for computing ptc.
protected  int old
          0 when average queue first exceeds thresh.
protected  double ptc
          Output rate of the link in packets/second.
protected  double qavg
          Computed average queue size.
protected  double qw
          Weight for computing average queue size given to current queue size sample.
static boolean RED_EWMA
           
static boolean RED_HOLT_WINTERS
           
protected  double th_max
          Maximum threshold of average queue size.
protected  double th_min
          Minimum threshold of average queue size.
protected  RandomNumberGenerator ug
          The random number generator used in this RED.
protected  double v_a
          For computing dropping probability (=max_p*(qavg - min_th)/(max_th-min_th) = v_a * qavg + v_b).
protected  double v_b
          For computing dropping probability (=max_p*(qavg - min_th)/(max_th-min_th) = v_a * qavg + v_b).
protected  double v_prob
          Computed dropping probability for the incoming packet, for diagnosis purpose.
protected  double v_slope
          Variable used in HOLT WINTERS filter for computing average queue size.
protected  boolean wait
          The wait flag, true for waiting between dropped packets.
 
Fields inherited from class drcl.comp.queue.QLogic
capacity, DEFAULT_ADVICE, EVENT_QSIZE, host, qlen, qsize, qSizePort
 
Constructor Summary
RED()
           
RED(Component host_, java.lang.String avgpid_)
           
RED(Component host_, java.lang.String avgpid_, java.lang.String qpid_)
           
 
Method Summary
 java.lang.String adviceOn(java.lang.Object obj_, int psize_)
          Returns advice (in String) on whether or not to drop the packet.
 void dequeueHandler(java.lang.Object obj_, int psize_)
          Handles the event of dequeuing the object of the given size.
protected  boolean drop_early(Packet pkt_)
           
 void duplicate(java.lang.Object source_)
          Duplicates the content of the source object to this object.
protected  java.lang.String edv_print(java.lang.String prefix_)
           
 void enqueueHandler(java.lang.Object obj_, int psize_)
          Handles the event of enqueuing the object of the given size.
 double getBandwidth()
           
 double getInvProb()
           
 double getMaxThresh()
           
 int getMeanPacketSize()
           
 double getMinThresh()
           
 long getSeed()
           
 double getWeight()
           
 java.lang.String info(java.lang.String prefix_)
          Prints the content (states) of this queue management instance.
 boolean isMarkEnabled()
           
 boolean isWait()
           
 void reset()
          Resets this object to the initial state.
protected  void run_estimator(boolean advice_)
          Computes the average queue size.
 void setAvgQSizePort(java.lang.String avgqspid_)
           
 void setBandwidth(double bw_)
           
 void setInvProb(double value)
           
 void setMarkEnabled(boolean enabled_)
          If enabled, RED marks the congestion bit of, instead of advising to drop, packets.
 void setMaxThresh(double max)
           
 void setMeanPacketSize(int size_)
           
 void setMinThresh(double min)
           
 void setRandomNumberGenerator(RandomNumberGenerator ug_)
           
 void setRandomNumberGenerator(RandomNumberGenerator ug_, long seed_)
           
 void setREDParam(int psize_, double bw_, double th_max_, double th_min_, double inv_max_p_, double qw_)
          Sets up all RED parameters.
 void setSeed(long seed_)
           
 void setWait(boolean enabled_)
           
 void setWeight(double weight)
           
 
Methods inherited from class drcl.comp.queue.QLogic
dropHandler, getCapacity, getCurrentQLength, getCurrentQSize, getHost, info, isEmpty, isFull, set, setCapacity, setHost, setQSizePort
 
Methods inherited from class drcl.DrclObj
clone, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

RED_EWMA

public static boolean RED_EWMA

RED_HOLT_WINTERS

public static boolean RED_HOLT_WINTERS

DTYPE_NONE

protected static final java.lang.String DTYPE_NONE

DTYPE_FORCED

protected static final java.lang.String DTYPE_FORCED
See Also:
Constant Field Values

DTYPE_UNFORCED

protected static final java.lang.String DTYPE_UNFORCED
See Also:
Constant Field Values

EVENT_AVG_QSIZE

public static final java.lang.String EVENT_AVG_QSIZE
Name of the average queue size change event.

See Also:
Constant Field Values

avgQSizePort

protected Port avgQSizePort
Port to output average queue size change event


mean_pktsize

protected int mean_pktsize
Mean packet size (byte), for computing ptc.


bw

protected double bw
Link bandwidth (bps), for computing ptc.


th_min

protected double th_min
Minimum threshold of average queue size.


th_max

protected double th_max
Maximum threshold of average queue size.


max_p

protected double max_p
Maximum dropping probability.


qw

protected double qw
Weight for computing average queue size given to current queue size sample.


wait

protected boolean wait
The wait flag, true for waiting between dropped packets.


mark

protected boolean mark
The mark flag, true for marking CE bit instead of early dropping.


ptc

protected double ptc
Output rate of the link in packets/second.


v_a

protected double v_a
For computing dropping probability (=max_p*(qavg - min_th)/(max_th-min_th) = v_a * qavg + v_b).


v_b

protected double v_b
For computing dropping probability (=max_p*(qavg - min_th)/(max_th-min_th) = v_a * qavg + v_b).


qavg

protected double qavg
Computed average queue size.


v_slope

protected double v_slope
Variable used in HOLT WINTERS filter for computing average queue size.


v_prob

protected double v_prob
Computed dropping probability for the incoming packet, for diagnosis purpose.


count

protected long count
# of packets since last early drop.


old

protected int old
0 when average queue first exceeds thresh.


idletime

protected double idletime
Start of the current idle period. Is Double.NaN if not idle.


ug

protected RandomNumberGenerator ug
The random number generator used in this RED.

Constructor Detail

RED

public RED()

RED

public RED(Component host_,
           java.lang.String avgpid_)
Parameters:
avgpid_ - ID of the average queue size change event port that will be created at the host component.

RED

public RED(Component host_,
           java.lang.String avgpid_,
           java.lang.String qpid_)
Parameters:
avgpid_ - ID of the average queue size change event port that will be created at the host component.
qpid_ - ID of the instant queue size change event port that will be created at the host component.
Method Detail

reset

public void reset()
Description copied from class: QLogic
Resets this object to the initial state. Subclasses must call super.reset() when overriding this method.

Overrides:
reset in class QLogic

duplicate

public void duplicate(java.lang.Object source_)
Description copied from class: QLogic
Duplicates the content of the source object to this object. If the host component is already set, this method also creates the queue size change event port of the same ID as that in source_. Subclasses must call super.duplicate() when overriding this method.

Specified by:
duplicate in interface ObjectDuplicable
Overrides:
duplicate in class QLogic

info

public java.lang.String info(java.lang.String prefix_)
Description copied from class: QLogic
Prints the content (states) of this queue management instance.

Overrides:
info in class QLogic
Parameters:
prefix_ - prefix of each line in the printout.

run_estimator

protected void run_estimator(boolean advice_)
Computes the average queue size. The code contains two alternate methods for this, the plain EWMA and the Holt-Winters method.


drop_early

protected boolean drop_early(Packet pkt_)

adviceOn

public java.lang.String adviceOn(java.lang.Object obj_,
                                 int psize_)
Returns advice (in String) on whether or not to drop the packet. Returns false if not to drop the packet.

Overrides:
adviceOn in class QLogic
Returns:
the advice; null if advicing not to drop the object.

enqueueHandler

public void enqueueHandler(java.lang.Object obj_,
                           int psize_)
Description copied from class: QLogic
Handles the event of enqueuing the object of the given size.

Overrides:
enqueueHandler in class QLogic

dequeueHandler

public void dequeueHandler(java.lang.Object obj_,
                           int psize_)
Description copied from class: QLogic
Handles the event of dequeuing the object of the given size.

Overrides:
dequeueHandler in class QLogic

setWait

public void setWait(boolean enabled_)

isWait

public boolean isWait()

setMarkEnabled

public void setMarkEnabled(boolean enabled_)
If enabled, RED marks the congestion bit of, instead of advising to drop, packets.


isMarkEnabled

public boolean isMarkEnabled()

setMeanPacketSize

public void setMeanPacketSize(int size_)

getMeanPacketSize

public int getMeanPacketSize()

setMaxThresh

public void setMaxThresh(double max)

getMaxThresh

public double getMaxThresh()

setMinThresh

public void setMinThresh(double min)

getMinThresh

public double getMinThresh()

setInvProb

public void setInvProb(double value)

getInvProb

public double getInvProb()

setWeight

public void setWeight(double weight)

getWeight

public double getWeight()

getBandwidth

public double getBandwidth()

setBandwidth

public void setBandwidth(double bw_)

setREDParam

public void setREDParam(int psize_,
                        double bw_,
                        double th_max_,
                        double th_min_,
                        double inv_max_p_,
                        double qw_)
Sets up all RED parameters. For each parameter, the default value is used if zero is given.


setSeed

public void setSeed(long seed_)

getSeed

public long getSeed()

setRandomNumberGenerator

public void setRandomNumberGenerator(RandomNumberGenerator ug_)

setRandomNumberGenerator

public void setRandomNumberGenerator(RandomNumberGenerator ug_,
                                     long seed_)

setAvgQSizePort

public void setAvgQSizePort(java.lang.String avgqspid_)

edv_print

protected java.lang.String edv_print(java.lang.String prefix_)

J-Sim v1.2.1-p7 API

Copyright © 1998-2003 Distributed Real-time Computing Lab (DRCL). All Rights Reserved.     ~ To J-Sim Home ~