My MVC3 application is not running as fast as I hoped. I'd like to find out if s开发者_运维百科ome 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 :-)
Use the Stopwatch class for the code execution time tracking. this is not titly bound to MVC, this is used generally in .net Framework
精彩评论