https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93623
Bug ID: 93623
Summary: No need to dump gcdas when forking
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: gcov-profile
Assignee: unassigned at gcc dot gnu.org
Reporter: cdenizet at mozilla dot com
CC: marxin at gcc dot gnu.org
Target Milestone: ---
In order to have accurate counters, gcdas are dumped before a fork and counters
are reset.
I think the dump is pretty useless: we could just reset the counters in the
child process.
Let say a counter is N before the fork, then fork and this counter is set to 0
in the child process.
In the parent process, the counter is incremented by P and in the child process
it's incremented by C.
When dump is ran at exit, parent process will dump N+P for the given counter
and the child process will dump 0+C, so when the gcdas are merged the resulting
counter will be N+P+C: so it's correct.
So the dump is useless and is time consuming. In firefox we've a lot of
processes and a lot of gcdas, so the dump adds a lot of overhead.
I think it makes sense to dump/reset in the case of exec** functions since the
process is replaced by a new process and so the counters are definitly lost.