Tuesday, February 13, 2007

investigate system calls of a process

Sometimes it is important to monitor the system calls when a process is
running. by monitoring that, you can find what the system do when u see
an unusual delay.

syntax: strace -p <process ID>

sris@sris:~$ strace -p 9860

Process 9860 attached - interrupt to quit
select(0, NULL, NULL, NULL, {0, 702000}) = 0 (Timeout)
waitpid(-1, 0xbfaa0750, WNOHANG|WSTOPPED) = 0
select(0, NULL, NULL, NULL, {1, 0}) = 0 (Timeout)
waitpid(-1, 0xbfaa0750, WNOHANG|WSTOPPED) = 0
select(0, NULL, NULL, NULL, {1, 0} <unfinished ...>
Process 9860 detached


strace -pt <process_id> will prefix the time of the day with each sys
call printed.

sris@sris:~$ strace -t -p 9860
Process 9860 attached - interrupt to quit
02:00:26 select(0, NULL, NULL, NULL, {0, 855000}) = 0 (Timeout)
02:00:26 waitpid(-1, 0xbfaa0750, WNOHANG|WSTOPPED) = 0
02:00:26 select(0, NULL, NULL, NULL, {1, 0}) = 0 (Timeout)
02:00:27 waitpid(-1, 0xbfaa0750, WNOHANG|WSTOPPED) = 0
02:00:27 select(0, NULL, NULL, NULL, {1, 0} <unfinished ...>
Process 9860 detached

0 Comments:

Post a Comment

<< Home