Development in JAVA (front & backend)

Thursday, October 2, 2014

Get the performance time of a method in java.

This will return the total time in milliseconds

long startTime = System.currentTimeMillis();
for(String id :ids) {
client.detail("US", id);
}
long endTime   = System.currentTimeMillis();
long totalTime = endTime - startTime;
System.out.println(totalTime+"<--- total time");
Posted by Unknown at 2:19 AM
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest

No comments:

Post a Comment

Newer Post Older Post Home
Subscribe to: Post Comments (Atom)

Blog Archive

  • ►  2015 (16)
    • ►  April (1)
    • ►  March (3)
    • ►  February (10)
    • ►  January (2)
  • ▼  2014 (22)
    • ►  December (1)
    • ►  November (2)
    • ▼  October (9)
      • Upgrading spring from 3.0.6. to 4.1.1.RELEASE[Resp...
      • ConfigurationHolder in grails 2.4.2
      • Maven commands
      • Reading a custom properties or default message pro...
      • Spring controller- Return to a specific view
      • Alter a table with new column with not null and de...
      • Springs (Profiling a method) using AOP.(logging th...
      • Set external jar in class path when using the POM ...
      • Get the performance time of a method in java.
    • ►  September (7)
    • ►  August (3)
Simple theme. Theme images by gaffera. Powered by Blogger.