aspose file tools*
The moose likes Performance and the fly likes tool to get the time taken to execute a function Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Performance
Bookmark "tool to get the time taken to execute a function" Watch "tool to get the time taken to execute a function" New topic
Author

tool to get the time taken to execute a function

andy kumar
Ranch Hand

Joined: Jun 08, 2009
Posts: 57
HI,

Is there any tool available which would give me the time taken to execute a function and the rest of the functions that are called by the parent function in a recursive manner.
Presently I am writing system.out.println statement for each function and this is very time consuming.

thanks in advance.

Thanks
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12781
    
    5
You can use System.currentTimeMillis() to get start and end times but you should collect many many data points.

Because of the granularity of system time, a single reading does not mean much.

Doing ANY System.out writes while timing will completely mess up the measurement. Collect the data, average and then print.

Bill
Joachim Rohde
Ranch Hand

Joined: Nov 27, 2006
Posts: 423

Erm... a profiler?!
sumit anand kumar
Ranch Hand

Joined: Apr 28, 2010
Posts: 83
Use jamon

Jamon
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: tool to get the time taken to execute a function