Java performance timing library
JUnit 4 got a built-in timing-contraint functionality.
@Test(timeout=X)
should do the trick. X is the maximum number of milliseconds the method is allowed to run.
Ignore this answer as the project is no longer active
I haven't used it but I came across perf4j recently.
Not a direct answer to your question, but I am also often using this tip to time my code and just wrote the following simple Eclipse -> Surround With template:
long startTime = System.currentTimeMillis();
${line_selection}${cursor}
long totalTime = System.currentTimeMillis() - startTime;
System.out.println("Total time = " + totalTime);
System.out.println();