MAPREDUCE-6964. BaileyBorweinPlouffe should use Time.monotonicNow for measuring durations. Contributed by Chetna Chaudhari

This commit is contained in:
Jason Lowe 2017-09-21 09:37:19 -05:00
parent 6bf921a5c3
commit b9db0afa1e

View File

@ -49,6 +49,7 @@
import org.apache.hadoop.mapreduce.Reducer;
import org.apache.hadoop.mapreduce.TaskAttemptContext;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
import org.apache.hadoop.util.Time;
import org.apache.hadoop.util.Tool;
import org.apache.hadoop.util.ToolRunner;
@ -379,7 +380,7 @@ private static void compute(int startDigit, int nDigits, int nMaps,
// start a map/reduce job
out.println("\nStarting Job ...");
final long startTime = System.currentTimeMillis();
final long startTime = Time.monotonicNow();
try {
if (!job.waitForCompletion(true)) {
out.println("Job failed.");
@ -388,7 +389,7 @@ private static void compute(int startDigit, int nDigits, int nMaps,
} catch (Exception e) {
throw new RuntimeException(e);
} finally {
final double duration = (System.currentTimeMillis() - startTime)/1000.0;
final double duration = (Time.monotonicNow() - startTime)/1000.0;
out.println("Duration is " + duration + " seconds.");
}
out.println("Output file: " + hexfile);