1

I have a method in java

Public Object someMethod (String param) (
//some calculations
Return Object )

I want to test the performance of this method ( how much time would it take to reach to db and return an object ) How can I do this? I don't have a main method because its a library. I use unit tests to check if it works. Help.

Derek Pollard
  • 6,953
  • 6
  • 39
  • 59
John
  • 93
  • 2
  • 12

1 Answers1

1

I would use JMH, which is an excellent framework for doing microbenchmarks

http://openjdk.java.net/projects/code-tools/jmh/

It is used all the time by engineers that develops the JDK.

Kire Haglin
  • 6,569
  • 22
  • 27