Skip to content

Commit

Permalink
count Swap in addition to Pss
Browse files Browse the repository at this point in the history
  • Loading branch information
schneems committed Apr 7, 2014
1 parent edd767c commit 17e6b9a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/get_process_mem.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def mem_type=(mem_type)
# It also allows us to use Pss (the process' proportional share of
# the mapping that is resident in RAM) as mem_type
def linux_memory(file = @process_file)
lines = file.each_line.select {|line| line.match /^Pss/ }
lines = file.each_line.select {|line| line.match /(^Pss|^Swap)/ }
return if lines.empty?
lines.reduce(0) do |sum, line|
line.match(/(?<value>(\d*\.{0,1}\d+))\s+(?<unit>\w\w)/) do |m|
Expand Down

0 comments on commit 17e6b9a

Please sign in to comment.