Open GoogleCodeExporter opened 9 years ago
I've been battling against this issue as well. To be clear, I'm talking about
sub-PROCESSES created using fork() here.
The problem seems to be that the interval timer is set only once at the start
of the program. Timers are not inherited by child processes (according "man 2
fork"). The signal handler is set up when you call ProfileStart(), but the
timer must be reset as well. Try adding the following workaround either just
after you call ProfileStart() or just after you fork(). This fixes the issue
for me.
----->
struct itimerval t;
t.it_interval.tv_sec = 0;
t.it_interval.tv_usec = 1000;
t.it_value = t.it_interval;
setitimer(ITIMER_PROF, &t, NULL);
<-----
Original comment by t...@bitwiz.org.uk
on 30 Nov 2012 at 1:29
Alternatively, call ProfilerRegisterThread(). Perhaps an expert can comment on
the correct way to make this work - the details don't seem to be in any of the
documentation I could find.
Original comment by t...@bitwiz.org.uk
on 30 Nov 2012 at 2:19
Any chance one of you guys can provide a sample program that reproduces the
issue so that we can try to put together a patch based on the above workaround?
Original comment by chapp...@gmail.com
on 11 Mar 2013 at 1:08
There's a simple one in the original post above, but here's another one which
illustrates the workaround and the actual/expected results.
Original comment by t...@bitwiz.org.uk
on 10 May 2013 at 1:16
Attachments:
Issue 543 has been merged into this issue.
Original comment by alkondratenko
on 15 Sep 2013 at 12:10
Original comment by alkondratenko
on 15 Sep 2013 at 12:37
Original issue reported on code.google.com by
ranjiao
on 8 Aug 2012 at 7:13Attachments: