Visual Studio 2008 探查器分析 - 缺失时间
我针对 ASP.NET 应用程序运行了 Visual Studio 2008 探查器,并得到了以下结果集。
CURRENT FUNCTION TIME (msec)
---------------------------------------------------|--------------
Data.GetItem(params) | 10,158.12
---------------------------------------------------|--------------
Functions that were called by Data.GetItem(params) TIME (msec)
---------------------------------------------------|--------------
Model.GetSubItem(params) | 0.83
Model.GetSubItem2(params) | 0.77
Model.GetSubItem3(params) | 0.76
etc.
我面临的问题是 Data.GetItem(params) 调用的函数总和不等于 10,158.12 毫秒 总数。这让我相信大部分时间实际上都花在了执行该方法中的代码上。
我的问题是...Visual Studio 是否提供了一种分析方法本身的方法,以便我可以看到哪些代码部分花费的时间最长?如果没有,有什么推荐的工具可以做到这一点吗?或者我应该开始编写自己的计时脚本?
谢谢
I ran the Visual Studio 2008 profiler against my ASP.NET application and came up with the following result set.
CURRENT FUNCTION TIME (msec)
---------------------------------------------------|--------------
Data.GetItem(params) | 10,158.12
---------------------------------------------------|--------------
Functions that were called by Data.GetItem(params) TIME (msec)
---------------------------------------------------|--------------
Model.GetSubItem(params) | 0.83
Model.GetSubItem2(params) | 0.77
Model.GetSubItem3(params) | 0.76
etc.
The issue I'm facing is that the sum of the Functions called by Data.GetItem(params) do not sum up to the 10,158.12 msec total. This would lead me to believe that the bulk of the time is actually spent executing the code within that method.
My question is ... does Visual Studio provide a way to analyze the method itself so I can see which sections of code are taking the longest? if it does not are there any recommended tools to do this? or should I start writing my own timing scripts?
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
VS 2008 分析器不支持块级分析,但我相信 Red Gate 的分析器 确实如此。
The VS 2008 profiler does not support block level profiling, but I believe that Red Gate's profiler does.
不要专注于对代码进行计时。这就是自上而下的方法。
自下而上的方式更有效。
此方法有效在 Visual Studio 中很好。
Don't concentrate on timing the code. That's the top-down approach.
Bottom-up is way more effective.
This method works just fine in Visual Studio.
另一种方法是将 GetItem 方法分解为许多较小的方法(可能进行二进制切割)以缩小时间花费的范围。可能比编写一些计时脚本更容易。
An another approach would be to break up your GetItem method into a number of smaller methods (perhaps doing a binary chop) to narrow down where the time is being spent. Probably easier than writing some timing scripts.