Package org.mockserver.mock.drift
Class PercentileTracker
java.lang.Object
org.mockserver.mock.drift.PercentileTracker
Sliding window p50/p95 tracker for response times per expectation ID.
Uses a fixed-size circular buffer per expectation. Thread-safe via
ConcurrentHashMap.compute(Object, java.util.function.BiFunction).-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clears all tracked data.intstatic PercentileTrackerlonglongvoidRecord a response time observation for the given expectation ID.
-
Constructor Details
-
PercentileTracker
public PercentileTracker(int windowSize)
-
-
Method Details
-
getInstance
-
record
Record a response time observation for the given expectation ID. -
p50
- Returns:
- the p50 (median) response time for the given expectation, or 0 if no data.
-
p95
- Returns:
- the p95 response time for the given expectation, or 0 if no data.
-
count
- Returns:
- the number of observations recorded for the given expectation.
-
clear
public void clear()Clears all tracked data.
-