with_timer function

Wrap a function to measure and display execution time