summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@llnw.com>2013-11-30 18:25:54 -0800
committerTim Smith <tsmith@llnw.com>2013-12-17 16:08:26 -0800
commit42cef86e2f9cd0df1772d0c8b86586af3b377f66 (patch)
treeea7bcdd46a401a191d5ff425a0e61f58a43e3efe
parentcc097a8a23e9c7aa0354c9467cc33db053a8e0bc (diff)
downloadohai-42cef86e2f9cd0df1772d0c8b86586af3b377f66.tar.gz
Add new CPU attributes for OS X to match those of Linux
-rw-r--r--lib/ohai/plugins/darwin/cpu.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/ohai/plugins/darwin/cpu.rb b/lib/ohai/plugins/darwin/cpu.rb
index f43554b9..1c0b6180 100644
--- a/lib/ohai/plugins/darwin/cpu.rb
+++ b/lib/ohai/plugins/darwin/cpu.rb
@@ -1,5 +1,6 @@
#
# Author:: Nathan L Smith (<nlloyds@gmail.com>)
+# Author:: Tim Smith (<tsmith@limelight.com>)
# Copyright:: Copyright (c) 2013 Opscode, Inc.
# License:: Apache License, Version 2.0
#
@@ -25,5 +26,19 @@ Ohai.plugin(:CPU) do
cpu[:real] = so.stdout.to_i
so = shell_out("sysctl -n hw.logicalcpu")
cpu[:total] = so.stdout.to_i
+ so = shell_out("sysctl -n hw.cpufrequency")
+ cpu[:mhz] = so.stdout.to_i / 1000000
+ so = shell_out("sysctl -n machdep.cpu.vendor")
+ cpu[:vendor_id] = so.stdout
+ so = shell_out("sysctl -n machdep.cpu.brand_string")
+ cpu[:model_name] = so.stdout
+ so = shell_out("sysctl -n machdep.cpu.model")
+ cpu[:model] = so.stdout.to_i
+ so = shell_out("sysctl -n machdep.cpu.family")
+ cpu[:family] = so.stdout.to_i
+ so = shell_out("sysctl -n machdep.cpu.stepping")
+ cpu[:stepping] = so.stdout.to_i
+ so = shell_out("sysctl -n machdep.cpu.features")
+ cpu[:flags] = so.stdout.downcase.split(' ')
end
end