Time function calls. Repeat a function every n milliseconds.