lib/ohai/plugins/darwin/memory.rb in ohai-8.8.1 vs lib/ohai/plugins/darwin/memory.rb in ohai-8.9.0
- old
+ new
@@ -1,8 +1,8 @@
#
# Author:: Patrick Collins (<pat@burned.com>)
-# Copyright:: Copyright (c) 2013 Opscode, Inc.
+# Copyright:: Copyright (c) 2013-2016 Chef Software, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
@@ -29,13 +29,14 @@
active = 0
inactive = 0
vm_stat = shell_out("vm_stat").stdout
vm_stat_match = /page size of (\d+) bytes/.match(vm_stat)
page_size = if vm_stat_match and vm_stat_match[1]
- vm_stat_match[1].to_i
- else
- 4096
- end
+ vm_stat_match[1].to_i
+ else
+ 4096
+ end
+
vm_stat.split("\n").each do |line|
['wired down', 'active', 'inactive'].each do |match|
unless line.index("Pages #{match}:").nil?
pages = line.split.last.to_i
megabyte_val = (pages * page_size) / 1024 / 1024.0