Class: FFWD::Statistics::SMAP

Inherits:
Object
  • Object
show all
Defined in:
lib/ffwd/statistics/system_statistics.rb

Overview

Example SMAP (mapping header) Size: 4 kB Rss: 0 kB Pss: 0 kB Shared_Clean: 0 kB Shared_Dirty: 0 kB Private_Clean: 0 kB Private_Dirty: 0 kB Referenced: 0 kB Anonymous: 0 kB AnonHugePages: 0 kB Swap: 0 kB KernelPageSize: 4 kB MMUPageSize: 4 kB Locked: 0 kB VmFlags: rd ex

Constant Summary collapse

KEY_MAPPING =
{
  "Size" => :size,
  "Rss" => :rss,
  "Pss" => :pss,
  "Shared_Clean" => :shared_clean,
  "Shared_Dirty" => :shared_dirty,
  "Private_Clean" => :private_clean,
  "Private_Dirty" => :private_dirty,
  "Referenced" => :referenced,
  "Anonymous" => :anonymous,
  "AnonHugePages" => :anon_huge_pages,
  "Swap" => :swap,
  "KernelPageSize" => :kernel_page_size,
  "MMUPageSize" => :mmu_page_size,
  "Locked" => :locked,
  "VmFlags" => :vm_flags,
}
TYPE_MAP =
{
  "VmFlags" => lambda{|s| s}
}
DEFAULT_TYPE =
lambda{|s| s[0, s.size - 3].to_i * 1024}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(values) ⇒ SMAP

Returns a new instance of SMAP.



78
79
80
81
82
83
84
85
86
# File 'lib/ffwd/statistics/system_statistics.rb', line 78

def initialize values
  values.each do |key, value|
    unless target = KEY_MAPPING[key]
      raise "unexpected key: #{key}"
    end

    instance_variable_set "@#{target}", value
  end
end

Instance Attribute Details

#anon_huge_pagesObject (readonly)

Returns the value of attribute anon_huge_pages.



47
48
49
# File 'lib/ffwd/statistics/system_statistics.rb', line 47

def anon_huge_pages
  @anon_huge_pages
end

#anonymousObject (readonly)

Returns the value of attribute anonymous.



46
47
48
# File 'lib/ffwd/statistics/system_statistics.rb', line 46

def anonymous
  @anonymous
end

#kernel_page_sizeObject (readonly)

Returns the value of attribute kernel_page_size.



49
50
51
# File 'lib/ffwd/statistics/system_statistics.rb', line 49

def kernel_page_size
  @kernel_page_size
end

#lockedObject (readonly)

Returns the value of attribute locked.



51
52
53
# File 'lib/ffwd/statistics/system_statistics.rb', line 51

def locked
  @locked
end

#mmu_page_sizeObject (readonly)

Returns the value of attribute mmu_page_size.



50
51
52
# File 'lib/ffwd/statistics/system_statistics.rb', line 50

def mmu_page_size
  @mmu_page_size
end

#private_cleanObject (readonly)

Returns the value of attribute private_clean.



43
44
45
# File 'lib/ffwd/statistics/system_statistics.rb', line 43

def private_clean
  @private_clean
end

#private_dirtyObject (readonly)

Returns the value of attribute private_dirty.



44
45
46
# File 'lib/ffwd/statistics/system_statistics.rb', line 44

def private_dirty
  @private_dirty
end

#pssObject (readonly)

Returns the value of attribute pss.



40
41
42
# File 'lib/ffwd/statistics/system_statistics.rb', line 40

def pss
  @pss
end

#referencedObject (readonly)

Returns the value of attribute referenced.



45
46
47
# File 'lib/ffwd/statistics/system_statistics.rb', line 45

def referenced
  @referenced
end

#rssObject (readonly)

Returns the value of attribute rss.



39
40
41
# File 'lib/ffwd/statistics/system_statistics.rb', line 39

def rss
  @rss
end

#shared_cleanObject (readonly)

Returns the value of attribute shared_clean.



41
42
43
# File 'lib/ffwd/statistics/system_statistics.rb', line 41

def shared_clean
  @shared_clean
end

#shared_dirtyObject (readonly)

Returns the value of attribute shared_dirty.



42
43
44
# File 'lib/ffwd/statistics/system_statistics.rb', line 42

def shared_dirty
  @shared_dirty
end

#sizeObject (readonly)

Returns the value of attribute size.



38
39
40
# File 'lib/ffwd/statistics/system_statistics.rb', line 38

def size
  @size
end

#swapObject (readonly)

Returns the value of attribute swap.



48
49
50
# File 'lib/ffwd/statistics/system_statistics.rb', line 48

def swap
  @swap
end

#vmflagsObject (readonly)

Returns the value of attribute vmflags.



52
53
54
# File 'lib/ffwd/statistics/system_statistics.rb', line 52

def vmflags
  @vmflags
end