This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Performance and the fly likes How can we know what is the execution time taken for completing a Operation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Performance
Bookmark "How can we know what is the execution time taken for completing a Operation" Watch "How can we know what is the execution time taken for completing a Operation" New topic
Author

How can we know what is the execution time taken for completing a Operation

Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

Hi ,

How can i know what is the execution time taken for completing an operation .
My query is that for example I am fetching data from DataBase and it can be done using Statements and PreperaedStatements also know , so i want to know what is the time taken when using Statements and what time in case of PreparedStatements .

Please let me know is there any tool for this .


Save India From Corruption - Anna Hazare.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

You can check the system time at the start and the end of the method and look at the difference.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

Thank you .

But i want to see all these on tools .

so is any tool like this .
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5812
    
    7

Oh, you want a Java profiling tool! Let me google that for you: java profiler. Hmm, I did not see VisualVM mentioned in the results (I probably missed it).


JBoss In Action
Kees Jan Koster
JavaMonitor Support
Rancher

Joined: Mar 31, 2009
Posts: 251
    
    5
And there are the logging database drivers (mysql driver has this built-in, or you can use p6spy).


Java-monitor, JVM monitoring made easy <- right here on Java Ranch
Fred Hamilton
Ranch Hand

Joined: May 13, 2009
Posts: 679
You can always use the getTime() method of the Date class. This can be used as a quick and dirty millisecond timer. it returns a value of type long. So taking two measurements and substracting the first from the second gives you elapsed time in milliseconds.

It's not a replacement for a proper profiling tool I guess. Just a quick and easy time check.
steve souza
Ranch Hand

Joined: Jun 26, 2002
Posts: 860
The JAMon sql proxy drive sits in front of the actual db driver and times all queries and other aspects of jdbc.

http://jamonapi.sourceforge.net/#WhatsNew22


http://www.jamonapi.com/ - a fast, free open source performance tuning api.
JavaRanch Performance FAQ
 
Don't get me started about those stupid light bulbs.
 
subject: How can we know what is the execution time taken for completing a Operation
 
Similar Threads
Performance meseaurement of code conatining queries
To Lynn Beighley : What are the most common mistakes developers do ?
Query Execution Time.
Calculating Time taken by a code segment
Connection.close hangs