зеркало из https://github.com/github/ruby.git
/proc/self/status format check
* test/ruby/memory_status.rb: use /proc/self/status if it is in the expected format. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34856 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
fc493491fe
Коммит
1673881f58
|
@ -1,3 +1,8 @@
|
|||
Wed Feb 29 13:06:42 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* test/ruby/memory_status.rb: use /proc/self/status if it is in
|
||||
the expected format.
|
||||
|
||||
Wed Feb 29 06:14:51 2012 Tadayoshi Funaba <tadf@dotrb.org>
|
||||
|
||||
* ext/date/date_core.c: reverted r34825.
|
||||
|
|
|
@ -3,9 +3,9 @@ module Memory
|
|||
vals = []
|
||||
|
||||
case
|
||||
when File.exist?(procfile = "/proc/self/status")
|
||||
when File.exist?(procfile = "/proc/self/status") and (pat = /^Vm(\w+):\s+(\d+)/) =~ File.binread(procfile)
|
||||
PROC_FILE = procfile
|
||||
VM_PAT = /^Vm(\w+):\s+(\d+)/
|
||||
VM_PAT = pat
|
||||
def self.read_status
|
||||
IO.foreach(PROC_FILE, encoding: Encoding::ASCII_8BIT) do |l|
|
||||
yield($1.downcase.intern, $2.to_i * 1024) if VM_PAT =~ l
|
||||
|
|
Загрузка…
Ссылка в новой задаче