hi, i'm working on this project which is basically to implement the various travelling salesman heuristics.
could anyone please tell me how i can time how long a piece of code takes to execute?
i have tried the Timer class but from my understanding, that is for setting alerts and scheduling... i just need a plain timer to start at the top of the code and finish at the end...
any help, would be MUCH APPRECIATED!! :confused:
02-11-2004, 07:52 PM
cjard
Code:
long epoch = System.currentTimeMillis();
myREallySlowLongMethod();
long elapse = System.currentTimeMillis();
System.out.println("code took "+ (elapse-epoch)+" milliseconds to complete!");