Performance Profiler makes it easier to get execution times for your methods, and find execution bottlenecks. It requires minimum changes to your code. You only need to change one line of code in most scenarios.

We focus on keeping things simple. We don't want you jumping through hoops in order to time the execution of your classes. Here is a basic example.

Let assume you have the following routine:

List<int> list = new List<int>();
foreach (var v in Enumerable.Range(1, 1000))
{
list.Insert(0, v);
}

Would you like to see how the Insert method performs as the list increases in size? Here is how PerformanceProfiler can help:

dynamic list = new List<int>().GetProfiler();
foreach (var v in Enumerable.Range(1, 1000))
{
list.Insert(0, v);
}

The profiler is a dynamic object wrapping around your object. It acts like a proxy, and it times the execution of the methods in the original object. These execution times are logged using the Debug class. So, you can go and collect the time of each call into the list. This is not limited to methods. You can also time properties (get/set), including indexers.

Please, feel free to check our little project and let us know your thoughts.

Thanks.

Last edited May 10, 2012 at 4:47 AM by carlosearm, version 4