Thu Mar 15 16:11:00 GMT 2007
On Thu, 15 Mar 2007, Ian Lance Taylor wrote:
> > Trying to imagine what random user would find more discourgrating - ie
> > longer train runs (still probably quite shorter than in ICC) or weird
> > looking mismatches and/or wrong resulting profile, I guess the former
> > is lesser evil and easier to analyze.
> It seems to me that the alternative to thread-safe profiling should just
> be that some nodes are undercounted, when two threads try to update the
> count simultaneously.
That is, what happens most of the time. Except for some counter types,
e.g. the one_value counter:
static inline void
__gcov_one_value_profiler_body (gcov_type *counters, gcov_type value)
if (value == counters)
else if (counters == 0)
counters = 1;
counters = value;
Here, if multiple threads want to touch the same counter with different
'value' arguments, it might happen that the first get's still into the
second if body (setting counter to 1, and counters to the value) and
all other threads get into the counters-- operation. In that case you
might end up with negative (or better: very large positive) values in
there, which I think are wildly wrong.
> It shouldn't be wildly wrong, just slightly wrong.
More information about the Gcc-patches