[Asterisk-Users] Standalone S100U: Is there some trick?

Mark Spencer markster at digium.com
Sun Mar 23 15:18:37 MST 2003


> Not sure how I can look "inside" to see what asterisk could be doing. .

While it's running, you can do "ps auxww | grep asterisk".  Look for the
PID of the process taking the CPU.  For example:


root      1206  0.0  0.9 118576 4904 pts/2   S    Mar21   0:00 ./asterisk -vvvgc
.
.
.
root      1216  0.0  0.9 118576 4904 pts/2   S    Mar21   1:52 ./asterisk -vvvgc

This thread has taken 1:52 in CPU time.  So, we now run gdb on the *first*
PID of asterisk, *not* necessarily the with the highest CPU...

# gdb ./asterisk 1206

And you'll eventulaly be dumped at something like this:

0x40188544 in __libc_read () from /lib/i686/libc.so.6
(gdb)

Now type "info threads" to see all the threads.  The one with the matching
LWP is the one you want.  For example:

 9 Thread 7176 (LWP 1216)  0x4018d9f7 in __poll (fds=0x80d5ef0, nfds=1,
    timeout=1000) at ../sysdeps/unix/sysv/linux/poll.c:63

Now switch like this:

(gdb) thread 9
and now "bt" for "backtrace"

(gdb) bt

And you'll get something like this:

#0  0x4018d9f7 in __poll (fds=0x80d5ef0, nfds=1, timeout=1000)
    at ../sysdeps/unix/sysv/linux/poll.c:63
#1  0x08050adc in ast_io_wait (ioc=0x80d4e00, howlong=1000) at io.c:255
#2  0x4330b96d in network_thread (ignore=0x0) at chan_iax.c:4274
#3  0x40035b9c in pthread_start_thread (arg=0x43c11be0) at manager.c:274
(gdb)

That tells us the thread in question is the IAX network thread runing in
chan_iax.

Does that help?

Mark




More information about the asterisk-users mailing list