15 't' => "tracing-stop",
20 %states = map {$_=>0} values %psState;
21 %Processes = ('state' => \
%states);
23 opendir my $dir, '/proc';
25 while(my $pid = readdir $dir)
29 $Processes{'count'}++;
32 open my $fh, '<', "/proc/$pid/status";
35 if(/^Threads:\s*(\d+)/)
37 $Processes{'threads'} += $1;
39 elsif(/^(Tgid|VmLck):\s*(\d+)/)
46 open my $fh, '<', "/proc/$pid/stat";
50 if(my ($state, $pgrp, $session, $tpgid, $flags, $priority, $nice, $nlwp) =
51 $stat =~ /\) (.) -?\d+ (-?\d+) (-?\d+) -?\d+ (-?\d+) (-?\d+) (?:-?\d+ ){4}(?:-?\d+ ){4}(-?\d+) (-?\d+) (-?\d+)[ \d-]*$/)
53 $Processes{'state'}{$psState{uc$state} || $state}++;
54 $Processes{'hi_prio'}++ if $nice < 0;
55 $Processes{'lo_prio'}++ if $nice > 0;
56 $Processes{'locked-pages'}++ if $procprop{'VmLck'} > 0;
57 $Processes{'session-leader'}++ if $session == $procprop{'Tgid'};
58 $Processes{'multithreaded'}++ if $nlwp > 1;
59 $Processes{'foreground'}++ if $pgrp == $tpgid;
64 svlhk_dump
(\
%Processes);