leaks 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/lib/leaks/printer.rb CHANGED
@@ -1,7 +1,11 @@
1
1
  module Leaks
2
2
  module Printer
3
3
  def self.run
4
- loop { print_status; sleep 0.1 }
4
+ loop do
5
+ Runner.ram_usage.update
6
+ print_status
7
+ sleep 0.1
8
+ end
5
9
  end
6
10
 
7
11
  def self.print_status
@@ -1,23 +1,29 @@
1
1
  module Leaks
2
2
  class RAMUsage
3
3
  def initialize
4
- @previous = kilobytes_used
5
- @current = @previous
6
- @stable = Time.now
4
+ @previous = kilobytes_used
5
+ @current = @previous
6
+ @stable = Time.now
7
+ @increased = false
7
8
  end
8
9
 
9
- def increased?
10
- if current > @previous
11
- @stable = Time.now
12
- true
13
- else
14
- false
10
+ def update
11
+ @increased = false
12
+ @previous = @current
13
+ @current = kilobytes_used
14
+
15
+ if @current > @previous
16
+ @increased = true
17
+ @stable = Time.now
15
18
  end
16
19
  end
17
20
 
21
+ def increased?
22
+ @increased
23
+ end
24
+
18
25
  def current
19
- @previous = @current
20
- @current = kilobytes_used
26
+ @current
21
27
  end
22
28
 
23
29
  def to_s
data/lib/leaks/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Leaks
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: leaks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: