Stack Overflow opens sources of their ASP.NET MVC mini profiler. It is a simple but effective mini-profiler for ASP.NET MVC.
The sources can be found here – http://code.google.com/p/mvc-mini-profiler/.
One of important features of mini-profile is Database profiling. The built in database profiler supports any kind of DbConnection.
It also supports Entity Framework and LINQ-2-SQL.
Read more:
– http://samsaffron.com/archive/2011/06/09/+Profiling+your+website+like+a+true+Ninja