2

Is there an API to figure out how long a Hadoop job took to execute (exactly -> no hacks.)?

1 Answers1

7

I think the simplest way is to measure time in Your driver class. Is it ok for you? I mean something like this:

   long start = new Date().getTime();
   boolean status = job.waitForCompletion(true);            
   long end = new Date().getTime();
   System.out.println("Job took "+(end-start) + "milliseconds");
David Gruzman
  • 7,900
  • 1
  • 28
  • 30
  • 1
    This is actually the way I am doing it now using a multi-threaded environment I was just wondering if Hadoop keeps some kind of counter for this... Thanks though :) –  Jul 29 '11 at 07:26
  • 5
    Keep in mind that this isn't too exact (seconds-wise), because waitForCompletion() polls every n-seconds for the completion of the job. – Thomas Jungblut Jul 29 '11 at 13:45