Re: [squid-users] 'gprof squid squid.gmon' only shows the initial configuration functions

From: Adrian Chadd <adrian_at_squid-cache.org>
Date: Thu, 10 Dec 2009 09:23:16 +0800

Talk to the freebsd guys (eg me) about pmcstat and support for your
hardware. You may just need to find / organise a backport of the
particular hardware support for your platform. I've been working on
profiling Lusca with pmcstat and some new-ish tools which use and
extend it in useful ways.

gprof data is almost certainly uselessly unreliable on modern CPUs.
Too much can and will happen between profiling ticks.

I can hazard a few guesses about where your CPU is going. Likely
candidate is poll() if your Squid is too old. First thing to do is
organise porting the kqueue() stuff if it isn't already included.

I can make more educated guesses about where the likely CPU hog
culprits are given workload and configuration file information.

Adrian

2009/12/10 Guy Bashkansky <guybas_at_gmail.com>:
> Is there an oprofile version for FreeBSD?  I thought it is limited to
> Linux.  On FreeBSD I tried pmcstat, but it gives an initialization
> error.
>
> My version of Squid is old and customized (so I can't upgrade) and may
> not have builtin timers.  Since what version did they appear?
>
> As for gprof - even with the event loop on top, still the rest of the
> table might give some idea why the CPU is overloaded.  The problem is
> - I see only initial configuration functions:
>
>                                 called/total       parents
> index  %time    self descendents  called+self    name           index
>                                 called/total       children
>                                                    <spontaneous>
> [1]     63.4    0.17        0.00                 _mcount [1]
> -----------------------------------------------
>               0.00        0.10       1/1           _start [3]
> [2]     36.0    0.00        0.10       1         main [2]
>               0.00        0.10       1/1           parseConfigFile [4]
> <...>
> -----------------------------------------------
>                                                    <spontaneous>
> [3]     36.0    0.00        0.10                 _start [3]
>               0.00        0.10       1/1           main [2]
> -----------------------------------------------
>               0.00        0.10       1/1           main [2]
> [4]     36.0    0.00        0.10       1         parseConfigFile [4]
>               0.00        0.09       1/1           readConfigLines [5]
>               0.00        0.00     169/6413        parse_line [6]
> ..
> ========================
>
> System info:
>
> # uname -m -r -s
> FreeBSD 6.2-RELEASE-p9 amd64
>
> # gcc -v
> Using built-in specs.
> Configured with: FreeBSD/amd64 system compiler
> Thread model: posix
> gcc version 3.4.6 [FreeBSD] 20060305
>
>
> There are 7 fork()s for unlinkd/diskd helpers.  Can these fork()s
> affect profiling info?
>
> On Wed, Dec 9, 2009 at 2:04 AM, Robert Collins
> <robertc_at_robertcollins.net> wrote:
>> On Tue, 2009-12-08 at 15:32 -0800, Guy Bashkansky wrote:
>>> I've built squid with the -pg flag and run it in the no-daemon mode
>>> (-N flag), without the initial fork().
>>>
>>> I send it the SIGTERM signal which is caught by the signal handler, to
>>> flag graceful exit from main().
>>>
>>> I expect to see meaningful squid.gmon, but 'gprof squid squid.gmon'
>>> only shows the initial configuration functions:
>>
>> gprof isn't terribly useful anyway - due to squids callback based model,
>> it will see nearly all the time belonging to the event loop.
>>
>> oprofile and/or squids built in analytic timers will get much better
>> info.
>>
>> -Rob
>>
>
>
Received on Thu Dec 10 2009 - 01:23:24 MST

This archive was generated by hypermail 2.2.0 : Thu Dec 10 2009 - 12:00:01 MST