MAPREDUCE-6967. gridmix/SleepReducer should use Time.monotonicNow for measuring durations. Contributed by Chetna Chaudhari
This commit is contained in:
parent
08fca508e6
commit
b133dc5700
@ -52,6 +52,7 @@
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.hadoop.util.Time;
|
||||
|
||||
public class SleepJob extends GridmixJob {
|
||||
public static final Log LOG = LogFactory.getLog(SleepJob.class);
|
||||
@ -184,7 +185,7 @@ protected void setup(Context context)
|
||||
TimeUnit.MILLISECONDS.convert(sleepInterval, TimeUnit.SECONDS);
|
||||
//This is to stop accumulating deviation from expected sleep time
|
||||
//over a period of time.
|
||||
long start = System.currentTimeMillis();
|
||||
long start = Time.monotonicNow();
|
||||
long slept = 0L;
|
||||
long sleep = 0L;
|
||||
while (slept < duration) {
|
||||
@ -192,7 +193,7 @@ protected void setup(Context context)
|
||||
sleep = Math.min(rem, RINTERVAL);
|
||||
context.setStatus("Sleeping... " + rem + " ms left");
|
||||
TimeUnit.MILLISECONDS.sleep(sleep);
|
||||
slept = System.currentTimeMillis() - start;
|
||||
slept = Time.monotonicNow() - start;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user