Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
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"; }

Replies are listed 'Best First'.
Re^2: Better way to search in the process table?
by karlgoethebier (Parson) 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 about the Monastery: (11)
As of 2016-06-30 15:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My preferred method of making French fries (chips) is in a ...











    Results (396 votes). Check out past polls.