Class: AppPerfAgent::Plugin::System::Cpu

Inherits:
Base
  • Object
show all
Defined in:
lib/app_perf_agent/plugin/system/cpu.rb

Instance Method Summary collapse

Methods inherited from Base

descendants

Instance Method Details

#callObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/app_perf_agent/plugin/system/cpu.rb', line 8

def call
  cpus = Vmstat.snapshot.cpus
  cpus.flat_map {|cpu|
    [
      [
        AppPerfAgent::Types::CPU,
        "system.cpu.idle",
        "CPU ##{cpu.num} (Idle)",
        cpu.idle
      ],
      [
        AppPerfAgent::Types::CPU,
        "system.cpu.nice",
        "CPU ##{cpu.num} (Nice)",
        cpu.nice
      ],
      [
        AppPerfAgent::Types::CPU,
        "system.cpu.system",
        "CPU ##{cpu.num} (System)",
        cpu.system
      ],
      [
        AppPerfAgent::Types::CPU,
        "system.cpu.user",
        "CPU ##{cpu.num} (User)",
        cpu.user
      ]
    ]
  }
end