I want to do some timing tests on a Java application.
This is what I am currently doing:
long startTime = System.currentTimeMillis();
doSomething();
long finishTime = System.currentTimeMillis();
System.out.println("That took: "+(finishTime-startTime)+ " ms");
Is there anything "wrong" with performance testing like this? What is a better way?
Duplicate: http://stackoverflow.com/questions/410437/is-stopwatch-benchmarking-acceptable