Quite often performance is a huge threat to any application. To isolate certain method call taking time, for instance in my case JCR session acquiring takes time.
To calculate time difference, use 'System' api function.
// Place at the start of method execution
final long startTime = TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis());
// Process....
//Before end of method
final long endTime = TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis());
System.out.println("Time taken :::: " + (endTime - startTime)+ "seconds");
If you have Spring AOP support in your application, you can configure this pattern with required methods.
To calculate time difference, use 'System' api function.
// Place at the start of method execution
final long startTime = TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis());
// Process....
//Before end of method
final long endTime = TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis());
System.out.println("Time taken :::: " + (endTime - startTime)+ "seconds");
If you have Spring AOP support in your application, you can configure this pattern with required methods.