This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
-pg profiling instrumentation question
- From: Juan Carlos Franzoy <jfranzoy at yahoo dot com dot ar>
- To: binutils at sourceware dot org
- Date: Wed, 23 Jan 2008 08:42:33 -0800 (PST)
- Subject: -pg profiling instrumentation question
Hello. I have already post this message on a gcc mailing list. I was told to post it here.
I am having problems profiling an application. I think the problem is that one of our libraries break -pg instrumentation. This library hide portabilities issues under a portable interface, allowing us to run in console mode, in daemon mode in unices or as a service in windows. As you may guess, it is a complex library that do a lot of things. I do not know which of these may be hurting -pg.
This pseudocode is a description of what I am doing.
void a() {}
void b() { for(int i=0; i < 10000; ++i) a(); }
void f() {}
void g() { for(int i=0; i < 10000; ++i) f(); }
class MyModule() ... {
public:
...
void operator()() {
...
// *2
for(int i=0; i < 10000; ++i) g();
return;
}
} myModule( .... );
int main() {
...
// *1
for(int i=0; i < 10000; ++i) b();
mylib::registerModule(myModule);
mylib::run(); // create a thread per module
...
}
The problem is that the profiling information contain time information for b() and a() but no for g() and f(). On the other hand the call count is the same.
--- gprof output ---
Flat profile:
Each sample counts as 0.01 seconds.
% self self total
time seconds calls ms/call ms/call name
50.00 0.22 10000 0.02 0.04 a()
29.55 0.13 100000000 0.00 0.00 b()
20.45 0.09 1 90.00 90.00 _static_init
0.00 0.00 100000000 0.00 0.00 f()
0.00 0.00 10000 0.00 0.00 g()
...
--- end of gprof output ---
Note: I already try making a sigprocmask, pthread_mask to unblock SIGPROF in *1 and *2. I also verifíed that the signal handler of SIGPROF is the same in *1 and *2, it is a valid pointer, not SIG_DFL nor SIG_IGN. I also tried to add a call to moncontrol(1) in *2. This seems to work, at least it displays something != 0 in %time column.
If somebody can help will make me happy. Thanks.
Juan Carlos.
Tarjeta de crédito Yahoo! de Banco Supervielle.
Solicitá tu nueva Tarjeta de crédito. De tu PC directo a tu casa. www.tuprimeratarjeta.com.ar