diff options
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/memory_status.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/test/ruby/memory_status.rb b/test/ruby/memory_status.rb index 3694e619ef..2817e16c56 100644 --- a/test/ruby/memory_status.rb +++ b/test/ruby/memory_status.rb @@ -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 |