mnemonic 0.1.0 → 0.1.3

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
- SHA1:
3
- metadata.gz: 11af3b3be9c8bbfc7f2f894153f15d43fd17f24f
4
- data.tar.gz: 1ab4eebad3666c8375fcf688de6103fc431b4c90
2
+ SHA256:
3
+ metadata.gz: 8d185148f6edff635b10edfbc6ba38f77fcecb5a54f5096311c0db1d52cbb682
4
+ data.tar.gz: 9bf069d892ba9f7de2de9c4a6aac500d3f3c90ba398c4ff5e413f7de530e886c
5
5
  SHA512:
6
- metadata.gz: 591b470a1fc840c66068c6f697c82cddc267126c7aa3ecfccc00a5d3086d50556d864028434ba27f9cedbc4228c87d493978c1631658097ed06a206a43c8c458
7
- data.tar.gz: 972c5ff51b863f6b5c6f88860b7da359d649ddf21c36d0e499c076ea4621b4164cd99c087218433761fa2219fcaf6f0668aca2a16beaef5df5425f84081045b5
6
+ metadata.gz: 5a7ffb0ea3f4b1ca65cd30d620dbdc15c020d08a7840182bc735400bb365e3ee091301968b9109ec4ed18db144b952526a70545b1f6b7dcfde88d24fd740cb6b
7
+ data.tar.gz: 2a28bd3fbf53efc35d1a5abd11d1241e01ef1feaa4c991eeded8b39b19aee42f7254ba4eaea54a53572c51490a4a0d09f65c69133c17a4d4197e6b13664da213
data/Gemfile.lock CHANGED
@@ -1,43 +1,46 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mnemonic (0.1.0)
4
+ mnemonic (0.1.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- coderay (1.1.0)
10
- diff-lcs (1.2.5)
11
- method_source (0.8.2)
12
- pry (0.10.3)
13
- coderay (~> 1.1.0)
14
- method_source (~> 0.8.1)
15
- slop (~> 3.4)
16
- rake (10.4.2)
17
- rspec (3.4.0)
18
- rspec-core (~> 3.4.0)
19
- rspec-expectations (~> 3.4.0)
20
- rspec-mocks (~> 3.4.0)
21
- rspec-core (3.4.0)
22
- rspec-support (~> 3.4.0)
23
- rspec-expectations (3.4.0)
9
+ byebug (11.1.3)
10
+ coderay (1.1.3)
11
+ diff-lcs (1.5.0)
12
+ method_source (1.0.0)
13
+ pry (0.13.1)
14
+ coderay (~> 1.1)
15
+ method_source (~> 1.0)
16
+ pry-byebug (3.9.0)
17
+ byebug (~> 11.0)
18
+ pry (~> 0.13.0)
19
+ rake (13.0.6)
20
+ rspec (3.11.0)
21
+ rspec-core (~> 3.11.0)
22
+ rspec-expectations (~> 3.11.0)
23
+ rspec-mocks (~> 3.11.0)
24
+ rspec-core (3.11.0)
25
+ rspec-support (~> 3.11.0)
26
+ rspec-expectations (3.11.0)
24
27
  diff-lcs (>= 1.2.0, < 2.0)
25
- rspec-support (~> 3.4.0)
26
- rspec-mocks (3.4.0)
28
+ rspec-support (~> 3.11.0)
29
+ rspec-mocks (3.11.1)
27
30
  diff-lcs (>= 1.2.0, < 2.0)
28
- rspec-support (~> 3.4.0)
29
- rspec-support (3.4.0)
30
- slop (3.6.0)
31
+ rspec-support (~> 3.11.0)
32
+ rspec-support (3.11.0)
31
33
 
32
34
  PLATFORMS
33
- ruby
35
+ x86_64-linux
34
36
 
35
37
  DEPENDENCIES
36
- bundler (~> 1.10)
38
+ bundler (~> 2.3)
37
39
  mnemonic!
38
40
  pry
39
- rake (~> 10.0)
41
+ pry-byebug
42
+ rake (~> 13.0)
40
43
  rspec
41
44
 
42
45
  BUNDLED WITH
43
- 1.10.6
46
+ 2.3.15
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
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|
@@ -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,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'
@@ -1,3 +1,3 @@
1
1
  class Mnemonic
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.3"
3
3
  end
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
@@ -19,8 +19,12 @@ class Mnemonic
19
19
  yield config
20
20
 
21
21
  @root_metrics = config.metrics.map do |metric|
22
- metric.klass.new(*metric.args)
23
- end
22
+ begin
23
+ metric.klass.new(*metric.args)
24
+ rescue => e
25
+ puts e
26
+ end
27
+ end.compact
24
28
 
25
29
  @metrics = @root_metrics.flat_map do |metric|
26
30
  metric.to_enum(:each_submetric).to_a
@@ -29,15 +33,25 @@ class Mnemonic
29
33
  @root_metrics.each(&:start!)
30
34
  @metric_names = @metrics.map(&:name)
31
35
  @sinks = Set.new
36
+ @enabled = true
32
37
  end
33
38
 
34
39
  def trigger!(extra = nil)
40
+ return unless enabled
35
41
  synchronize do
36
42
  @root_metrics.each(&:refresh!)
37
43
  @sinks.each { |s| s.drop!(extra) }
38
44
  end
39
45
  end
40
46
 
47
+ def disable!
48
+ @enabled = false
49
+ end
50
+
51
+ def enable!
52
+ @enabled = true
53
+ end
54
+
41
55
  def attach_csv(*args)
42
56
  attach(Sink::CSV, *args)
43
57
  end
data/mnemonic.gemspec CHANGED
@@ -16,8 +16,9 @@ Gem::Specification.new do |spec|
16
16
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
17
  spec.require_paths = ["lib"]
18
18
 
19
- spec.add_development_dependency "bundler", "~> 1.10"
20
- spec.add_development_dependency "rake", "~> 10.0"
19
+ spec.add_development_dependency "bundler", "~> 2.3"
20
+ spec.add_development_dependency "rake", "~> 13.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,15 +1,15 @@
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.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vladimir Kochnev
8
8
  - Alexey Gaziev
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-12-14 00:00:00.000000000 Z
12
+ date: 2022-06-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -17,28 +17,28 @@ dependencies:
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: '1.10'
20
+ version: '2.3'
21
21
  type: :development
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: '1.10'
27
+ version: '2.3'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: rake
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
32
  - - "~>"
33
33
  - !ruby/object:Gem::Version
34
- version: '10.0'
34
+ version: '13.0'
35
35
  type: :development
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - "~>"
40
40
  - !ruby/object:Gem::Version
41
- version: '10.0'
41
+ version: '13.0'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: rspec
44
44
  requirement: !ruby/object:Gem::Requirement
@@ -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
@@ -118,7 +132,7 @@ files:
118
132
  homepage: https://github.com/gazay/mnemonic
119
133
  licenses: []
120
134
  metadata: {}
121
- post_install_message:
135
+ post_install_message:
122
136
  rdoc_options: []
123
137
  require_paths:
124
138
  - lib
@@ -133,9 +147,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
133
147
  - !ruby/object:Gem::Version
134
148
  version: '0'
135
149
  requirements: []
136
- rubyforge_project:
137
- rubygems_version: 2.4.5.1
138
- signing_key:
150
+ rubygems_version: 3.2.32
151
+ signing_key:
139
152
  specification_version: 4
140
153
  summary: The best tool to find leakage
141
154
  test_files: []