I've got a Debian webhosting machine with cpu loads around 11. Using top I see that perl is using 99% of the cpu as user www-data. How can I find out more about what perl is actually doing?
1 Answer
strace -p PID
... where PID is the process ID should give you some information. You'll want to google for some simple articles on using it if you've never used it before, though. Depends on how familiar you are with system calls to interpret the information. You'll want to look at the manpage or articles to log it to a text file as the output may be very fast and dump a lot of information very quickly, and there are a number of options to use.
-
I tried that earlier (google's idea, I am not familiar w strace) and the results were a long list of: select(752, [748], NULL, NULL, {0, 0}) = 0 (Timeout) so I thought I might have misunderstood what strace did. But thanks, I'll dig deeper.– karmetJan 12, 2012 at 20:28
-
@kswift select() is a function to wait for a file descriptor (possibly a file or a socket) to become ready for an operation - in this case a read operation (see
man 3 select
for details. The descriptor ID is process-specific, just runreadlink /proc/<pid>/fd/748
to see what it is. Jan 13, 2012 at 15:12