ruby-prof 1.7.1 → 1.7.2
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/CHANGES +8 -0
- data/ext/ruby_prof/extconf.rb +23 -22
- data/ext/ruby_prof/rp_call_trees.c +296 -296
- data/ext/ruby_prof/rp_call_trees.h +28 -28
- data/ext/ruby_prof/rp_measure_allocations.c +47 -47
- data/ext/ruby_prof/rp_measure_process_time.c +64 -66
- data/ext/ruby_prof/rp_measure_wall_time.c +52 -64
- data/ext/ruby_prof/rp_method.c +551 -551
- data/ext/ruby_prof/rp_stack.c +212 -212
- data/ext/ruby_prof/ruby_prof.c +50 -50
- data/ext/ruby_prof/ruby_prof.h +3 -2
- data/ext/ruby_prof/vc/ruby_prof.vcxproj +3 -3
- data/lib/ruby-prof/compatibility.rb +113 -113
- data/lib/ruby-prof/exclude_common_methods.rb +204 -204
- data/lib/ruby-prof/printers/abstract_printer.rb +156 -138
- data/lib/ruby-prof/version.rb +3 -3
- data/ruby-prof.gemspec +66 -65
- data/test/dynamic_method_test.rb +9 -21
- data/test/enumerable_test.rb +23 -21
- data/test/exclude_methods_test.rb +363 -257
- data/test/fiber_test.rb +195 -195
- data/test/gc_test.rb +104 -102
- data/test/line_number_test.rb +426 -289
- data/test/measure_allocations_test.rb +1172 -1081
- data/test/measure_memory_test.rb +1193 -1456
- data/test/measure_process_time_test.rb +3330 -2477
- data/test/measure_wall_time_test.rb +634 -568
- data/test/merge_test.rb +146 -146
- data/test/method_info_test.rb +100 -95
- data/test/printers_test.rb +178 -135
- data/test/recursive_test.rb +796 -622
- data/test/start_stop_test.rb +4 -4
- data/test/test_helper.rb +20 -20
- data/test/thread_test.rb +229 -231
- data/test/unique_call_path_test.rb +9 -22
- data/test/yarv_test.rb +1 -5
- metadata +19 -9
- data/test/crash2.rb +0 -144
@@ -1,113 +1,113 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
# These methods are deprecated and are available for backwards compatability.
|
4
|
-
module RubyProf
|
5
|
-
# call-seq:
|
6
|
-
# measure_mode -> measure_mode
|
7
|
-
#
|
8
|
-
# Returns what ruby-prof is measuring. Valid values include:
|
9
|
-
#
|
10
|
-
# * RubyProf::WALL_TIME
|
11
|
-
# * RubyProf::PROCESS_TIME
|
12
|
-
# * RubyProf::ALLOCATIONS
|
13
|
-
# * RubyProf::MEMORY
|
14
|
-
def self.measure_mode
|
15
|
-
@measure_mode ||= RubyProf::WALL_TIME
|
16
|
-
end
|
17
|
-
|
18
|
-
# call-seq:
|
19
|
-
# measure_mode=value -> void
|
20
|
-
#
|
21
|
-
# Specifies what ruby-prof should measure. Valid values include:
|
22
|
-
#
|
23
|
-
# * RubyProf::WALL_TIME - Wall time measures the real-world time elapsed between any two moments. If there are other processes concurrently running on the system that use significant CPU or disk time during a profiling run then the reported results will be larger than expected. On Windows, wall time is measured using GetTickCount(), on MacOS by mach_absolute_time, on Linux by clock_gettime and otherwise by gettimeofday.
|
24
|
-
# * RubyProf::PROCESS_TIME - Process time measures the time used by a process between any two moments. It is unaffected by other processes concurrently running on the system. Remember with process time that calls to methods like sleep will not be included in profiling results. On Windows, process time is measured using GetProcessTimes and on other platforms by clock_gettime.
|
25
|
-
# * RubyProf::ALLOCATIONS - Object allocations measures show how many objects each method in a program allocates. Measurements are done via Ruby's GC.stat api.
|
26
|
-
# * RubyProf::MEMORY - Memory measures how much memory each method in a program uses. Measurements are done via Ruby's TracePoint api.
|
27
|
-
def self.measure_mode=(value)
|
28
|
-
@measure_mode = value
|
29
|
-
end
|
30
|
-
|
31
|
-
# Returns the threads that ruby-prof should exclude from profiling
|
32
|
-
def self.exclude_threads
|
33
|
-
@exclude_threads ||= Array.new
|
34
|
-
end
|
35
|
-
|
36
|
-
# Specifies which threads ruby-prof should exclude from profiling
|
37
|
-
def self.exclude_threads=(value)
|
38
|
-
@exclude_threads = value
|
39
|
-
end
|
40
|
-
|
41
|
-
# Starts profiling
|
42
|
-
def self.start
|
43
|
-
ensure_not_running!
|
44
|
-
@profile = Profile.new(:measure_mode => measure_mode, :exclude_threads => exclude_threads)
|
45
|
-
@profile.start
|
46
|
-
end
|
47
|
-
|
48
|
-
# Pauses profiling
|
49
|
-
def self.pause
|
50
|
-
ensure_running!
|
51
|
-
@profile.pause
|
52
|
-
end
|
53
|
-
|
54
|
-
# Is a profile running?
|
55
|
-
def self.running?
|
56
|
-
if defined?(@profile) and @profile
|
57
|
-
@profile.running?
|
58
|
-
else
|
59
|
-
false
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
# Resume profiling
|
64
|
-
def self.resume
|
65
|
-
ensure_running!
|
66
|
-
@profile.resume
|
67
|
-
end
|
68
|
-
|
69
|
-
# Stops profiling
|
70
|
-
def self.stop
|
71
|
-
ensure_running!
|
72
|
-
result = @profile.stop
|
73
|
-
@profile = nil
|
74
|
-
result
|
75
|
-
end
|
76
|
-
|
77
|
-
# Profiles a block
|
78
|
-
def self.profile(options = {}, &block)
|
79
|
-
ensure_not_running!
|
80
|
-
options = {:measure_mode => measure_mode, :exclude_threads => exclude_threads }.merge!(options)
|
81
|
-
Profile.profile(options, &block)
|
82
|
-
end
|
83
|
-
|
84
|
-
# :nodoc:
|
85
|
-
def self.start_script(script)
|
86
|
-
start
|
87
|
-
load script
|
88
|
-
end
|
89
|
-
|
90
|
-
private
|
91
|
-
|
92
|
-
def self.ensure_running!
|
93
|
-
raise(RuntimeError, "RubyProf.start was not yet called") unless running?
|
94
|
-
end
|
95
|
-
|
96
|
-
def self.ensure_not_running!
|
97
|
-
raise(RuntimeError, "RubyProf is already running") if running?
|
98
|
-
end
|
99
|
-
|
100
|
-
class << self
|
101
|
-
extend Gem::Deprecate
|
102
|
-
deprecate :measure_mode, "RubyProf::Profile#measure_mode", 2023, 6
|
103
|
-
deprecate :measure_mode=, "RubyProf::Profile
|
104
|
-
deprecate :exclude_threads, "RubyProf::Profile#exclude_threads", 2023, 6
|
105
|
-
deprecate :exclude_threads=, "RubyProf::Profile#initialize", 2023, 6
|
106
|
-
deprecate :start, "RubyProf::Profile#start", 2023, 6
|
107
|
-
deprecate :pause, "RubyProf::Profile#pause", 2023, 6
|
108
|
-
deprecate :stop, "RubyProf::Profile#stop", 2023, 6
|
109
|
-
deprecate :resume, "RubyProf::Profile#resume", 2023, 6
|
110
|
-
deprecate :running?, "RubyProf::Profile#running?", 2023, 6
|
111
|
-
deprecate :profile, "RubyProf::Profile.profile", 2023, 6
|
112
|
-
end
|
113
|
-
end
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
# These methods are deprecated and are available for backwards compatability.
|
4
|
+
module RubyProf
|
5
|
+
# call-seq:
|
6
|
+
# measure_mode -> measure_mode
|
7
|
+
#
|
8
|
+
# Returns what ruby-prof is measuring. Valid values include:
|
9
|
+
#
|
10
|
+
# * RubyProf::WALL_TIME
|
11
|
+
# * RubyProf::PROCESS_TIME
|
12
|
+
# * RubyProf::ALLOCATIONS
|
13
|
+
# * RubyProf::MEMORY
|
14
|
+
def self.measure_mode
|
15
|
+
@measure_mode ||= RubyProf::WALL_TIME
|
16
|
+
end
|
17
|
+
|
18
|
+
# call-seq:
|
19
|
+
# measure_mode=value -> void
|
20
|
+
#
|
21
|
+
# Specifies what ruby-prof should measure. Valid values include:
|
22
|
+
#
|
23
|
+
# * RubyProf::WALL_TIME - Wall time measures the real-world time elapsed between any two moments. If there are other processes concurrently running on the system that use significant CPU or disk time during a profiling run then the reported results will be larger than expected. On Windows, wall time is measured using GetTickCount(), on MacOS by mach_absolute_time, on Linux by clock_gettime and otherwise by gettimeofday.
|
24
|
+
# * RubyProf::PROCESS_TIME - Process time measures the time used by a process between any two moments. It is unaffected by other processes concurrently running on the system. Remember with process time that calls to methods like sleep will not be included in profiling results. On Windows, process time is measured using GetProcessTimes and on other platforms by clock_gettime.
|
25
|
+
# * RubyProf::ALLOCATIONS - Object allocations measures show how many objects each method in a program allocates. Measurements are done via Ruby's GC.stat api.
|
26
|
+
# * RubyProf::MEMORY - Memory measures how much memory each method in a program uses. Measurements are done via Ruby's TracePoint api.
|
27
|
+
def self.measure_mode=(value)
|
28
|
+
@measure_mode = value
|
29
|
+
end
|
30
|
+
|
31
|
+
# Returns the threads that ruby-prof should exclude from profiling
|
32
|
+
def self.exclude_threads
|
33
|
+
@exclude_threads ||= Array.new
|
34
|
+
end
|
35
|
+
|
36
|
+
# Specifies which threads ruby-prof should exclude from profiling
|
37
|
+
def self.exclude_threads=(value)
|
38
|
+
@exclude_threads = value
|
39
|
+
end
|
40
|
+
|
41
|
+
# Starts profiling
|
42
|
+
def self.start
|
43
|
+
ensure_not_running!
|
44
|
+
@profile = Profile.new(:measure_mode => measure_mode, :exclude_threads => exclude_threads)
|
45
|
+
@profile.start
|
46
|
+
end
|
47
|
+
|
48
|
+
# Pauses profiling
|
49
|
+
def self.pause
|
50
|
+
ensure_running!
|
51
|
+
@profile.pause
|
52
|
+
end
|
53
|
+
|
54
|
+
# Is a profile running?
|
55
|
+
def self.running?
|
56
|
+
if defined?(@profile) and @profile
|
57
|
+
@profile.running?
|
58
|
+
else
|
59
|
+
false
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
# Resume profiling
|
64
|
+
def self.resume
|
65
|
+
ensure_running!
|
66
|
+
@profile.resume
|
67
|
+
end
|
68
|
+
|
69
|
+
# Stops profiling
|
70
|
+
def self.stop
|
71
|
+
ensure_running!
|
72
|
+
result = @profile.stop
|
73
|
+
@profile = nil
|
74
|
+
result
|
75
|
+
end
|
76
|
+
|
77
|
+
# Profiles a block
|
78
|
+
def self.profile(options = {}, &block)
|
79
|
+
ensure_not_running!
|
80
|
+
options = {:measure_mode => measure_mode, :exclude_threads => exclude_threads }.merge!(options)
|
81
|
+
Profile.profile(options, &block)
|
82
|
+
end
|
83
|
+
|
84
|
+
# :nodoc:
|
85
|
+
def self.start_script(script)
|
86
|
+
start
|
87
|
+
load script
|
88
|
+
end
|
89
|
+
|
90
|
+
private
|
91
|
+
|
92
|
+
def self.ensure_running!
|
93
|
+
raise(RuntimeError, "RubyProf.start was not yet called") unless running?
|
94
|
+
end
|
95
|
+
|
96
|
+
def self.ensure_not_running!
|
97
|
+
raise(RuntimeError, "RubyProf is already running") if running?
|
98
|
+
end
|
99
|
+
|
100
|
+
class << self
|
101
|
+
extend Gem::Deprecate
|
102
|
+
deprecate :measure_mode, "RubyProf::Profile#measure_mode", 2023, 6
|
103
|
+
deprecate :measure_mode=, "RubyProf::Profile.new(measure_mode: ...)", 2023, 6
|
104
|
+
deprecate :exclude_threads, "RubyProf::Profile#exclude_threads", 2023, 6
|
105
|
+
deprecate :exclude_threads=, "RubyProf::Profile#initialize", 2023, 6
|
106
|
+
deprecate :start, "RubyProf::Profile#start", 2023, 6
|
107
|
+
deprecate :pause, "RubyProf::Profile#pause", 2023, 6
|
108
|
+
deprecate :stop, "RubyProf::Profile#stop", 2023, 6
|
109
|
+
deprecate :resume, "RubyProf::Profile#resume", 2023, 6
|
110
|
+
deprecate :running?, "RubyProf::Profile#running?", 2023, 6
|
111
|
+
deprecate :profile, "RubyProf::Profile.profile", 2023, 6
|
112
|
+
end
|
113
|
+
end
|
@@ -1,204 +1,204 @@
|
|
1
|
-
require 'set'
|
2
|
-
|
3
|
-
# :enddoc:
|
4
|
-
module RubyProf
|
5
|
-
module ExcludeCommonMethods
|
6
|
-
ENUMERABLE_NAMES = Enumerable.instance_methods(false)
|
7
|
-
|
8
|
-
def self.apply!(profile)
|
9
|
-
##
|
10
|
-
# Kernel Methods
|
11
|
-
##
|
12
|
-
|
13
|
-
exclude_methods(profile, Kernel, [
|
14
|
-
:dup,
|
15
|
-
:initialize_dup,
|
16
|
-
:tap,
|
17
|
-
:send,
|
18
|
-
:public_send,
|
19
|
-
])
|
20
|
-
|
21
|
-
##
|
22
|
-
# Fundamental Types
|
23
|
-
##
|
24
|
-
|
25
|
-
exclude_methods(profile, BasicObject, :!=)
|
26
|
-
exclude_methods(profile, Kernel, :"block_given?")
|
27
|
-
exclude_methods(profile, Method, :[])
|
28
|
-
exclude_methods(profile, Module, :new)
|
29
|
-
exclude_methods(profile, Class, :new)
|
30
|
-
exclude_methods(profile, Proc, :call, :yield)
|
31
|
-
exclude_methods(profile, Range, :each)
|
32
|
-
|
33
|
-
##
|
34
|
-
# Value Types
|
35
|
-
##
|
36
|
-
|
37
|
-
exclude_methods(profile, Integer, [
|
38
|
-
:times,
|
39
|
-
:succ,
|
40
|
-
:<
|
41
|
-
])
|
42
|
-
|
43
|
-
exclude_methods(profile, String, [
|
44
|
-
:sub,
|
45
|
-
:sub!,
|
46
|
-
:gsub,
|
47
|
-
:gsub!,
|
48
|
-
])
|
49
|
-
|
50
|
-
##
|
51
|
-
# Emumerables
|
52
|
-
##
|
53
|
-
|
54
|
-
exclude_enumerable(profile, Enumerable)
|
55
|
-
exclude_enumerable(profile, Enumerator)
|
56
|
-
|
57
|
-
##
|
58
|
-
# Collections
|
59
|
-
##
|
60
|
-
|
61
|
-
exclude_enumerable(profile, Array, [
|
62
|
-
:each_index,
|
63
|
-
:map!,
|
64
|
-
:select!,
|
65
|
-
:reject!,
|
66
|
-
:collect!,
|
67
|
-
:sort!,
|
68
|
-
:sort_by!,
|
69
|
-
:index,
|
70
|
-
:delete_if,
|
71
|
-
:keep_if,
|
72
|
-
:drop_while,
|
73
|
-
:uniq,
|
74
|
-
:uniq!,
|
75
|
-
:"==",
|
76
|
-
:eql?,
|
77
|
-
:hash,
|
78
|
-
:to_json,
|
79
|
-
:as_json,
|
80
|
-
:encode_json,
|
81
|
-
])
|
82
|
-
|
83
|
-
exclude_enumerable(profile, Hash, [
|
84
|
-
:dup,
|
85
|
-
:initialize_dup,
|
86
|
-
:fetch,
|
87
|
-
:"[]",
|
88
|
-
:"[]=",
|
89
|
-
:each_key,
|
90
|
-
:each_value,
|
91
|
-
:each_pair,
|
92
|
-
:map!,
|
93
|
-
:select!,
|
94
|
-
:reject!,
|
95
|
-
:collect!,
|
96
|
-
:delete_if,
|
97
|
-
:keep_if,
|
98
|
-
:slice,
|
99
|
-
:slice!,
|
100
|
-
:except,
|
101
|
-
:except!,
|
102
|
-
:"==",
|
103
|
-
:eql?,
|
104
|
-
:hash,
|
105
|
-
:to_json,
|
106
|
-
:as_json,
|
107
|
-
:encode_json,
|
108
|
-
])
|
109
|
-
|
110
|
-
exclude_enumerable(profile, Set, [
|
111
|
-
:map!,
|
112
|
-
:select!,
|
113
|
-
:reject!,
|
114
|
-
:collect!,
|
115
|
-
:classify,
|
116
|
-
:delete_if,
|
117
|
-
:keep_if,
|
118
|
-
:divide,
|
119
|
-
:"==",
|
120
|
-
:eql?,
|
121
|
-
:hash,
|
122
|
-
:to_json,
|
123
|
-
:as_json,
|
124
|
-
:encode_json,
|
125
|
-
])
|
126
|
-
|
127
|
-
##
|
128
|
-
# Garbage Collection
|
129
|
-
##
|
130
|
-
|
131
|
-
exclude_singleton_methods(profile, GC, [
|
132
|
-
:start
|
133
|
-
])
|
134
|
-
|
135
|
-
##
|
136
|
-
# Unicorn
|
137
|
-
##
|
138
|
-
|
139
|
-
if defined?(Unicorn)
|
140
|
-
exclude_methods(profile, Unicorn::HttpServer, :process_client)
|
141
|
-
end
|
142
|
-
|
143
|
-
if defined?(Unicorn::OobGC)
|
144
|
-
exclude_methods(profile, Unicorn::OobGC, :process_client)
|
145
|
-
end
|
146
|
-
|
147
|
-
##
|
148
|
-
# New Relic
|
149
|
-
##
|
150
|
-
|
151
|
-
if defined?(NewRelic::Agent)
|
152
|
-
if defined?(NewRelic::Agent::Instrumentation::MiddlewareTracing)
|
153
|
-
exclude_methods(profile, NewRelic::Agent::Instrumentation::MiddlewareTracing, [
|
154
|
-
:call
|
155
|
-
])
|
156
|
-
end
|
157
|
-
|
158
|
-
if defined?(NewRelic::Agent::MethodTracerHelpers)
|
159
|
-
exclude_methods(profile, NewRelic::Agent::MethodTracerHelpers, [
|
160
|
-
:trace_execution_scoped,
|
161
|
-
:log_errors,
|
162
|
-
])
|
163
|
-
|
164
|
-
exclude_singleton_methods(profile, NewRelic::Agent::MethodTracerHelpers, [
|
165
|
-
:trace_execution_scoped,
|
166
|
-
:log_errors,
|
167
|
-
])
|
168
|
-
end
|
169
|
-
|
170
|
-
if defined?(NewRelic::Agent::MethodTracer)
|
171
|
-
exclude_methods(profile, NewRelic::Agent::MethodTracer, [
|
172
|
-
:trace_execution_scoped,
|
173
|
-
:trace_execution_unscoped,
|
174
|
-
])
|
175
|
-
end
|
176
|
-
end
|
177
|
-
|
178
|
-
##
|
179
|
-
# Miscellaneous Methods
|
180
|
-
##
|
181
|
-
|
182
|
-
if defined?(Mustache)
|
183
|
-
exclude_methods(profile, Mustache::Context, [
|
184
|
-
:fetch
|
185
|
-
])
|
186
|
-
end
|
187
|
-
end
|
188
|
-
|
189
|
-
private
|
190
|
-
|
191
|
-
def self.exclude_enumerable(profile, mod, *method_or_methods)
|
192
|
-
exclude_methods(profile, mod, [:each, *method_or_methods])
|
193
|
-
exclude_methods(profile, mod, ENUMERABLE_NAMES)
|
194
|
-
end
|
195
|
-
|
196
|
-
def self.exclude_methods(profile, mod, *method_or_methods)
|
197
|
-
profile.exclude_methods!(mod, method_or_methods)
|
198
|
-
end
|
199
|
-
|
200
|
-
def self.exclude_singleton_methods(profile, mod, *method_or_methods)
|
201
|
-
profile.exclude_singleton_methods!(mod, method_or_methods)
|
202
|
-
end
|
203
|
-
end
|
204
|
-
end
|
1
|
+
require 'set'
|
2
|
+
|
3
|
+
# :enddoc:
|
4
|
+
module RubyProf
|
5
|
+
module ExcludeCommonMethods
|
6
|
+
ENUMERABLE_NAMES = Enumerable.instance_methods(false)
|
7
|
+
|
8
|
+
def self.apply!(profile)
|
9
|
+
##
|
10
|
+
# Kernel Methods
|
11
|
+
##
|
12
|
+
|
13
|
+
exclude_methods(profile, Kernel, [
|
14
|
+
:dup,
|
15
|
+
:initialize_dup,
|
16
|
+
:tap,
|
17
|
+
:send,
|
18
|
+
:public_send,
|
19
|
+
])
|
20
|
+
|
21
|
+
##
|
22
|
+
# Fundamental Types
|
23
|
+
##
|
24
|
+
|
25
|
+
exclude_methods(profile, BasicObject, :!=)
|
26
|
+
exclude_methods(profile, Kernel, :"block_given?")
|
27
|
+
exclude_methods(profile, Method, :[])
|
28
|
+
exclude_methods(profile, Module, :new)
|
29
|
+
exclude_methods(profile, Class, :new)
|
30
|
+
exclude_methods(profile, Proc, :call, :yield)
|
31
|
+
exclude_methods(profile, Range, :each)
|
32
|
+
|
33
|
+
##
|
34
|
+
# Value Types
|
35
|
+
##
|
36
|
+
|
37
|
+
exclude_methods(profile, Integer, [
|
38
|
+
:times,
|
39
|
+
:succ,
|
40
|
+
:<
|
41
|
+
])
|
42
|
+
|
43
|
+
exclude_methods(profile, String, [
|
44
|
+
:sub,
|
45
|
+
:sub!,
|
46
|
+
:gsub,
|
47
|
+
:gsub!,
|
48
|
+
])
|
49
|
+
|
50
|
+
##
|
51
|
+
# Emumerables
|
52
|
+
##
|
53
|
+
|
54
|
+
exclude_enumerable(profile, Enumerable)
|
55
|
+
exclude_enumerable(profile, Enumerator)
|
56
|
+
|
57
|
+
##
|
58
|
+
# Collections
|
59
|
+
##
|
60
|
+
|
61
|
+
exclude_enumerable(profile, Array, [
|
62
|
+
:each_index,
|
63
|
+
:map!,
|
64
|
+
:select!,
|
65
|
+
:reject!,
|
66
|
+
:collect!,
|
67
|
+
:sort!,
|
68
|
+
:sort_by!,
|
69
|
+
:index,
|
70
|
+
:delete_if,
|
71
|
+
:keep_if,
|
72
|
+
:drop_while,
|
73
|
+
:uniq,
|
74
|
+
:uniq!,
|
75
|
+
:"==",
|
76
|
+
:eql?,
|
77
|
+
:hash,
|
78
|
+
:to_json,
|
79
|
+
:as_json,
|
80
|
+
:encode_json,
|
81
|
+
])
|
82
|
+
|
83
|
+
exclude_enumerable(profile, Hash, [
|
84
|
+
:dup,
|
85
|
+
:initialize_dup,
|
86
|
+
:fetch,
|
87
|
+
:"[]",
|
88
|
+
:"[]=",
|
89
|
+
:each_key,
|
90
|
+
:each_value,
|
91
|
+
:each_pair,
|
92
|
+
:map!,
|
93
|
+
:select!,
|
94
|
+
:reject!,
|
95
|
+
:collect!,
|
96
|
+
:delete_if,
|
97
|
+
:keep_if,
|
98
|
+
:slice,
|
99
|
+
:slice!,
|
100
|
+
:except,
|
101
|
+
:except!,
|
102
|
+
:"==",
|
103
|
+
:eql?,
|
104
|
+
:hash,
|
105
|
+
:to_json,
|
106
|
+
:as_json,
|
107
|
+
:encode_json,
|
108
|
+
])
|
109
|
+
|
110
|
+
exclude_enumerable(profile, Set, [
|
111
|
+
:map!,
|
112
|
+
:select!,
|
113
|
+
:reject!,
|
114
|
+
:collect!,
|
115
|
+
:classify,
|
116
|
+
:delete_if,
|
117
|
+
:keep_if,
|
118
|
+
:divide,
|
119
|
+
:"==",
|
120
|
+
:eql?,
|
121
|
+
:hash,
|
122
|
+
:to_json,
|
123
|
+
:as_json,
|
124
|
+
:encode_json,
|
125
|
+
])
|
126
|
+
|
127
|
+
##
|
128
|
+
# Garbage Collection
|
129
|
+
##
|
130
|
+
|
131
|
+
exclude_singleton_methods(profile, GC, [
|
132
|
+
:start
|
133
|
+
])
|
134
|
+
|
135
|
+
##
|
136
|
+
# Unicorn
|
137
|
+
##
|
138
|
+
|
139
|
+
if defined?(Unicorn)
|
140
|
+
exclude_methods(profile, Unicorn::HttpServer, :process_client)
|
141
|
+
end
|
142
|
+
|
143
|
+
if defined?(Unicorn::OobGC)
|
144
|
+
exclude_methods(profile, Unicorn::OobGC, :process_client)
|
145
|
+
end
|
146
|
+
|
147
|
+
##
|
148
|
+
# New Relic
|
149
|
+
##
|
150
|
+
|
151
|
+
if defined?(NewRelic::Agent)
|
152
|
+
if defined?(NewRelic::Agent::Instrumentation::MiddlewareTracing)
|
153
|
+
exclude_methods(profile, NewRelic::Agent::Instrumentation::MiddlewareTracing, [
|
154
|
+
:call
|
155
|
+
])
|
156
|
+
end
|
157
|
+
|
158
|
+
if defined?(NewRelic::Agent::MethodTracerHelpers)
|
159
|
+
exclude_methods(profile, NewRelic::Agent::MethodTracerHelpers, [
|
160
|
+
:trace_execution_scoped,
|
161
|
+
:log_errors,
|
162
|
+
])
|
163
|
+
|
164
|
+
exclude_singleton_methods(profile, NewRelic::Agent::MethodTracerHelpers, [
|
165
|
+
:trace_execution_scoped,
|
166
|
+
:log_errors,
|
167
|
+
])
|
168
|
+
end
|
169
|
+
|
170
|
+
if defined?(NewRelic::Agent::MethodTracer)
|
171
|
+
exclude_methods(profile, NewRelic::Agent::MethodTracer, [
|
172
|
+
:trace_execution_scoped,
|
173
|
+
:trace_execution_unscoped,
|
174
|
+
])
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
178
|
+
##
|
179
|
+
# Miscellaneous Methods
|
180
|
+
##
|
181
|
+
|
182
|
+
if defined?(Mustache)
|
183
|
+
exclude_methods(profile, Mustache::Context, [
|
184
|
+
:fetch
|
185
|
+
])
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
189
|
+
private
|
190
|
+
|
191
|
+
def self.exclude_enumerable(profile, mod, *method_or_methods)
|
192
|
+
exclude_methods(profile, mod, [:each, *method_or_methods])
|
193
|
+
exclude_methods(profile, mod, ENUMERABLE_NAMES)
|
194
|
+
end
|
195
|
+
|
196
|
+
def self.exclude_methods(profile, mod, *method_or_methods)
|
197
|
+
profile.exclude_methods!(mod, method_or_methods)
|
198
|
+
end
|
199
|
+
|
200
|
+
def self.exclude_singleton_methods(profile, mod, *method_or_methods)
|
201
|
+
profile.exclude_singleton_methods!(mod, method_or_methods)
|
202
|
+
end
|
203
|
+
end
|
204
|
+
end
|