Creates a new performance monitor.
Maximum number of duration samples to retain per
operation name. Older samples are evicted when the limit is reached
(sliding window). Default: 1000.
Returns aggregated performance statistics for a named operation.
Calculates percentiles (p50 / p95 / p99), average, min, and max from
the stored duration samples. Returns null when no samples have been
recorded for the operation yet.
Operation name / identifier to query
PerformanceStats object, or null if no data exists
Records a duration sample for the named operation.
When the number of stored samples reaches maxSamples, the oldest
entries are evicted in bulk (sliding window). Use getStats to
retrieve aggregated statistics after recording samples.
Unique operation name / identifier (e.g., 'ep_api_call')
Observed duration in milliseconds (should be ≥ 0)
Performance monitor for tracking operation metrics
Tracks duration of operations and provides statistical analysis. Useful for identifying performance regressions and bottlenecks.
Example