File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
Register / Login
JavaRanch » Java Forums » Java » Performance
Reply 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: 2231

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: 2231

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: 4875

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
Ranch Hand

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


Java-monitor, JVM monitoring made easy (and free)
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: 851
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
 
 
subject: How can we know what is the execution time taken for completing a Operation
 
Threads others viewed
Calculating Time taken by a code segment
To Lynn Beighley : What are the most common mistakes developers do ?
Performance meseaurement of code conatining queries
Query Execution Time.
Connection.close hangs
developer file tools