Once you grabbed the fine advice from the other replies and got your trace in place, take a moment to look at Proc::ProcessTable, as using the output of the ps command to parse into a tree is one of the least reliable ways to do. Not only might the output differ suddenly if the system updates the ps process (yes, that also can happen), but it for sure will be different on a different OS!

The output of ps might be similar of Linux distributions, but do not try to port your script to OpenBSD, AIX, HP-UX, Solaris, OSX, Windows, VMS, or OSF/1. Your first surprise may be that many options you used do not even exist!

HP-UX $ ps -eo pid,ppid,comm ps: illegal option -- o usage: ps [-edaxzflP] [-u ulist] [-g glist] [-p plist] [-t tlist] [-R +prmgroup] [-Z psetidlist] AIX $ ps -eo pid,ppid,comm PID PPID COMMAND 1 0 init 78030 143498 xntpd : NetBSD $ ps -eo pid,ppid,comm PID PPID COMMAND 5908 16576 USER=tux LOGNAME=tux HOME=/home/tux PATH=/usr/bin:/bin:/us +r/pkg/bin:/u 22789 5908 USER=tux LOGNAME=tux HOME=/home/tux PATH=/home/tux/bin:/us +r/local/bin: Windows C:\Users\Tux>ps -eo pid,ppid,comm 'ps' is not recognized as an internal or external command, operable program or batch file.

Enjoy, Have FUN! H.Merijn

In reply to Re: Help parsing this data by Tux
in thread Help parsing this data by cspctec

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.