Strace

From Wiki

Jump to: navigation, search

STRACE - Traces System Calls and Signals

Strace is used for debugging process etc. which may be causing high CPU usage etc. which may be identified using "top" and/or "ps -eaf" etc.

Problem: A particular process is eating/using up CPU time. There are no logs from the process/program itself and you need to find out what is causing the bottleneck/problem.

Step 1: Find the PID (process id)

ps -eaf | grep process
// or
pgrep process

Step 2: Run strace and attach to process.

strace -fp processID
// f = trace child processes as they are forked
// p = attach to processID

strace -fp processID -o outputfile

strace -fp processID -o outputfile -r
// appends a timestamp to each line of output.

I hope you solve your problem. Issues you may find -> Files not existing, Cannot read/write to files. Repeated connection attempts by users etc.


More info at: http://www.debian-administration.org/articles/352

Personal tools