Package org.apache.storm.loadgen
Class ExecAndProcessLatencyEngine
java.lang.Object
org.apache.storm.loadgen.ExecAndProcessLatencyEngine
- All Implemented Interfaces:
Serializable
A more accurate sleep implementation.
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
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)
-
Constructor Details
-
ExecAndProcessLatencyEngine
public ExecAndProcessLatencyEngine() -
ExecAndProcessLatencyEngine
-
-
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 sleepsleepAmount
- 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.
-