public class TimeMeter extends TwoPointMeter
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.
The figure below depicts the principle of a transfer time meter.
Principle of a transfer time meter
fromPortHandler, toPortHandler
Modifier | Constructor and Description |
---|---|
protected |
TimeMeter(UnweightedSampleCollector<Duration> statistic) |
Modifier and Type | Method and Description |
---|---|
protected void |
addTimeStamp(Message message,
PointInTime timeStamp)
put from-port time stamp into the map
|
static TimeMeter |
createWithDoubleStatistic(UnweightedSampleCollector<java.lang.Double> statistic)
creates a new
TimeMeter with a statistic that accepts Double
values. |
static TimeMeter |
createWithDurationStatistic(UnweightedSampleCollector<Duration> statistic)
creates a new
TimeMeter with a statistic that accepts Duration
objects |
protected void |
evaluateMessageFromPort(Message msg,
Port port) |
protected void |
evaluateMessageToPort(Message msg,
Port port) |
protected void |
evaluateSample(Message msg,
PointInTime fromPortTime,
PointInTime toPortTime)
called when a message was seen at one of the from-ports and at one of the
to-ports
|
protected PointInTime |
getAndRemoveTimeStamp(Message message)
remove from-port time stamp from the map
|
protected boolean |
useMessage(Message msg)
filters messages that should be used for transfer time measurement
|
attachFromPort, attachFromPort, attachToPort, attachToPort
protected TimeMeter(UnweightedSampleCollector<Duration> statistic)
public static TimeMeter createWithDurationStatistic(UnweightedSampleCollector<Duration> statistic)
TimeMeter
with a statistic that accepts Duration
objectsstatistic
- statistic to fill with the valuesTimeMeter
public static TimeMeter createWithDoubleStatistic(UnweightedSampleCollector<java.lang.Double> statistic)
TimeMeter
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 valuesTimeMeter
protected void addTimeStamp(Message message, PointInTime timeStamp)
protected PointInTime getAndRemoveTimeStamp(Message message)
protected void evaluateSample(Message msg, PointInTime fromPortTime, PointInTime toPortTime)
msg
- the messagefromPortTime
- the time the message was seen at the from-porttoPortTime
- the time the message was seen at the to-portprotected boolean useMessage(Message msg)
msg
- the observed messageprotected void evaluateMessageFromPort(Message msg, Port port)
evaluateMessageFromPort
in class TwoPointMeter
protected void evaluateMessageToPort(Message msg, Port port)
evaluateMessageToPort
in class TwoPointMeter