Package com.helixframework.proxy
Class TimedInvocationHandler
java.lang.Object
com.helixframework.proxy.TimedInvocationHandler
- All Implemented Interfaces:
InvocationHandler
The TimedInvocationHandler class is an implementation of the InvocationHandler interface that allows for timing method invocations.
It records the latency of each method invocation and provides methods to retrieve statistical data about the latencies.
-
Method Summary
Modifier and TypeMethodDescriptionstatic com.helixframework.proxy.TimedInvocationHandler.BuilderReturns a new instance of the Builder class with the given target object.Optional<org.HdrHistogram.Histogram>getHistogram(String method) Retrieves the latency histogram for the given method.Retrieves the maximum duration to record timing information for.longgetMaxNanos(String method) Retrieves the maximum latency in nanoseconds for the given method.doublegetMeanNanos(String method) Retrieves the mean latency in nanoseconds for the given method.longgetMinNanos(String method) Retrieves the minimum latency in nanoseconds for the given method.longRetrieves the 50th percentile (P50) latency in nanoseconds for the given method.longRetrieves the 90th percentile latency in nanoseconds for the given method.longRetrieves the 95th percentile (P95) latency in nanoseconds for the given method.longRetrieves the 99th percentile latency in nanoseconds for the given method.longgetPercentile(String method, double percentile) Retrieves the percentile latency in nanoseconds for the given method.doubleRetrieves the sample rate for recording timing information of method invocations.Retrieves the window duration.
-
Method Details
-
builder
Returns a new instance of the Builder class with the given target object.- Parameters:
target- the target object- Returns:
- a new instance of the Builder class
-
invoke
- Specified by:
invokein interfaceInvocationHandler- Throws:
Throwable
-
getHistogram
Retrieves the latency histogram for the given method.- Parameters:
method- the name of the method- Returns:
- an Optional containing the Histogram for the method, or an empty Optional if the histogram is not found
-
getMinNanos
Retrieves the minimum latency in nanoseconds for the given method.- Parameters:
method- the name of the method- Returns:
- the minimum latency in nanoseconds for the method, or Long.MIN_VALUE if the histogram is not found
-
getMaxNanos
Retrieves the maximum latency in nanoseconds for the given method.- Parameters:
method- the name of the method- Returns:
- the maximum latency in nanoseconds for the method, or Long.MIN_VALUE if the histogram is not found
-
getMeanNanos
Retrieves the mean latency in nanoseconds for the given method.- Parameters:
method- the name of the method- Returns:
- the mean latency in nanoseconds for the method, or Double.MIN_VALUE if the histogram is not found
-
getP99
Retrieves the 99th percentile latency in nanoseconds for the given method.- Parameters:
method- the name of the method- Returns:
- the 99th percentile latency in nanoseconds for the method, or Long.MIN_VALUE if the histogram is not found
-
getP95
Retrieves the 95th percentile (P95) latency in nanoseconds for the given method.- Parameters:
method- the name of the method- Returns:
- the 95th percentile latency in nanoseconds for the method, or Long.MIN_VALUE if the histogram is not found
-
getP90
Retrieves the 90th percentile latency in nanoseconds for the given method.- Parameters:
method- the name of the method- Returns:
- the 90th percentile latency in nanoseconds for the method, or Long.MIN_VALUE if the histogram is not found
-
getP50
Retrieves the 50th percentile (P50) latency in nanoseconds for the given method.- Parameters:
method- the name of the method- Returns:
- the 50th percentile latency in nanoseconds for the method, or Long.MIN_VALUE if the histogram is not found
-
getPercentile
Retrieves the percentile latency in nanoseconds for the given method.- Parameters:
method- the name of the methodpercentile- the desired percentile (0.0 to 100.0)- Returns:
- the percentile latency in nanoseconds for the method, or Long.MIN_VALUE if the histogram is not found
-
getSampleRate
public double getSampleRate()Retrieves the sample rate for recording timing information of method invocations.- Returns:
- the sample rate
-
getMaxDuration
Retrieves the maximum duration to record timing information for.- Returns:
- the maximum duration
-
getWindow
Retrieves the window duration.- Returns:
- the window duration
-