compute_time function

Gathers and computes the timing of the different parts of the explain function.