Class: MacSystemMemory
- Inherits:
-
SystemMemory
- Object
- SystemMemory
- MacSystemMemory
- Defined in:
- lib/memory.rb
Overview
Memory probe for Mac OS
Constant Summary
Constants inherited from SystemMemory
Instance Attribute Summary
Attributes inherited from SystemMemory
#is_ecc, #size, #speed, #swap_size, #type
Instance Method Summary collapse
-
#initialize ⇒ MacSystemMemory
constructor
A new instance of MacSystemMemory.
Methods inherited from SystemMemory
Constructor Details
#initialize ⇒ MacSystemMemory
Returns a new instance of MacSystemMemory.
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/memory.rb', line 63 def initialize `system_profiler SPMemoryDataType > /tmp/memdata.tmp` cmd = 'grep ECC /tmp/memdata.tmp | sed -e \'s/.*ECC: //\' | tr -d \'[:space:]\'' @is_ecc = `#{cmd}` != 'Disabled' cmd = "grep Type /tmp/memdata.tmp | uniq | sed -e 's/.*Type: //' | tr -d '[:space:]'" @type = `#{cmd}` cmd = "grep Speed /tmp/memdata.tmp | uniq | sed -e 's/.*Speed: //' | cut -f1 -d' '" @speed = `#{cmd}`.to_i cmd = "grep Size /tmp/memdata.tmp | uniq | sed -e 's/.*Size: //' | cut -f1 -d' '" slot_size = `#{cmd}`.to_i cmd = "grep Size /tmp/memdata.tmp | wc -l | tr -d '[:space:]'" slots = `#{cmd}`.to_i @size = slots * slot_size @swap_size = UNLIMITED end |