diff --git a/hadoop-tools/hadoop-gridmix/src/main/java/org/apache/hadoop/mapred/gridmix/SleepJob.java b/hadoop-tools/hadoop-gridmix/src/main/java/org/apache/hadoop/mapred/gridmix/SleepJob.java index 6c2a0480bb8..87a67f19a86 100644 --- a/hadoop-tools/hadoop-gridmix/src/main/java/org/apache/hadoop/mapred/gridmix/SleepJob.java +++ b/hadoop-tools/hadoop-gridmix/src/main/java/org/apache/hadoop/mapred/gridmix/SleepJob.java @@ -52,6 +52,7 @@ import org.apache.hadoop.tools.rumen.TaskAttemptInfo; 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 @@ public class SleepJob extends GridmixJob { 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 @@ public class SleepJob extends GridmixJob { sleep = Math.min(rem, RINTERVAL); context.setStatus("Sleeping... " + rem + " ms left"); TimeUnit.MILLISECONDS.sleep(sleep); - slept = System.currentTimeMillis() - start; + slept = Time.monotonicNow() - start; } }