Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: process table

by roboticus (Chancellor)
on Dec 20, 2013 at 19:48 UTC ( #1067985=note: print w/ replies, xml ) Need Help??


in reply to process table

teamassociated:

Because you have two CPUs, and a hash holds one item. So the last one read wins for each CPU. Try this to get a hash of arrays (HoA):

push @{$prochash{$cpu}}, { 'pid' => $pid, 'time' => $time, 'user' => $user, 'args' => $args, };

Or if you want a hash of hashes (HoH), use the first level for the CPU and the second for the PID:

$prochash{$cpu}{$pid} = { 'pid' => $pid, 'time' => $time, 'user' => $user, 'args' => $args, };

There are other ways to do it, too. You may want to review perldoc perldsc

Update: Changed language a little to clarify.

...roboticus

When your only tool is a hammer, all problems look like your thumb.


Comment on Re: process table
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2015-07-04 17:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (60 votes), past polls