Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Performance meseaurement of code conatining queries

 
Vamsh Lingampally
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To get the current time, three possible statements come to mind immediately.
System.currentTimeMillis();
java.util.Calendar.getInstance();
new java.util.Date();
 
Vamsh Lingampally
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic