Lately I was thinking how to teach to use JUnit to execute some performance test. I gave a try to both p-unit and JPerf. Apart the fact they do not seem to be actively maintained any more, they suffered, in my point of view, from a dependency on the system clock. This sounded very strange to me, because measuring performances with the system clock gives results that are hardly generalized to other machines.
So, what could be a solution ? Just use two codes that perform the same task. One is the reference, while the other is the one performances are measured related to the reference.
If you’re interested I would point you to the very detailed Francesco’s post about the matter.