Reputation: 155
My MVC3 application is not running as fast as I hoped. I'd like to find out if some of the database look ups are taking too long. Is there a way that I can time part of a block of code within a controller. For example:
var a = the_time_now;
...
...
var b = the_time_now;
<log the code area name and time b - time a
I am fairly new to MVC and would appreciate any advice. Note that I currently have no uses on my system so if I was logging the time then it would not load things down too much :-)
Upvotes: 2
Views: 119
Reputation: 39491
Use the Stopwatch class for the code execution time tracking. this is not titly bound to MVC, this is used generally in .net Framework
Upvotes: 2