Skip to content

Instantly share code, notes, and snippets.

View yfeldblum's full-sized avatar

Jay Feldblum yfeldblum

  • Meta
  • San Jose, CA
View GitHub Profile
# Taken from passenger_memory_stats script
# Returns the private dirty RSS for the given process, in KB.
def determine_private_dirty_rss(pid)
total = 0
File.read("/proc/#{pid}/smaps").split("\n").each do |line|
line =~ /^(Private)_Dirty: +(\d+)/
if $2
total += $2.to_i
end