Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Better way to search in the process table?

by hdb (Monsignor)
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"; }

Replies are listed 'Best First'.
Re^2: Better way to search in the process table?
by karlgoethebier (Prior) 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 all is quiet...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (5)
As of 2017-12-14 09:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What programming language do you hate the most?




















    Results (385 votes). Check out past polls.

    Notices?