From charlesreid1

Revision as of 02:44, 20 March 2017 by Admin (talk | contribs) (Created page with "If you want an extremely detailed picture of how much time you're spending in the various parts of your code, you can use a profiler: see Java/Profiling If you just want...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

If you want an extremely detailed picture of how much time you're spending in the various parts of your code, you can use a profiler: see Java/Profiling

If you just want to see how much time a piece of code takes to execute, you can use Java's built in time functionality:

long start = System.nanoTime();
doStuff();
long end = System.nanoTime();
long duration = end - start;
System.out.printf("Elapsed time: %03f s\n", duration/1E9);