Class: Leaks::RAMUsage
- Inherits:
-
Object
- Object
- Leaks::RAMUsage
- Defined in:
- lib/leaks/ram_usage.rb
Instance Method Summary collapse
- #current ⇒ Object
- #increased? ⇒ Boolean
-
#initialize ⇒ RAMUsage
constructor
A new instance of RAMUsage.
- #stable_for ⇒ Object
- #to_s ⇒ Object
- #update ⇒ Object
Constructor Details
#initialize ⇒ RAMUsage
Returns a new instance of RAMUsage.
3 4 5 6 7 8 |
# File 'lib/leaks/ram_usage.rb', line 3 def initialize @current = kilobytes_used @highest = @current @stable = Time.now @increased = false end |
Instance Method Details
#current ⇒ Object
25 26 27 |
# File 'lib/leaks/ram_usage.rb', line 25 def current @current end |
#increased? ⇒ Boolean
21 22 23 |
# File 'lib/leaks/ram_usage.rb', line 21 def increased? @increased end |
#stable_for ⇒ Object
33 34 35 |
# File 'lib/leaks/ram_usage.rb', line 33 def stable_for (Time.now - @stable).to_i end |
#to_s ⇒ Object
29 30 31 |
# File 'lib/leaks/ram_usage.rb', line 29 def to_s "Current: #{current}KB Highest: #{@highest}KB" end |
#update ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/leaks/ram_usage.rb', line 10 def update @increased = false @current = kilobytes_used if @current > @highest @highest = @current @increased = true @stable = Time.now end end |