File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Performance meseaurement of code conatining queries Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Performance meseaurement of code conatining queries" Watch "Performance meseaurement of code conatining queries" New topic
Author

Performance meseaurement of code conatining queries

Vamsh Lingampally
Greenhorn

Joined: Aug 15, 2003
Posts: 5
Hi,
I would like to know if there are any methods to get the timeofday() (C eqivalent routine) in Java.
I wanted to calculate time taken for execution of certain part of my code and was not sure how to do it .This part of code mainly has queries which query the Mysql DB using MySQL JDBC connection. I thought I can use getimeofday() methods if available in Java before the start of the code and at the end of the code whose performance I am checking.
Can any one please help me with it.....
Or if any one knows how to calculate the time taken for execution of a program in Java.
I am running on a dead line and would appreciate if anyone gives me an idea as how to go about getting the performance of the code.
Regards,
Vamsh
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
To get the current time, three possible statements come to mind immediately.
System.currentTimeMillis();
java.util.Calendar.getInstance();
new java.util.Date();


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Vamsh Lingampally
Greenhorn

Joined: Aug 15, 2003
Posts: 5
Thank you very much.
Is there a way I can check the performance of my queries?? My backend db is Mysql and I am using a JDBC for mysql to connect to the DataBase??
Regards
Vamsh
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
A quick search on google for "jdbc query performance" resulted in the following hits that you might find useful.
  • JavaPerformanceTuning.com article - JDBC profiling performance tips
  • Performance tuning your JDBC application
  • JavaWorld article - Use JDBC for industrial-strength performance
  •  
     
    subject: Performance meseaurement of code conatining queries