mnemonic 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 11af3b3be9c8bbfc7f2f894153f15d43fd17f24f
4
- data.tar.gz: 1ab4eebad3666c8375fcf688de6103fc431b4c90
3
+ metadata.gz: 05c96cf2563c4bb6470e8456bf26f8551561c371
4
+ data.tar.gz: eb4dbd185ffe57ee89820105ec63534ad99658e9
5
5
  SHA512:
6
- metadata.gz: 591b470a1fc840c66068c6f697c82cddc267126c7aa3ecfccc00a5d3086d50556d864028434ba27f9cedbc4228c87d493978c1631658097ed06a206a43c8c458
7
- data.tar.gz: 972c5ff51b863f6b5c6f88860b7da359d649ddf21c36d0e499c076ea4621b4164cd99c087218433761fa2219fcaf6f0668aca2a16beaef5df5425f84081045b5
6
+ metadata.gz: 60f9dd6f2e9c16cdfd07864fe431a730ce186794c7e9dbcf4569a993ffa435d299000ac4787f87b6a2f556236751b3dd0b75db770cc3c8433351e7009294b276
7
+ data.tar.gz: d4e2835169d602649d36d4f73635c86d10a50ba539e08b2f4c42b46ef6e02847773015423fa441e81b54b9d62dd23fa5e7793d42f430e52a6e87e63e42e7aeb0
data/Gemfile.lock CHANGED
@@ -6,6 +6,7 @@ PATH
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
+ byebug (9.0.6)
9
10
  coderay (1.1.0)
10
11
  diff-lcs (1.2.5)
11
12
  method_source (0.8.2)
@@ -13,6 +14,9 @@ GEM
13
14
  coderay (~> 1.1.0)
14
15
  method_source (~> 0.8.1)
15
16
  slop (~> 3.4)
17
+ pry-byebug (3.4.0)
18
+ byebug (~> 9.0)
19
+ pry (~> 0.10)
16
20
  rake (10.4.2)
17
21
  rspec (3.4.0)
18
22
  rspec-core (~> 3.4.0)
@@ -36,8 +40,9 @@ DEPENDENCIES
36
40
  bundler (~> 1.10)
37
41
  mnemonic!
38
42
  pry
43
+ pry-byebug
39
44
  rake (~> 10.0)
40
45
  rspec
41
46
 
42
47
  BUNDLED WITH
43
- 1.10.6
48
+ 1.12.2
data/examples/gc_stat.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require 'mnemonic'
1
2
  mnemonic = Mnemonic.new do |config|
2
3
  config.gc_stat :minor_gc_count, :major_gc_count
3
4
  end
@@ -1,3 +1,4 @@
1
+ require 'mnemonic'
1
2
  class X
2
3
  end
3
4
 
data/examples/logger.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require 'mnemonic'
1
2
  require 'mnemonic/logger_proxy'
2
3
 
3
4
  file_name = './tmp.log'
data/examples/rss.rb CHANGED
@@ -1,12 +1,15 @@
1
+ require 'mnemonic'
2
+
1
3
  mnemonic = Mnemonic.new do |config|
2
4
  config.rss
5
+ config.gc_stat :minor_gc_count, :major_gc_count
3
6
  end
4
7
 
5
8
  mnemonic.attach_pretty(STDOUT)
6
9
 
7
10
  # 5 major GCs!
8
11
  10.times do |i|
9
- '!' * 1_000_000
12
+ '!' * 100_000_000
10
13
  mnemonic.trigger!
11
14
  end
12
15
 
data/examples/to_csv.rb CHANGED
@@ -1,3 +1,5 @@
1
+ require 'mnemonic'
2
+
1
3
  file_name = './tmp.csv'
2
4
 
3
5
  mnemonic = Mnemonic.new do |config|
data/examples/to_json.rb CHANGED
@@ -1,3 +1,5 @@
1
+ require 'mnemonic'
2
+
1
3
  file_name = './tmp.json'
2
4
 
3
5
  mnemonic = Mnemonic.new do |config|
data/lib/mnemonic.rb CHANGED
@@ -1,17 +1,17 @@
1
1
  require 'objspace'
2
2
  require 'monitor.rb'
3
3
  require 'set'
4
+ require 'mnemonic/version'
5
+ require 'mnemonic/config'
6
+ require 'mnemonic/metric'
7
+ require 'mnemonic/sink'
8
+ require 'mnemonic/util'
4
9
 
5
10
  class Mnemonic
6
- require 'mnemonic/version'
7
- require 'mnemonic/config'
8
- require 'mnemonic/metric'
9
- require 'mnemonic/sink'
10
- require 'mnemonic/util'
11
11
 
12
12
  include MonitorMixin
13
13
 
14
- attr_reader :root_metrics, :metrics, :metric_names
14
+ attr_reader :root_metrics, :metrics, :metric_names, :enabled
15
15
 
16
16
  def initialize
17
17
  super
@@ -29,15 +29,25 @@ class Mnemonic
29
29
  @root_metrics.each(&:start!)
30
30
  @metric_names = @metrics.map(&:name)
31
31
  @sinks = Set.new
32
+ @enabled = true
32
33
  end
33
34
 
34
35
  def trigger!(extra = nil)
36
+ return unless enabled
35
37
  synchronize do
36
38
  @root_metrics.each(&:refresh!)
37
39
  @sinks.each { |s| s.drop!(extra) }
38
40
  end
39
41
  end
40
42
 
43
+ def disable!
44
+ @enabled = false
45
+ end
46
+
47
+ def enable!
48
+ @enabled = true
49
+ end
50
+
41
51
  def attach_csv(*args)
42
52
  attach(Sink::CSV, *args)
43
53
  end
@@ -1,14 +1,11 @@
1
- class Mnemonic
2
- module Metric
3
- require 'mnemonic/metric/base'
4
- require 'mnemonic/metric/hash_metric'
5
- require 'mnemonic/metric/rss'
6
- require 'mnemonic/metric/time'
7
- require 'mnemonic/metric/time_milliseconds'
8
- require 'mnemonic/metric/gc_stat'
9
- require 'mnemonic/metric/objects_count'
10
- require 'mnemonic/metric/objects_size'
11
- require 'mnemonic/metric/instances_count'
12
- require 'mnemonic/metric/instances_size'
13
- end
14
- end
1
+ require 'mnemonic/metric/base'
2
+ require 'mnemonic/metric/hash_metric'
3
+ require 'mnemonic/metric/rss'
4
+ require 'mnemonic/metric/time'
5
+ require 'mnemonic/metric/time_seconds'
6
+ require 'mnemonic/metric/time_milliseconds'
7
+ require 'mnemonic/metric/gc_stat'
8
+ require 'mnemonic/metric/objects_count'
9
+ require 'mnemonic/metric/objects_size'
10
+ require 'mnemonic/metric/instances_count'
11
+ require 'mnemonic/metric/instances_size'
@@ -12,7 +12,7 @@ class Mnemonic
12
12
  private
13
13
 
14
14
  def current_value
15
- Time.now.to_i
15
+ ::Time.now.to_i
16
16
  end
17
17
  end
18
18
  end
@@ -1,3 +1,3 @@
1
1
  class Mnemonic
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
data/mnemonic.gemspec CHANGED
@@ -20,4 +20,5 @@ Gem::Specification.new do |spec|
20
20
  spec.add_development_dependency "rake", "~> 10.0"
21
21
  spec.add_development_dependency "rspec"
22
22
  spec.add_development_dependency "pry"
23
+ spec.add_development_dependency "pry-byebug"
23
24
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mnemonic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vladimir Kochnev
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-12-14 00:00:00.000000000 Z
12
+ date: 2016-11-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -67,6 +67,20 @@ dependencies:
67
67
  - - ">="
68
68
  - !ruby/object:Gem::Version
69
69
  version: '0'
70
+ - !ruby/object:Gem::Dependency
71
+ name: pry-byebug
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
70
84
  description: The best tool to find leakage
71
85
  email:
72
86
  - hashtable@yandex.ru
@@ -134,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
134
148
  version: '0'
135
149
  requirements: []
136
150
  rubyforge_project:
137
- rubygems_version: 2.4.5.1
151
+ rubygems_version: 2.5.1
138
152
  signing_key:
139
153
  specification_version: 4
140
154
  summary: The best tool to find leakage