Class HiccupMonitor

java.lang.Object
com.quantfinlib.util.HiccupMonitor
All Implemented Interfaces:
AutoCloseable

public final class HiccupMonitor extends Object implements AutoCloseable
jHiccup-style platform stall monitor: a daemon thread repeatedly parks for a fixed resolution and records how much longer than requested each park took. Any excess is a "hiccup" — GC pause, JVM safepoint, JIT deoptimization stall, or OS scheduler preemption — exactly the pauses that corrupt latency percentiles without showing up in application code.

Run one alongside a latency benchmark or a live session: if the benchmark's p99.9 spikes while the hiccup monitor shows a matching stall, the platform (not your code) ate the tail. Zero-dependency and allocation-free while sampling (LatencyRecorder histogram).

See docs/ULTRA_LOW_LATENCY.md for the JVM/kernel tuning that shrinks what this monitor observes.

  • Constructor Details

    • HiccupMonitor

      public HiccupMonitor()
      Default 1 ms sampling resolution.
    • HiccupMonitor

      public HiccupMonitor(long resolutionNanos)
  • Method Details

    • start

      public HiccupMonitor start()
    • stop

      public void stop()
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
    • recorder

      public LatencyRecorder recorder()
      The hiccup histogram: excess-over-requested park time, in nanos.
    • samples

      public long samples()
    • maxHiccupNanos

      public long maxHiccupNanos()
      Worst platform stall observed, in nanoseconds.
    • summary

      public String summary()