[Asterisk-Dev] CPU Profiling?

Steve Kann stevek at stevek.com
Thu Apr 21 08:17:27 MST 2005


Michael Giagnocavo wrote:

>Hello,
>
>	I've been trying to find some hotspots in Asterisk. I have a hunch
>that replacing some linked lists with hashtables (say, looking up peers and
>so on) should help a lot. I know that during loading (extensions, iax, sip),
>removing the list traversal code (to check for duplicates) speeds it up tons
>(quadratic to linear).
>  
>
Wouldn't this then break the semantics (i.e. require users/peers to be 
unique and such?).

>	I tried using google-perftools, their CPU profiler. However,
>apparently it only profiles the main thread, and requires a call to
>ProfilerRegisterThread on each thread. However, the profile is a CPP app,
>and if I try to link when calling ProfileRegisterThread in the source, I'm
>told undefined reference to `ProfilerRegisterThread'.
>  
>
Sounds like you need a C wrapper for the C++ function, or something like 
that; And, you'd need to link with g++ instead of gcc.

>	Has anyone succeeded in using Google's, or any other CPU profiler on
>Asterisk?
>  
>
You should be able to just build with -pg, run asterisk, and then use 
any tool that can read gmon.out (i.e. gprof), to read the profile that's 
created.

Alternatively, you can use a sample-based profiler, like "oprofile", but 
that requires some kernel support (which is likely included in your 
distro anyway..). However, this approach is generally a bit harder to 
get started with.

>	(My real goal is to get Asterisk handling with ease, say, 2000
>friends (SIP and IAX2). Any hints on this would be great.)
>  
>





More information about the asterisk-dev mailing list