性能工具
我基本上有一个 unix 进程正在运行,它正在执行一些繁重的处理以及通过网络输出数据。我想知道什么系统调用用于与网络层交互。
我想测量这个过程的性能指标:CPU 使用率、网络使用率。我不确定这个进程是否被阻止,因为它向网络层写入的速度太快,或者这个进程是否花费了太多时间处理代码。
有什么建议吗?
谢谢!
I basically have a unix process running and it is doing some heavy processing as well as outputting data over the network. I was wondering what system calls are used to interact with the networking layer.
I would like to measure the performance metrics of this process: CPU usage, networking usage. I am not sure if this process is blocked because it is writing way too fast to the networking layer or if this process is spending too much time processing code.
Any suggestions?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
什么Unix? Solaris/FreeBSD/OSX 有 dtrace,Linux 有 oprofile。它们都有tcpdump供你分析网络流量。
What Unix? Solaris/FreeBSD/OSX have dtrace, Linux has oprofile. All of them have tcpdump for you to analyze the network flow.
您真正需要的是一个分析器。这样,您将能够看到代码的哪些部分花费了最多时间。
尝试 http://oprofile.sourceforge.net/ 或适合您的工具链的特定分析器。
作为快速测量,您可以尝试在 strace 下运行您的进程,以查看哪个系统调用它制作并现场查看他们需要多长时间。
What you really need is a profiler. That way, you'll be able to see which parts of your code are taking the most time.
Try http://oprofile.sourceforge.net/, or a specific profiler for your toolchain.
As a quick measurement you can try running your process under strace to see which system calls it makes and see live how long they take.
我建议 valgrind 这是另一个分析器。
I suggest valgrind which is another profiler.