Class: WarCorrespondent::Reporters::CPU

Inherits:
WarCorrespondent::Reporter show all
Defined in:
lib/warcorrespondent/reporters/cpu.rb

Instance Attribute Summary

Attributes inherited from WarCorrespondent::Reporter

#identifier, #options, #timeout

Instance Method Summary collapse

Methods inherited from WarCorrespondent::Reporter

#run, #update

Constructor Details

#initialize(args) ⇒ CPU

Returns a new instance of CPU.



4
5
6
7
8
9
10
11
12
13
# File 'lib/warcorrespondent/reporters/cpu.rb', line 4

def initialize(args)
  @block = Proc.new do
    SystemInformation::cpu.map{ |cpu_id,data|
      data.map{ |type, value|
        {:identifier => "cpu:#{cpu_id.to_s}:#{type.to_s}", :value => value }
      }
    }.inject([]){|a,b| a+b}
  end
  super(args)
end