org.apache.storm.loadgen

## 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:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ExecAndProcessLatencyEngine()`
    `ExecAndProcessLatencyEngine(SlowExecutorPattern skewedPattern)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `prepare()`
    `void` | `simulateProcessAndExecTime(int executorIndex, long startTimeNs, InputStream in, Runnable r)` Simulate both process and exec times.
    `void` | `sleepNano(long nano)`
    `void` | `sleepNano(long start, long sleepAmount)` Sleep for a set number of nano seconds.
    `void` | `sleepUntilNano(long endTime)`
    `static long` | `toNano(double ms)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ExecAndProcessLatencyEngine

          public ExecAndProcessLatencyEngine()

    - #### ExecAndProcessLatencyEngine

          public ExecAndProcessLatencyEngine(SlowExecutorPattern skewedPattern)

  - ### Method Detail

    - #### 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.

Copyright © 2019 The Apache Software Foundation. All rights reserved.