title: Java performance timing library
body: <p>I frequent wrap code in a <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/System.html#nanoTime()" rel="noreferrer">System.nanoTime()</a> pair in order to timing it. Something like:</p>
  
  <pre><code>long start = System.nanoTime();    
  methodToBeTimed();
  long elapsedTime = System.nanoTime() - start;
  </code></pre>
  
  <p>There is any good timing library that helps with this problem? Also homegrown code will be accepted.</p>
  
  <p>NB</p>
  
  <p>A profiler is not a solution here, since I want to enforce some time constraints in my unit tests, so I want to timing methods <strong>programmatically</strong>.</p>