seda.sandStorm.core
Class MulticlassRateLimitingPredicate

java.lang.Object
  extended by seda.sandStorm.core.MulticlassRateLimitingPredicate
All Implemented Interfaces:
EnqueuePredicateIF

public class MulticlassRateLimitingPredicate
extends java.lang.Object
implements EnqueuePredicateIF

This enqueue predicate implements multiclass input rate policing.


Field Summary
private  seda.util.StatsGatherer acceptArrivalStats
           
private static boolean DEBUG
           
private  int[] depth
           
private  seda.util.StatsGatherer interArrivalStats
           
private  long[] lasttime
           
private  long MIN_REGEN_TIME
           
private  int NUM_CLASSES
           
private static boolean PROFILE
           
private  double[] regenTimeMS
           
private  double[] targetRate
           
private  SinkIF thesink
           
private  double[] tokenCount
           
 
Constructor Summary
MulticlassRateLimitingPredicate(SinkIF sink, int numclasses, double targetRate, int depth)
          Create a new RateLimitingPredicate for the given sink, targetRate, and token bucket depth.
 
Method Summary
 boolean accept(QueueElementIF qel)
          Returns true if the given element can be accepted into the queue.
 int getBucketSize(int theclass)
          Return the number of tokens currently in the bucket.
 int getDepth(int theclass)
          Return the current depth.
 double getTargetRate(int theclass)
          Return the current rate limit.
 void setDepth(int theclass, int depth)
          Set the bucket depth.
 void setTargetRate(int theclass, double targetRate)
          Set the rate limit.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

private static final boolean DEBUG
See Also:
Constant Field Values

thesink

private SinkIF thesink

NUM_CLASSES

private int NUM_CLASSES

targetRate

private double[] targetRate

depth

private int[] depth

tokenCount

private double[] tokenCount

regenTimeMS

private double[] regenTimeMS

lasttime

private long[] lasttime

MIN_REGEN_TIME

private long MIN_REGEN_TIME

PROFILE

private static final boolean PROFILE
See Also:
Constant Field Values

interArrivalStats

private seda.util.StatsGatherer interArrivalStats

acceptArrivalStats

private seda.util.StatsGatherer acceptArrivalStats
Constructor Detail

MulticlassRateLimitingPredicate

public MulticlassRateLimitingPredicate(SinkIF sink,
                                       int numclasses,
                                       double targetRate,
                                       int depth)
Create a new RateLimitingPredicate for the given sink, targetRate, and token bucket depth. A rate of -1.0 indicates no rate limit.

Method Detail

accept

public boolean accept(QueueElementIF qel)
Returns true if the given element can be accepted into the queue.

Specified by:
accept in interface EnqueuePredicateIF
Parameters:
qel - The QueueElementIF to enqueue
Returns:
True if the sink accepts the element; false otherwise.

getTargetRate

public double getTargetRate(int theclass)
Return the current rate limit.


getDepth

public int getDepth(int theclass)
Return the current depth.


getBucketSize

public int getBucketSize(int theclass)
Return the number of tokens currently in the bucket.


setTargetRate

public void setTargetRate(int theclass,
                          double targetRate)
Set the rate limit. A limit of -1.0 indicates no rate limit.


setDepth

public void setDepth(int theclass,
                     int depth)
Set the bucket depth.