MAPREDUCE-6966. DistSum should use Time.monotonicNow for measuring durations. Contributed by Chetna Chaudhari.

This commit is contained in:
Akira Ajisaka 2017-09-22 15:07:59 +09:00
parent 53be075241
commit c71d137960
No known key found for this signature in database
GPG Key ID: C1EDBB9CA400FD50

View File

@ -51,6 +51,7 @@
import org.apache.hadoop.mapreduce.TaskInputOutputContext; import org.apache.hadoop.mapreduce.TaskInputOutputContext;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat; import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
import org.apache.hadoop.net.NetUtils; import org.apache.hadoop.net.NetUtils;
import org.apache.hadoop.util.Time;
import org.apache.hadoop.util.Tool; import org.apache.hadoop.util.Tool;
import org.apache.hadoop.util.ToolRunner; import org.apache.hadoop.util.ToolRunner;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -162,9 +163,9 @@ static void compute(Summation sigma,
LOG.info(s = "sigma=" + sigma); LOG.info(s = "sigma=" + sigma);
context.setStatus(s); context.setStatus(s);
final long start = System.currentTimeMillis(); final long start = Time.monotonicNow();
sigma.compute(); sigma.compute();
final long duration = System.currentTimeMillis() - start; final long duration = Time.monotonicNow() - start;
final TaskResult result = new TaskResult(sigma, duration); final TaskResult result = new TaskResult(sigma, duration);
LOG.info(s = "result=" + result); LOG.info(s = "result=" + result);