@Override
        protected synchronized void delay(long amount) throws InterruptedException {
            long startMs = time().milliseconds();
            producer.flush();
            long endMs = time().milliseconds();
            long delta = endMs - startMs;
            super.delay(amount - delta);
        }
A subclass of Throttle which flushes the Producer right before the throttle injects a delay.
This avoids including throttling latency in latency measurements.
trogdor/src/main/java/org/apache/kafka/trogdor/workload/ProduceBenchWorker.java