public class MessageLengthMeter extends OnePointMeter
useMessage(Message)
method can be overridden to use only those
messages for measurement that satisfy certain criteria, e.g., based on
message content, or message type.portHandler
Modifier | Constructor and Description |
---|---|
protected |
MessageLengthMeter(UnweightedSampleCollector<java.lang.Long> statistic) |
Modifier and Type | Method and Description |
---|---|
static MessageLengthMeter |
createWithDoubleStatistic(UnweightedSampleCollector<java.lang.Double> statistic)
creates a new
MessageLengthMeter with a statistic that accepts
Double values. |
static MessageLengthMeter |
createWithLongStatistic(UnweightedSampleCollector<java.lang.Long> statistic)
creates a new
MessageLengthMeter with a statistic that accepts
Long values |
protected void |
evaluateMessage(Message msg,
Port port) |
protected void |
evaluateSample(Message msg,
long length)
called when a message was seen
|
protected boolean |
useMessage(Message msg)
filters messages that should be used for measurement
|
attachInput, attachInput
protected MessageLengthMeter(UnweightedSampleCollector<java.lang.Long> statistic)
public static MessageLengthMeter createWithLongStatistic(UnweightedSampleCollector<java.lang.Long> statistic)
MessageLengthMeter
with a statistic that accepts
Long valuesstatistic
- statistic to fill with the valuesMessageLengthMeter
public static MessageLengthMeter createWithDoubleStatistic(UnweightedSampleCollector<java.lang.Double> statistic)
MessageLengthMeter
with a statistic that accepts
Double values. The measured durations are converted to seconds and then
filled into the statistic.statistic
- statistic to fill with the valuesMessageLengthMeter
protected void evaluateSample(Message msg, long length)
msg
- the messagelength
- the length of the messageprotected boolean useMessage(Message msg)
msg
- the observed messageprotected void evaluateMessage(Message msg, Port port)
evaluateMessage
in class OnePointMeter