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

2009-12-09 Thread Adrian Chadd
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 :
> 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
>                                                    
> [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]
> <...>
> ---
>                                                    
> [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
>  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
>>
>
>


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

2009-12-09 Thread Amos Jeffries
On Wed, 9 Dec 2009 09:57:52 -0800, Guy Bashkansky 
wrote:
> 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

Have you had a look at the customizations and seen if they are now handled
by built-in features? There were a great many Squid-2.3 thru Squid-2.5
custom patches merged into mainline for 2.6+.

If the customization is still missing and actually all that useful we'd be
interested in hearing about it.

> not have builtin timers.  Since what version did they appear?

Way prior to 2.5.STABLE1 sometime.


Amos


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

2009-12-09 Thread Guy Bashkansky
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  %timeself descendents  called+selfname   index
 called/total   children

[1] 63.40.170.00 _mcount [1]
---
   0.000.10   1/1   _start [3]
[2] 36.00.000.10   1 main [2]
   0.000.10   1/1   parseConfigFile [4]
<...>
---

[3] 36.00.000.10 _start [3]
   0.000.10   1/1   main [2]
---
   0.000.10   1/1   main [2]
[4] 36.00.000.10   1 parseConfigFile [4]
   0.000.09   1/1   readConfigLines [5]
   0.000.00 169/6413parse_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
 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
>


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

2009-12-09 Thread Robert Collins
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


signature.asc
Description: This is a digitally signed message part