Re: [RFC} threadsafe internal profiler

From: Alex Rousskov <rousskov_at_measurement-factory.com>
Date: Tue, 11 Jan 2011 18:20:48 -0700

On 01/11/2011 02:08 AM, Kinkie wrote:
> On Tue, Jan 11, 2011 at 8:03 AM, Amos Jeffries <squid3_at_treenet.co.nz> wrote:
>> The profiler aufs assertions are caused by the profiler not being thread
>> safe but attempting to account operations inside each of the AIO threads.
>> Lack of thread safety is due to the stack the profiler maintains of what
>> states are currently being counted.
>>
>> I don't believe we should be maintaining such a stack. Instead I think we
>> should leverage the existing system stack by having the PROF_start(X) macro
>> create a counter object in the local scope being counted. When the local
>> scope exists for any reason the system stack object will be destructed and
>> the destructor can accumulate the counters back into the global data.
>
> +1. I like this.

I have a crude patch that implements such scope-based profiling. We used
it to find performance regressions in Squid3 (still an ongoing project)...

I would be happy to find that patch and post if somebody wants to polish it.

Thank you,

Alex.
Received on Wed Jan 12 2011 - 01:21:02 MST

This archive was generated by hypermail 2.2.0 : Wed Jan 12 2011 - 12:00:04 MST