Class: Atatus::Metrics::CpuMemSet::Linux Private

Inherits:
Object
  • Object
show all
Defined in:
lib/atatus/metrics/cpu_mem_set.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Defined Under Namespace

Classes: Meminfo, ProcSelfStat, ProcStat

Constant Summary collapse

UTIME_POS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

13
STIME_POS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

14
VSIZE_POS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

22
RSS_POS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

23

Instance Method Summary collapse

Instance Method Details

#sampleObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
# File 'lib/atatus/metrics/cpu_mem_set.rb', line 159

def sample
  proc_stat = ProcStat.new.read!
  proc_self_stat = ProcSelfStat.new.read!
  meminfo = Meminfo.new.read!

  Sample.new(
    system_cpu_total: proc_stat.total,
    system_cpu_usage: proc_stat.usage,
    system_memory_total: meminfo.total,
    system_memory_free: meminfo.available,
    process_cpu_usage: proc_self_stat.total,
    process_memory_size: proc_self_stat.vsize,
    process_memory_rss: proc_self_stat.rss,
    page_size: meminfo.page_size
  )
end