diff options
author | Thom May <thom@may.lt> | 2015-09-28 17:27:22 -0700 |
---|---|---|
committer | Thom May <thom@may.lt> | 2015-09-28 17:27:22 -0700 |
commit | 934b4a2b3a551a2d82abd4a058c4fccdad5205d2 (patch) | |
tree | 40c520d01fb6485e8fdc19754f5ce6a47e2e1d6a | |
parent | 0e6456ca3e56ae4e84feabff87f3c538bf38964a (diff) | |
parent | efd4241c5c118368255e288e08e837b4ea7fb6be (diff) | |
download | ohai-934b4a2b3a551a2d82abd4a058c4fccdad5205d2.tar.gz |
Merge pull request #612 from sh9189/linux_cpu_add_cores
Add total cores to linux cpu plugin
-rw-r--r-- | lib/ohai/plugins/linux/cpu.rb | 1 | ||||
-rw-r--r-- | spec/unit/plugins/linux/cpu_spec.rb | 5 |
2 files changed, 6 insertions, 0 deletions
diff --git a/lib/ohai/plugins/linux/cpu.rb b/lib/ohai/plugins/linux/cpu.rb index 442cb1a5..d1bca6d0 100644 --- a/lib/ohai/plugins/linux/cpu.rb +++ b/lib/ohai/plugins/linux/cpu.rb @@ -80,5 +80,6 @@ Ohai.plugin(:CPU) do cpu cpuinfo cpu[:total] = cpu_number cpu[:real] = real_cpu.keys.length + cpu[:cores] = real_cpu.keys.length * cpu["0"]["cores"].to_i end end diff --git a/spec/unit/plugins/linux/cpu_spec.rb b/spec/unit/plugins/linux/cpu_spec.rb index 67452654..13fb4e2e 100644 --- a/spec/unit/plugins/linux/cpu_spec.rb +++ b/spec/unit/plugins/linux/cpu_spec.rb @@ -89,6 +89,11 @@ describe Ohai::System, "General Linux cpu plugin" do end it_behaves_like "Common cpu info", 1, 0 + + it "gets total cores" do + @plugin.run + expect(@plugin[:cpu][:cores]).to eql(0) + end it "doesn't have a cpu 1" do @plugin.run |