This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

tool to get the time taken to execute a function

 
andy kumar
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13074
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 433
Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Erm... a profiler?!
 
sumit anand kumar
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use jamon

Jamon
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic