public class QueueStatistics extends Object
Modifier and Type | Field and Description |
---|---|
private long[] |
addRates |
private RateStatistics |
addRateStatistics
Calculate the average rate of addition of packets in a 200ms window.
|
private static int |
DEFAULT_PRINT_INTERVAL
The interval (in number of calls to
add(long) or
remove(long) ) at which the gathered statistics will be printed. |
private int |
head |
private Logger |
logger
The
Logger instance used for logging output. |
private String |
logHeader |
private long[] |
removeRates |
private RateStatistics |
removeRateStatistics
Calculate the average rate of removal of packets in a 200ms window.
|
private static int |
SCALE
The scale to use for
RateStatistics . |
private int |
size |
private int[] |
sizes |
private long[] |
timestamps |
private int |
totalPacketsAdded |
private int[] |
totalPacketsAddedHistory |
Constructor and Description |
---|
QueueStatistics(String id)
Initializes a new
QueueStatistics instance. |
Modifier and Type | Method and Description |
---|---|
void |
add(long now)
Registers the addition of a packet to the corresponding queue.
|
private void |
print() |
void |
remove(long now)
Registers the removal of a packet from the corresponding queue.
|
private void |
update(long now) |
private static final int SCALE
RateStatistics
. This makes their output in
units (e.g. packets) per second.private static final int DEFAULT_PRINT_INTERVAL
add(long)
or
remove(long)
) at which the gathered statistics will be printed.private final RateStatistics addRateStatistics
private final RateStatistics removeRateStatistics
private int head
private int size
private int[] sizes
private long[] timestamps
private long[] addRates
private long[] removeRates
private int[] totalPacketsAddedHistory
private int totalPacketsAdded
private String logHeader
public QueueStatistics(String id)
QueueStatistics
instance.id
- Identifier to distinguish the log output of multiple
QueueStatistics
instances.public void add(long now)
now
- the time (in milliseconds since the epoch) at which the
packet was added.public void remove(long now)
now
- the time (in milliseconds since the epoch) at which the
packet was removed.private void update(long now)
private void print()
Copyright © 2018. All rights reserved.