diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/mr/HadoopJobExecHelper.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/mr/HadoopJobExecHelper.java index cfb4a28..bb6ed84 100644 --- a/ql/src/java/org/apache/hadoop/hive/ql/exec/mr/HadoopJobExecHelper.java +++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/mr/HadoopJobExecHelper.java @@ -375,6 +375,19 @@ private MapRedStats progress(ExecDriverTaskHandle th) throws IOException, LockEx reportTime = System.currentTimeMillis(); } + Counters ctrs = th.getCounters(); + + if (ctrs != null) { + Counter counterCpuMsec = ctrs.findCounter("org.apache.hadoop.mapred.Task$Counter", + "CPU_MILLISECONDS"); + if (counterCpuMsec != null) { + long newCpuMSec = counterCpuMsec.getValue(); + if (newCpuMSec > cpuMsec) { + cpuMsec = newCpuMSec; + } + } + } + if (cpuMsec > 0) { String status = "MapReduce Total cumulative CPU time: " + Utilities.formatMsecToStr(cpuMsec); console.printInfo(status); @@ -383,7 +396,6 @@ private MapRedStats progress(ExecDriverTaskHandle th) throws IOException, LockEx boolean success; - Counters ctrs = th.getCounters(); if (fatal) { success = false; } else { @@ -401,17 +413,6 @@ private MapRedStats progress(ExecDriverTaskHandle th) throws IOException, LockEx } } - if (ctrs != null) { - Counter counterCpuMsec = ctrs.findCounter("org.apache.hadoop.mapred.Task$Counter", - "CPU_MILLISECONDS"); - if (counterCpuMsec != null) { - long newCpuMSec = counterCpuMsec.getValue(); - if (newCpuMSec > cpuMsec) { - cpuMsec = newCpuMSec; - } - } - } - MapRedStats mapRedStats = new MapRedStats(numMap, numReduce, cpuMsec, success, rj.getID().toString()); mapRedStats.setCounters(ctrs);