MAPREDUCE-6965. QuasiMonteCarlo should use Time.monotonicNow for measuring durations. Contributed by Chetna Chaudhari

This commit is contained in:
Jason Lowe 2017-09-22 09:34:53 -05:00
parent c71d137960
commit 908d8e914e
1 changed files with 3 additions and 2 deletions

View File

@ -38,6 +38,7 @@
import org.apache.hadoop.mapreduce.lib.input.SequenceFileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
import org.apache.hadoop.mapreduce.lib.output.SequenceFileOutputFormat;
import org.apache.hadoop.util.Time;
import org.apache.hadoop.util.Tool;
import org.apache.hadoop.util.ToolRunner;
@ -302,13 +303,13 @@ public static BigDecimal estimatePi(int numMaps, long numPoints,
//start a map/reduce job
System.out.println("Starting Job");
final long startTime = System.currentTimeMillis();
final long startTime = Time.monotonicNow();
job.waitForCompletion(true);
if (!job.isSuccessful()) {
System.out.println("Job " + job.getJobID() + " failed!");
System.exit(1);
}
final double duration = (System.currentTimeMillis() - startTime)/1000.0;
final double duration = (Time.monotonicNow() - startTime)/1000.0;
System.out.println("Job Finished in " + duration + " seconds");
//read outputs