public class ExecAndProcessLatencyEngine extends Object implements Serializable
A more accurate sleep implementation.
Constructor and Description |
---|
ExecAndProcessLatencyEngine() |
ExecAndProcessLatencyEngine(SlowExecutorPattern skewedPattern) |
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) |
public ExecAndProcessLatencyEngine()
public ExecAndProcessLatencyEngine(SlowExecutorPattern skewedPattern)
public static long toNano(double ms)
public void prepare()
public void sleepNano(long start, long sleepAmount)
Sleep for a set number of nano seconds.
start
- the start time of the sleepsleepAmount
- how many nano seconds after start when we should stop.public void sleepNano(long nano)
public void sleepUntilNano(long endTime)
public void simulateProcessAndExecTime(int executorIndex, long startTimeNs, InputStream in, Runnable r)
Simulate both process and exec times.
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.