How to calculate the time taken by  your Program?

Java

    Use java.util.Date() or 

   Use the following simple class StopWatch to measure time (which uses Date()).

  1. Call StopWatch.startTimer() when you want to start measuring time .
  2. Then call StopWatch.currTime() to get the number of milliseconds elapsed since the call to startTimer().

 

C/C++ on Un*X (or gcc onWindows)

  You can  use the function ftime declared in <sys/timeb.h> or 

se the following simple header file  stop_watch.h to measure time 

  1. include the stop_watch.h 
  2. Call startTimer() when you want to start measuring time .
  3. Then call currTime() to get the number of milliseconds elapsed since the call to startTimer().

 

Visual Studio

Similar to the java Code, there is a simple Class StopWatch provided with the same interface as above to measure time. .