Reduce System.nanoTime() calls when profiling is enabled.

Signed-off-by: Ross Allan <rallanpcl@gmail.com>