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 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 Murach's Java Servlets and JSP this week in the Servlets 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
  •  
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: Performance meseaurement of code conatining queries
     
    Similar Threads
    Not able to get result set object back to app with Select Query of more than 13 sec execution time
    web application performance monitoring
    finding the timeofday in Java
    Question regarding JAmon
    Calculating Time taken by a code segment