lib/rbbt/util/misc/development.rb in rbbt-util-5.37.1 vs lib/rbbt/util/misc/development.rb in rbbt-util-5.37.3

- old
+ new

@@ -395,10 +395,16 @@ res = nil unless options[:into] res end end def self.memory_use(pid=nil) - `ps -o rss -p #{pid || $$}`.strip.split.last.to_i + pid ||= $$ + begin + CMD.cmd("grep 'VmRSS:' /proc/#{pid}/status").read.scan(/\d+/).first.to_i + rescue ProcessFailed + raise "Process with #{pid} not found" + end + #`ps -o rss -p #{pid || $$}`.strip.split.last.to_i end def self.unzip_in_dir(file, dir) raise "Target is not a directory: #{file}" if File.exist?(dir) and not File.directory?(dir)