[PATCH] Factorize timing functions to a separate file