Class: ElasticAPM::Metrics::CpuMem::Linux::ProcSelfStat Private

Inherits:
Object
  • Object
show all
Defined in:
lib/elastic_apm/metrics/cpu_mem.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.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#rssObject (readonly)

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.



163
164
165
# File 'lib/elastic_apm/metrics/cpu_mem.rb', line 163

def rss
  @rss
end

#totalObject (readonly)

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.



163
164
165
# File 'lib/elastic_apm/metrics/cpu_mem.rb', line 163

def total
  @total
end

#vsizeObject (readonly)

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.



163
164
165
# File 'lib/elastic_apm/metrics/cpu_mem.rb', line 163

def vsize
  @vsize
end

Instance Method Details

#read!Object

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.



165
166
167
168
169
170
171
172
173
174
175
176
177
178
# File 'lib/elastic_apm/metrics/cpu_mem.rb', line 165

def read!
  stat =
    IO.readlines('/proc/self/stat')
      .lazy
      .first
      .split
      .map(&:to_i)

  @total = stat[UTIME_POS] + stat[STIME_POS]
  @vsize = stat[VSIZE_POS]
  @rss = stat[RSS_POS]

  self
end