如何分析 .NET 应用程序的网络利用率
我有一个 .NET Windows 服务,它可以执行很多网络魔法(WMI、Ping 等 - 列表很长)。我想尽可能轻松和详细地分析应用程序总共使用了多少带宽以及代码中的每个部分。
有什么工具可以帮助我做到这一点吗?例如,Ants profiler 将帮助我进行内存分析和处理器利用率分析。然而,它对网络分析没有多大作用。有没有类似 ANT 的网络分析工具?如果没有,那么在获取这些信息时我有哪些选择?
感谢
回应一些答案:添加澄清
无论是什么工具,如果它不能直接链接到代码(我认为这是不可能的),它需要能够在无人值守的情况下运行数天跟踪(记录到文件或数据库)进程使用的网络流量。它必须能够直接指定进程(wireshark 无法做到)。 Microsoft 网络监视器可以做到这一点,但是,它执行的操作要多得多(逐帧进行大量解析),以至于由于性能问题而无法使用(运行几个小时后,我已经有一百万帧需要统计。如果我尝试将这些内容复制到 Excel 或数据库中,仅复制一项就需要 30 多分钟)。
确实,这看起来是一件很简单的事情,但是,我很难找到一个可以完成我想要的事情的工具。
I have a .NET windows service that does a lot of network magic (WMI, Ping, etc - the list is very long). I would like to profile, with as much ease and detail as possible, how much bandwidth the application uses in total as well each part in the code.
Are there any tools that can help me do that? Ants profiler for example will help me with memory profiling and processor utilization profiling. However it doesn't do much with network profiling. Is there anything like ANTs for network profiling? If not, then what are my options when it comes to getting this information?
Thanks
In Response to some answers: added for clarification
Whatever the tool, if it cannot directly link to the code (which I don't think is possible) it needs to be able to run unattended for days keeping track (logging to a file or database) of the network traffic used by a process. It must be able to directly specify the process (which wireshark cannot do). Microsoft Network Monitor can do that, however, it does so much more (so much parsing - frame by frame) that its not usable because of performance issues (after a few hours of running I already have a million frames to tally up. If i try to copy the stuff into excel or a database, the copy alone takes over 30 minutes).
Really, it would seem like such a simple thing to do, however, I’m having a surprisingly hard time finding a tool that would do what i want.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以使用实用程序 Wireshark 捕获从运行服务的计算机发出的所有数据包。然后,您可以根据数据包中的内容过滤这些数据包,以限制您关心的数据包。使用该信息,您可以找到您正在寻找的指标。
You can make use of the utility Wireshark to capture all packets going out of the machine the service is running on. You can then filter those packets based on the content within it to limit to those packets that you care about. Using that information you can find the metrics you're looking for.
我非常喜欢 SocketSniff。它附加到单个正在运行的进程,并显示所有套接字相关的流量。它不像 WireShare 那样具有出色的解码能力,但它也消除了很多噪音。
I quite like SocketSniff. It attaches to a single running process, and shows all socket related traffic. It doesn't have great decoding like WireShare does, but it removes a lot of the noise as well.
您可以尝试 MS Visual往返分析器(使用MS 网络监视器),或者可能只是网络监视器本身。
You can try the MS Visual Roundtrip Analyzer (which uses MS Network Monitor), or perhaps just Network Monitor itself.