Class: Memstat::Proc::Smaps::Item
- Inherits:
-
Object
- Object
- Memstat::Proc::Smaps::Item
- Defined in:
- lib/memstat/proc/smaps.rb
Overview
Memstat::Proc::Smaps::Item
Instance Attribute Summary collapse
-
#address_end ⇒ Object
readonly
Returns the value of attribute address_end.
-
#address_start ⇒ Object
readonly
Returns the value of attribute address_start.
-
#device_major ⇒ Object
readonly
Returns the value of attribute device_major.
-
#device_minor ⇒ Object
readonly
Returns the value of attribute device_minor.
-
#inode ⇒ Object
readonly
Returns the value of attribute inode.
-
#offset ⇒ Object
readonly
Returns the value of attribute offset.
-
#perms ⇒ Object
readonly
Returns the value of attribute perms.
-
#region ⇒ Object
readonly
Returns the value of attribute region.
Instance Method Summary collapse
-
#initialize ⇒ Item
constructor
A new instance of Item.
- #parse_field_line(line) ⇒ Object
- #parse_first_line(line) ⇒ Object
Constructor Details
Instance Attribute Details
#address_end ⇒ Object (readonly)
Returns the value of attribute address_end.
80 81 82 |
# File 'lib/memstat/proc/smaps.rb', line 80 def address_end @address_end end |
#address_start ⇒ Object (readonly)
Returns the value of attribute address_start.
79 80 81 |
# File 'lib/memstat/proc/smaps.rb', line 79 def address_start @address_start end |
#device_major ⇒ Object (readonly)
Returns the value of attribute device_major.
83 84 85 |
# File 'lib/memstat/proc/smaps.rb', line 83 def device_major @device_major end |
#device_minor ⇒ Object (readonly)
Returns the value of attribute device_minor.
84 85 86 |
# File 'lib/memstat/proc/smaps.rb', line 84 def device_minor @device_minor end |
#inode ⇒ Object (readonly)
Returns the value of attribute inode.
85 86 87 |
# File 'lib/memstat/proc/smaps.rb', line 85 def inode @inode end |
#offset ⇒ Object (readonly)
Returns the value of attribute offset.
82 83 84 |
# File 'lib/memstat/proc/smaps.rb', line 82 def offset @offset end |
#perms ⇒ Object (readonly)
Returns the value of attribute perms.
81 82 83 |
# File 'lib/memstat/proc/smaps.rb', line 81 def perms @perms end |
#region ⇒ Object (readonly)
Returns the value of attribute region.
86 87 88 |
# File 'lib/memstat/proc/smaps.rb', line 86 def region @region end |
Instance Method Details
#parse_field_line(line) ⇒ Object
104 105 106 107 108 109 110 |
# File 'lib/memstat/proc/smaps.rb', line 104 def parse_field_line(line) parts = line.strip.split field = parts[0].downcase.sub(':','') return if field == 'vmflags' value = Integer(parts[1]) * 1024 send("#{field}=", value) if respond_to? "#{field}=" end |
#parse_first_line(line) ⇒ Object
94 95 96 97 98 99 100 101 102 |
# File 'lib/memstat/proc/smaps.rb', line 94 def parse_first_line(line) parts = line.strip.split @address_start, @address_end = parts[0].split('-') @perms = parts[1] @offset = parts[2] @device_major, @device_minor = parts[3].split(':') @inode = parts[4] @region = parts[5] || 'anonymous' end |