ruby-changes:22806
From: nobu <ko1@a...>
Date: Wed, 29 Feb 2012 13:07:26 +0900 (JST)
Subject: [ruby-changes:22806] nobu:r34856 (trunk): /proc/self/status format check
nobu 2012-02-29 13:07:10 +0900 (Wed, 29 Feb 2012) New Revision: 34856 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=34856 Log: /proc/self/status format check * test/ruby/memory_status.rb: use /proc/self/status if it is in the expected format. Modified files: trunk/ChangeLog trunk/test/ruby/memory_status.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 34855) +++ ChangeLog (revision 34856) @@ -1,3 +1,8 @@ +Wed Feb 29 13:06:42 2012 Nobuyoshi Nakada <nobu@r...> + + * 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@d...> * ext/date/date_core.c: reverted r34825. Index: test/ruby/memory_status.rb =================================================================== --- test/ruby/memory_status.rb (revision 34855) +++ test/ruby/memory_status.rb (revision 34856) @@ -3,9 +3,9 @@ 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/