开发者

Visual Studio Resources

I've got a relatively small program that runs on a proxy socket class I fount from the mentalis website. For some reason this program has quickly become a 100% cpu resource hog when running. I've done all I can think to find the problem in the code is there a function in visual studio that helps to identify what sections of the code are the most resource intensive? Any ideas on why a socket class would be开发者_JS百科 such a cpu hog?


Visual Studio 2010 Premium and Enterprise editions have a profiler built in -- I believe the feature is called 'Performance Explorer.' If that's not available, just do a debug build and do some manual profiling by stopping the code periodically to see which code is executed most frequently (edit: as mentioned by Doc Brown).


Run your program in debug mode and when the CPU load goes to 100%, break the running process with Ctrl-Alt-Break. It is very likely that you stop the program exactly in the part of the code which is cause of your problem. If one break is not enough to find the right code line, repeat this several times.

Just a guess: perhaps the socket class does some kind of polling or busy-waiting?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜