问题描述
我有一个程序我想gprof配置文件。问题(似乎)是它使用套接字。所以我得到这样的东西:
:: select():中断系统调用
我打回这个问题,放弃了,然后继续。但我真的想能够配置我的代码,使用gprof如果可能的话。我能做什么?有没有一个gprof选项我缺少?套接字选项?在这些类型的系统调用的情况下,gprof是完全无用的吗?
- 平台:
- Linux 2.6(x64)
- GCC 4.4.1
- gprof 2.19
套接字代码需要处理中断的系统调用,无论剖析器如何,但在剖析器中,这是不可避免的。这意味着有代码。
if(errno == EINTR){...
$ c $
=http://book.chinaunix.net/special/ebook/addisonWesley/APUE2/0201433079/ch10lev1sec5.html =nofollow>此处为背景。
I have a program I want to profile with gprof. The problem (seemingly) is that it uses sockets. So I get things like this:
::select(): Interrupted system call
I hit this problem a while back, gave up, and moved on. But I would really like to be able to profile my code, using gprof if possible. What can I do? Is there a gprof option I'm missing? A socket option? Is gprof totally useless in the presence of these types of system calls? If so, is there a viable alternative?
EDIT: Platform:
- Linux 2.6 (x64)
- GCC 4.4.1
- gprof 2.19
解决方案 The socket code needs to handle interrupted system calls regardless of profiler, but under profiler it's unavoidable. This means having code like.
if ( errno == EINTR ) { ...
after each system call.
Take a look, for example, here for the background.
这篇关于使用gprof与套接字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!