This commit is contained in:
albert
2013-02-17 20:13:22 -05:00
parent cb5693b1c9
commit c9a0a3b6c3
3 changed files with 9 additions and 1 deletions

View File

@@ -4,6 +4,11 @@ module Memorylogic
end
def self.memory_usage
number_to_human_size(`ps -o rss= -p #{Process.pid}`.to_i * 1.kilobyte)
ps = Sys::ProcTable.ps(Process.pid)
if ps.respond_to?(:rss)
number_to_human_size(ps.rss.to_i * 1.kilobyte)
else
0
end
end
end