profile-tools 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +22 -0
- data/README.md +207 -2
- data/UPGRADING.md +98 -0
- data/lib/profile-tools.rb +97 -107
- data/lib/profile_tools/collector.rb +48 -73
- data/lib/profile_tools/error.rb +6 -0
- data/lib/profile_tools/log_subscriber.rb +24 -10
- data/lib/profile_tools/method_name.rb +51 -0
- data/lib/profile_tools/method_stats.rb +99 -0
- data/lib/profile_tools/method_wrapper.rb +95 -0
- data/lib/profile_tools/middleware.rb +21 -0
- data/lib/profile_tools/profiler.rb +34 -41
- data/lib/profile_tools/railtie.rb +47 -0
- data/lib/profile_tools/unknown_method_error.rb +6 -0
- data/lib/profile_tools/version.rb +6 -0
- metadata +44 -22
- data/.gitignore +0 -52
- data/.rubocop.yml +0 -14
- data/.ruby-gemset +0 -1
- data/.ruby-version +0 -1
- data/Gemfile +0 -15
- data/Gemfile.lock +0 -67
- data/profile-tools.gemspec +0 -13
- data/script/console +0 -16
- data/script/test +0 -53
metadata
CHANGED
|
@@ -1,42 +1,65 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: profile-tools
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Doug Youch
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
12
|
-
dependencies:
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: activesupport
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - ">="
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '7.1'
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - ">="
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: '7.1'
|
|
26
|
+
description: Profile methods without touching their code. List them in config/profile_tools.yml,
|
|
27
|
+
restart, and every request logs how many times each was called, how long it took,
|
|
28
|
+
exactly how many objects it allocated and how many garbage collections ran inside
|
|
29
|
+
it. Remove the file and restart to turn it off, so it can be switched on for a production
|
|
30
|
+
box and off again. Rails apps need no setup beyond the Gemfile; other apps can load
|
|
31
|
+
the file or profile methods by name. Built for finding the code that creates the
|
|
32
|
+
most objects and causes the most garbage collection.
|
|
15
33
|
email: dougyouch@gmail.com
|
|
16
34
|
executables: []
|
|
17
35
|
extensions: []
|
|
18
36
|
extra_rdoc_files: []
|
|
19
37
|
files:
|
|
20
|
-
-
|
|
21
|
-
- ".rubocop.yml"
|
|
22
|
-
- ".ruby-gemset"
|
|
23
|
-
- ".ruby-version"
|
|
24
|
-
- Gemfile
|
|
25
|
-
- Gemfile.lock
|
|
38
|
+
- CHANGELOG.md
|
|
26
39
|
- LICENSE
|
|
27
40
|
- README.md
|
|
41
|
+
- UPGRADING.md
|
|
28
42
|
- lib/profile-tools.rb
|
|
29
43
|
- lib/profile_tools/collector.rb
|
|
44
|
+
- lib/profile_tools/error.rb
|
|
30
45
|
- lib/profile_tools/log_subscriber.rb
|
|
46
|
+
- lib/profile_tools/method_name.rb
|
|
47
|
+
- lib/profile_tools/method_stats.rb
|
|
48
|
+
- lib/profile_tools/method_wrapper.rb
|
|
49
|
+
- lib/profile_tools/middleware.rb
|
|
31
50
|
- lib/profile_tools/profiler.rb
|
|
32
|
-
-
|
|
33
|
-
-
|
|
34
|
-
-
|
|
51
|
+
- lib/profile_tools/railtie.rb
|
|
52
|
+
- lib/profile_tools/unknown_method_error.rb
|
|
53
|
+
- lib/profile_tools/version.rb
|
|
35
54
|
homepage: https://github.com/dougyouch/profile-tools
|
|
36
55
|
licenses:
|
|
37
56
|
- MIT
|
|
38
|
-
metadata:
|
|
39
|
-
|
|
57
|
+
metadata:
|
|
58
|
+
rubygems_mfa_required: 'true'
|
|
59
|
+
source_code_uri: https://github.com/dougyouch/profile-tools
|
|
60
|
+
changelog_uri: https://github.com/dougyouch/profile-tools/blob/master/CHANGELOG.md
|
|
61
|
+
bug_tracker_uri: https://github.com/dougyouch/profile-tools/issues
|
|
62
|
+
documentation_uri: https://rubydoc.info/gems/profile-tools
|
|
40
63
|
rdoc_options: []
|
|
41
64
|
require_paths:
|
|
42
65
|
- lib
|
|
@@ -44,16 +67,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
44
67
|
requirements:
|
|
45
68
|
- - ">="
|
|
46
69
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: '
|
|
70
|
+
version: '3.4'
|
|
48
71
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
49
72
|
requirements:
|
|
50
73
|
- - ">="
|
|
51
74
|
- !ruby/object:Gem::Version
|
|
52
75
|
version: '0'
|
|
53
76
|
requirements: []
|
|
54
|
-
|
|
55
|
-
rubygems_version: 2.7.10
|
|
56
|
-
signing_key:
|
|
77
|
+
rubygems_version: 4.0.20
|
|
57
78
|
specification_version: 4
|
|
58
|
-
summary: Profile
|
|
79
|
+
summary: 'Profile methods listed in a YAML file, no code changes: exact allocations,
|
|
80
|
+
time and GC per method'
|
|
59
81
|
test_files: []
|
data/.gitignore
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
*.gem
|
|
2
|
-
*.rbc
|
|
3
|
-
/.config
|
|
4
|
-
/coverage/
|
|
5
|
-
/InstalledFiles
|
|
6
|
-
/pkg/
|
|
7
|
-
/spec/reports/
|
|
8
|
-
/spec/examples.txt
|
|
9
|
-
/test/tmp/
|
|
10
|
-
/test/version_tmp/
|
|
11
|
-
/tmp/
|
|
12
|
-
|
|
13
|
-
# Used by dotenv library to load environment variables.
|
|
14
|
-
# .env
|
|
15
|
-
|
|
16
|
-
## Specific to RubyMotion:
|
|
17
|
-
.dat*
|
|
18
|
-
.repl_history
|
|
19
|
-
build/
|
|
20
|
-
*.bridgesupport
|
|
21
|
-
build-iPhoneOS/
|
|
22
|
-
build-iPhoneSimulator/
|
|
23
|
-
|
|
24
|
-
## Specific to RubyMotion (use of CocoaPods):
|
|
25
|
-
#
|
|
26
|
-
# We recommend against adding the Pods directory to your .gitignore. However
|
|
27
|
-
# you should judge for yourself, the pros and cons are mentioned at:
|
|
28
|
-
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
|
29
|
-
#
|
|
30
|
-
# vendor/Pods/
|
|
31
|
-
|
|
32
|
-
## Documentation cache and generated files:
|
|
33
|
-
/.yardoc/
|
|
34
|
-
/_yardoc/
|
|
35
|
-
/doc/
|
|
36
|
-
/rdoc/
|
|
37
|
-
|
|
38
|
-
## Environment normalization:
|
|
39
|
-
/.bundle/
|
|
40
|
-
/vendor/bundle
|
|
41
|
-
/lib/bundler/man/
|
|
42
|
-
|
|
43
|
-
# for a library or gem, you might want to ignore these files since the code is
|
|
44
|
-
# intended to run in multiple environments; otherwise, check them in:
|
|
45
|
-
# Gemfile.lock
|
|
46
|
-
# .ruby-version
|
|
47
|
-
# .ruby-gemset
|
|
48
|
-
|
|
49
|
-
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
|
50
|
-
.rvmrc
|
|
51
|
-
*~
|
|
52
|
-
*.yaml
|
data/.rubocop.yml
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
Naming/FileName:
|
|
2
|
-
Enabled: false
|
|
3
|
-
Metrics/LineLength:
|
|
4
|
-
Max: 120
|
|
5
|
-
Metrics/ModuleLength:
|
|
6
|
-
Max: 120
|
|
7
|
-
Metrics/MethodLength:
|
|
8
|
-
Max: 20
|
|
9
|
-
AllCops:
|
|
10
|
-
Exclude:
|
|
11
|
-
- 'spec/spec_helper.rb'
|
|
12
|
-
- 'spec/**/*_spec.rb'
|
|
13
|
-
- 'spec/support/*.rb'
|
|
14
|
-
- 'script/test'
|
data/.ruby-gemset
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
profile-tools
|
data/.ruby-version
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
2.6.3
|
data/Gemfile
DELETED
data/Gemfile.lock
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
GEM
|
|
2
|
-
remote: http://rubygems.org/
|
|
3
|
-
specs:
|
|
4
|
-
activesupport (6.0.0)
|
|
5
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
6
|
-
i18n (>= 0.7, < 2)
|
|
7
|
-
minitest (~> 5.1)
|
|
8
|
-
tzinfo (~> 1.1)
|
|
9
|
-
zeitwerk (~> 2.1, >= 2.1.8)
|
|
10
|
-
ast (2.4.0)
|
|
11
|
-
concurrent-ruby (1.1.5)
|
|
12
|
-
diff-lcs (1.3)
|
|
13
|
-
docile (1.3.2)
|
|
14
|
-
i18n (1.6.0)
|
|
15
|
-
concurrent-ruby (~> 1.0)
|
|
16
|
-
jaro_winkler (1.5.3)
|
|
17
|
-
json (2.2.0)
|
|
18
|
-
minitest (5.11.3)
|
|
19
|
-
parallel (1.17.0)
|
|
20
|
-
parser (2.6.3.0)
|
|
21
|
-
ast (~> 2.4.0)
|
|
22
|
-
rainbow (3.0.0)
|
|
23
|
-
rake (12.3.3)
|
|
24
|
-
rspec (3.8.0)
|
|
25
|
-
rspec-core (~> 3.8.0)
|
|
26
|
-
rspec-expectations (~> 3.8.0)
|
|
27
|
-
rspec-mocks (~> 3.8.0)
|
|
28
|
-
rspec-core (3.8.2)
|
|
29
|
-
rspec-support (~> 3.8.0)
|
|
30
|
-
rspec-expectations (3.8.4)
|
|
31
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
|
32
|
-
rspec-support (~> 3.8.0)
|
|
33
|
-
rspec-mocks (3.8.1)
|
|
34
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
|
35
|
-
rspec-support (~> 3.8.0)
|
|
36
|
-
rspec-support (3.8.2)
|
|
37
|
-
rubocop (0.74.0)
|
|
38
|
-
jaro_winkler (~> 1.5.1)
|
|
39
|
-
parallel (~> 1.10)
|
|
40
|
-
parser (>= 2.6)
|
|
41
|
-
rainbow (>= 2.2.2, < 4.0)
|
|
42
|
-
ruby-progressbar (~> 1.7)
|
|
43
|
-
unicode-display_width (>= 1.4.0, < 1.7)
|
|
44
|
-
ruby-progressbar (1.10.1)
|
|
45
|
-
simplecov (0.17.0)
|
|
46
|
-
docile (~> 1.1)
|
|
47
|
-
json (>= 1.8, < 3)
|
|
48
|
-
simplecov-html (~> 0.10.0)
|
|
49
|
-
simplecov-html (0.10.2)
|
|
50
|
-
thread_safe (0.3.6)
|
|
51
|
-
tzinfo (1.2.5)
|
|
52
|
-
thread_safe (~> 0.1)
|
|
53
|
-
unicode-display_width (1.6.0)
|
|
54
|
-
zeitwerk (2.1.9)
|
|
55
|
-
|
|
56
|
-
PLATFORMS
|
|
57
|
-
ruby
|
|
58
|
-
|
|
59
|
-
DEPENDENCIES
|
|
60
|
-
activesupport
|
|
61
|
-
rake
|
|
62
|
-
rspec
|
|
63
|
-
rubocop
|
|
64
|
-
simplecov
|
|
65
|
-
|
|
66
|
-
BUNDLED WITH
|
|
67
|
-
1.17.3
|
data/profile-tools.gemspec
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
Gem::Specification.new do |s|
|
|
4
|
-
s.name = 'profile-tools'
|
|
5
|
-
s.version = '0.1.0'
|
|
6
|
-
s.licenses = ['MIT']
|
|
7
|
-
s.summary = 'Profile tools'
|
|
8
|
-
s.description = 'Dynamically add method profiling to any class. Collects method times and objects created.'
|
|
9
|
-
s.authors = ['Doug Youch']
|
|
10
|
-
s.email = 'dougyouch@gmail.com'
|
|
11
|
-
s.homepage = 'https://github.com/dougyouch/profile-tools'
|
|
12
|
-
s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|examples)/}) }
|
|
13
|
-
end
|
data/script/console
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
# frozen_string_literal: true
|
|
3
|
-
|
|
4
|
-
$LOAD_PATH << File.expand_path('../lib', __dir__)
|
|
5
|
-
|
|
6
|
-
require 'active_support/notifications'
|
|
7
|
-
require 'active_support/log_subscriber'
|
|
8
|
-
require 'logger'
|
|
9
|
-
require 'concurrent'
|
|
10
|
-
require 'profile-tools'
|
|
11
|
-
require 'irb'
|
|
12
|
-
|
|
13
|
-
ActiveSupport::LogSubscriber.logger = Logger.new($stdout)
|
|
14
|
-
ProfileTools::LogSubscriber.attach_to :profile_tools
|
|
15
|
-
|
|
16
|
-
IRB.start(__FILE__)
|
data/script/test
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
# frozen_string_literal: true
|
|
3
|
-
|
|
4
|
-
$LOAD_PATH << File.expand_path('../lib', __dir__)
|
|
5
|
-
|
|
6
|
-
require 'active_support/notifications'
|
|
7
|
-
require 'active_support/log_subscriber'
|
|
8
|
-
require 'logger'
|
|
9
|
-
require 'concurrent'
|
|
10
|
-
require 'profile-tools'
|
|
11
|
-
require 'irb'
|
|
12
|
-
|
|
13
|
-
ActiveSupport::LogSubscriber.logger = Logger.new($stdout)
|
|
14
|
-
ProfileTools::LogSubscriber.attach_to :profile_tools
|
|
15
|
-
|
|
16
|
-
class Foo
|
|
17
|
-
def bar
|
|
18
|
-
bar2
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
def bar2
|
|
22
|
-
puts "HERE #{1} too"
|
|
23
|
-
bar3
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
def bar3
|
|
27
|
-
puts "HERE #{1}"
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def bar4
|
|
31
|
-
bar2
|
|
32
|
-
5.times { bar3 }
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
def bar5
|
|
36
|
-
5.times { 1 }
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
def bar6
|
|
40
|
-
bar4
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
ProfileTools.new.tap do |t|
|
|
45
|
-
t.profile_instance_method(:Foo, :bar)
|
|
46
|
-
t.profile_instance_method(:Foo, :bar2)
|
|
47
|
-
t.profile_instance_method(:Foo, :bar3)
|
|
48
|
-
t.profile_instance_method(:Foo, :bar4)
|
|
49
|
-
t.profile_instance_method(:Foo, :bar5)
|
|
50
|
-
t.profile_instance_method(:Foo, :bar6)
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
IRB.start(__FILE__)
|