Skip to content

Commit

Permalink
revert back to RSS until #7 is solved
Browse files Browse the repository at this point in the history
  • Loading branch information
schneems committed Jun 16, 2014
1 parent 10816f3 commit ed81d8f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
## 0.2.1

- Reverting back to RSS for linux until (#7) is resolved

## 0.1.1

- Bugfix: the `ps` style of memory reporting should always use RSS, and Linux should always use PSS

## 0.1.0
Expand Down
2 changes: 1 addition & 1 deletion lib/get_process_mem.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def mem_type=(mem_type)
# linux stores memory info in a file "/proc/#{pid}/smaps"
# If it's available it uses less resources than shelling out to ps
def linux_memory(file = @process_file)
lines = file.each_line.select {|line| line.match /^Pss/ }
lines = file.each_line.select {|line| line.match /^Rss/ }
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
2 changes: 1 addition & 1 deletion test/get_process_mem_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def test_seems_to_work
def test_linux_smap
delta = 1
bytes = @mem.linux_memory(fixture_path("heroku-bash-smap"))
assert_in_delta BigDecimal.new("1217024.0"), bytes, delta
assert_in_delta BigDecimal.new("2122240.0"), bytes, delta
end

def test_conversions
Expand Down

0 comments on commit ed81d8f

Please sign in to comment.