Re: [PATCH] [RFC] profiler updates

From: Alex Rousskov <rousskov_at_measurement-factory.com>
Date: Thu, 07 Jun 2012 08:46:21 -0600

On 06/06/2012 07:25 PM, Amos Jeffries wrote:
>>> + if (delta < head->best)
>>> + head->best = delta;
>>> + if (delta > head->worst)
>>> + head->worst = delta;
>>> + head->summ += delta;
>>> + head->count++;
>>> + head->overheads += get_tick() - stopped_;
>>
>> The above XProfilerNode::stop() code is not thread-safe because multiple
>> threads may update the same "head" and you are not using atomics for
>> *head members.
>
> Ok, for now this is the second major TODO.
> I'm torn between GCC __sync_* and C++11 atomic_* types.
>
> There is maybe a wrapper compat layer needed temporarily I think.

Since SMP Squid already uses GCC __sync_* primitives and has the
corresponding wrappers, consider reusing them for your project. See
ipc/AtomicWord.h for a starting point.

The existing wrappers can be adjusted to use C++11 atomic_* types when
those are provided by the build environment, but that sounds like a very
different project to me.

HTH,

Alex.
Received on Thu Jun 07 2012 - 14:46:25 MDT

This archive was generated by hypermail 2.2.0 : Sat Jun 09 2012 - 12:00:05 MDT