A decorator for timing functions.