Class ExecAndProcessLatencyEngine

java.lang.Object
org.apache.storm.loadgen.ExecAndProcessLatencyEngine
All Implemented Interfaces:
Serializable

public class ExecAndProcessLatencyEngine extends Object implements Serializable
A more accurate sleep implementation.
See Also:
  • Constructor Details

    • ExecAndProcessLatencyEngine

      public ExecAndProcessLatencyEngine()
    • ExecAndProcessLatencyEngine

      public ExecAndProcessLatencyEngine(SlowExecutorPattern skewedPattern)
  • Method Details

    • toNano

      public static long toNano(double ms)
    • prepare

      public void prepare()
    • sleepNano

      public void sleepNano(long start, long sleepAmount)
      Sleep for a set number of nano seconds.
      Parameters:
      start - the start time of the sleep
      sleepAmount - how many nano seconds after start when we should stop.
    • sleepNano

      public void sleepNano(long nano)
    • sleepUntilNano

      public void sleepUntilNano(long endTime)
    • simulateProcessAndExecTime

      public void simulateProcessAndExecTime(int executorIndex, long startTimeNs, InputStream in, Runnable r)
      Simulate both process and exec times.
      Parameters:
      executorIndex - the index of this executor. It is used to skew the latencies.
      startTimeNs - when the executor started in nano-seconds.
      in - the metrics for the input stream (or null if you don't want to use them).
      r - what to run when the process latency is up. Note that this may run on a separate thread after this method call has completed.