Method: LinuxStat::Process.types
- Defined in:
- lib/linux_stat/process.rb
.types ⇒ Object
Returns all the id of processes mapped with their status as a Hash.
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/linux_stat/process.rb', line 78 def types h, i = {}, -1 l = list count = l.length while(i += 1) < count x = l[i] begin h.merge!(x => case LinuxStat::ProcFS.ps_state(x) when ?S.freeze then :sleeping when ?I.freeze then :idle when ?Z.freeze then :zombie when ?R.freeze then :running when ?T.freeze then :stopped when ?X.freeze then :dead when ?D.freeze then :sleeping when ?t.freeze then :stopped else :unknown end ) rescue StandardError end end h end |