Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Better way to search in the process table?

by hdb (Prior)
on Mar 02, 2014 at 22:17 UTC ( #1076745=note: print w/ replies, xml ) Need Help??


in reply to Better way to search in the process table?

I would build a tree of parent ids:

use strict; use warnings; use Proc::ProcessTable; my $p = new Proc::ProcessTable; my $t = $p->table; my %tree; $tree{$_->pid} = $_->ppid for @$t; for my $process ( @$t ) { print $process->cmndline; my $pid = $process->pid; while( $pid > 1 ) { print "->$pid"; $pid = $tree{$pid} } print "->$pid\n"; }


Comment on Re: Better way to search in the process table?
Download Code
Re^2: Better way to search in the process table?
by karlgoethebier (Curate) on Mar 03, 2014 at 15:15 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1076745]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2014-10-22 06:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (114 votes), past polls