Apologize if this is something much simpler than what is normally discussed on this forum.

I am looking for a way to permanently insert probes around code that I often need to profile, without having to run a profiler or similar. I simply want to be able to switch a configuration element, and the execution time for certain areas of code should be accessable. It should be lightweight, with minimal impact on the rest of my projects.

I have a pretty good idea of one way of doing it, like this:
using (MyTimer.NewTimer("ExecuteSomeCode))
{
... SomeCode
}

The NewTimer would start a stopwatch and either write the result to the debug window or send it to a performance counter.

Now, I guess there as been lots of similar thoughts before (I hope...), and perhaps some utilities/code I can re-use. Any ideas?
Or, if you have better ideas, please let me know!

/Fredrik


Fred