Class ListenerTimeMeasure

java.lang.Object
All Implemented Interfaces:
Serializable, Measure<Long>, PullMeasure<Long>, DescribedEntity

public class ListenerTimeMeasure extends SimplePullMeasure<Long> implements PullMeasure<Long>
This measure is a facility to evaluate the time spent in MeasureListeners registered in PushMeasures. In order to measure the time spent in a MeasureListener, you should wrap it by calling wrapListener(MeasureListener). The wrapper returned should be used instead of the original MeasureListener to allow the ListenerTimeMeasure to account for its execution time. If you want to wrap automatically all the MeasureListeners registered to a given PushMeasure, you can wrap the PushMeasure through wrapMeasure(PushMeasure): all the MeasureListeners registered to the wrapper will be wrapped too. You can restart the evaluation by calling reset().

Notice that the time accounted is not the physical time but the processing time: if several listeners run in parallel, their execution time is summed as if they were running sequentially, thus you can have a measured time which is superior to the physical time spent. If you want to measure the physical time spent in the execution of parallel runs, you should use another way.
Author:
Matthieu Vergne
See Also: