You can also watch AOP and dynamically create a wrapper for Timing methods (it will only work on non-static public methods).
If you use IoC, you just need to register types with a decorator, this, of course, can be configured and turned on and off, if necessary, or even by certain methods.
I used Castle: DynamicProxy before to achieve just that (for recording time and errors).
Edit: example (from the old version of the lock: dynamic proxy)
TimerInterceptor : IInterceptor { public void Intercept(IInvocation invocation) { Stopwatch watch = new Stopwatch(); watch.Start(); invocation.Proceed(); watch.Stop();
source share