tracing only direct childrens

Carlos O'Donell carlos@systemhalted.org
Thu Nov 26 14:36:00 GMT 2009


On Thu, Nov 26, 2009 at 9:03 AM, Shameem Ahamed
<shameem.ahamed@yahoo.com> wrote:
> Hi Guys,
>
> I know this is not the correct list to ask this question. But I am sure somebody from here can help me out.
>
> My problem is, i am trying to trace a currently running Apache root process for creation of childs using strace.  But strace also lists the details of childs of childs. I want to restrict my trace only to the direct childrens.
>
> How can we do it? .

This is off-topic for this list. Please contact the strace developers.
AFAIK there is no specific feature to trace only direct children. You
would have to add a new feature to strace to trace children of only a
certain depth.

A quick hack might be to use -ttt -ff -o <filename>

The algorithm would look like this:
* for all forks in the parent <filename>.pid call them <fork pid>
  * read the filename <filename>.<fork pid> and merge with <filename>.pid
* sort all lines using the timestamp.
* write out new merged file.

The final file would have only the parent and all immediate children trace data.

Cheers,
Carlos.



More information about the Libc-help mailing list