title: Hadoop 2.6.0 JobCounters always returning zero
body: <p>I am trying to get the total time spent by the map phase and by the reduce phase in a job run. So I've tried to use the <em>JobCounters</em> <em>MILLIS_MAPS</em> and <em>MILLI_REDUCES</em>, but its seems that when I try to get the value these one is always zero. Besides this, I also notice that these counters aren't printed when the job is completed successfully, which leads to my questions.</p>
  
  <p>The JobCounters are in use in Hadoop 2.6.0? Were they deprecated?</p>
  
  <p>If not, how can we use them correctly?</p>
  
  <p>This is what I've tried so far:</p>
  
  <pre><code>Date startTime = new Date();
  System.out.println("Job started: " + startTime);
  job.waitForCompletion(true);
  
  Date end_time = new Date();
  System.out.println("Job ended: " + end_time);
  System.out.println("The job took " +
              (end_time.getTime() - startTime.getTime()) /1000 + " seconds.");
  
  Counters counters = job.getCounters();
  
  Counter mapTime = counters.findCounter(JobCounter.MILLIS_MAPS);
  System.out.println(mapTime.getDisplayName() + " : " + mapTime.getValue());
  
  Counter reduceTime = counters.findCounter(JobCounter.MILLIS_REDUCES);
  System.out.println(reduceTime.getDisplayName() + " : " +reduceTime.getValue());
  </code></pre>
  
  <p>UPDATE:
    It seems that I can only print these counters when running yarn. Any ideas how   to get them without running yarn?</p>
  
  <p>Thanks for the attention!</p>