开发者

How can I track the time it takes a block of my MVC3 code to execute?

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜