ruby-prof 0.17.0 → 0.18.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.
Files changed (185) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGES +500 -482
  3. data/LICENSE +24 -24
  4. data/README.rdoc +487 -485
  5. data/Rakefile +113 -113
  6. data/bin/ruby-prof +345 -345
  7. data/bin/ruby-prof-check-trace +45 -45
  8. data/examples/flat.txt +50 -50
  9. data/examples/graph.dot +84 -84
  10. data/examples/graph.html +823 -823
  11. data/examples/graph.txt +139 -139
  12. data/examples/multi.flat.txt +23 -23
  13. data/examples/multi.graph.html +760 -760
  14. data/examples/multi.grind.dat +114 -114
  15. data/examples/multi.stack.html +547 -547
  16. data/examples/stack.html +547 -547
  17. data/ext/ruby_prof/extconf.rb +68 -68
  18. data/ext/ruby_prof/rp_call_info.c +425 -425
  19. data/ext/ruby_prof/rp_call_info.h +53 -53
  20. data/ext/ruby_prof/rp_measure.c +40 -40
  21. data/ext/ruby_prof/rp_measure.h +45 -45
  22. data/ext/ruby_prof/rp_measure_allocations.c +76 -76
  23. data/ext/ruby_prof/rp_measure_cpu_time.c +136 -136
  24. data/ext/ruby_prof/rp_measure_gc_runs.c +73 -73
  25. data/ext/ruby_prof/rp_measure_gc_time.c +60 -60
  26. data/ext/ruby_prof/rp_measure_memory.c +77 -77
  27. data/ext/ruby_prof/rp_measure_process_time.c +71 -71
  28. data/ext/ruby_prof/rp_measure_wall_time.c +45 -45
  29. data/ext/ruby_prof/rp_method.c +630 -636
  30. data/ext/ruby_prof/rp_method.h +75 -75
  31. data/ext/ruby_prof/rp_stack.c +173 -173
  32. data/ext/ruby_prof/rp_stack.h +63 -63
  33. data/ext/ruby_prof/rp_thread.c +277 -276
  34. data/ext/ruby_prof/rp_thread.h +27 -27
  35. data/ext/ruby_prof/ruby_prof.c +794 -774
  36. data/ext/ruby_prof/ruby_prof.h +60 -59
  37. data/ext/ruby_prof/vc/ruby_prof.sln +20 -21
  38. data/ext/ruby_prof/vc/{ruby_prof_20.vcxproj → ruby_prof.vcxproj} +31 -0
  39. data/lib/ruby-prof.rb +68 -68
  40. data/lib/ruby-prof/aggregate_call_info.rb +76 -76
  41. data/lib/ruby-prof/assets/call_stack_printer.css.html +116 -116
  42. data/lib/ruby-prof/assets/call_stack_printer.js.html +384 -384
  43. data/lib/ruby-prof/call_info.rb +115 -115
  44. data/lib/ruby-prof/call_info_visitor.rb +40 -40
  45. data/lib/ruby-prof/compatibility.rb +179 -178
  46. data/lib/ruby-prof/method_info.rb +121 -121
  47. data/lib/ruby-prof/printers/abstract_printer.rb +104 -103
  48. data/lib/ruby-prof/printers/call_info_printer.rb +41 -41
  49. data/lib/ruby-prof/printers/call_stack_printer.rb +265 -265
  50. data/lib/ruby-prof/printers/call_tree_printer.rb +143 -143
  51. data/lib/ruby-prof/printers/dot_printer.rb +132 -132
  52. data/lib/ruby-prof/printers/flat_printer.rb +70 -70
  53. data/lib/ruby-prof/printers/flat_printer_with_line_numbers.rb +83 -83
  54. data/lib/ruby-prof/printers/graph_html_printer.rb +249 -249
  55. data/lib/ruby-prof/printers/graph_printer.rb +116 -116
  56. data/lib/ruby-prof/printers/multi_printer.rb +84 -84
  57. data/lib/ruby-prof/profile.rb +26 -26
  58. data/lib/ruby-prof/profile/exclude_common_methods.rb +207 -201
  59. data/lib/ruby-prof/profile/legacy_method_elimination.rb +50 -49
  60. data/lib/ruby-prof/rack.rb +174 -174
  61. data/lib/ruby-prof/task.rb +147 -147
  62. data/lib/ruby-prof/thread.rb +35 -35
  63. data/lib/ruby-prof/version.rb +3 -3
  64. data/lib/unprof.rb +10 -10
  65. data/ruby-prof.gemspec +58 -58
  66. data/test/abstract_printer_test.rb +53 -0
  67. data/test/aggregate_test.rb +136 -136
  68. data/test/basic_test.rb +128 -128
  69. data/test/block_test.rb +74 -74
  70. data/test/call_info_test.rb +78 -78
  71. data/test/call_info_visitor_test.rb +31 -31
  72. data/test/duplicate_names_test.rb +32 -32
  73. data/test/dynamic_method_test.rb +55 -55
  74. data/test/enumerable_test.rb +21 -21
  75. data/test/exceptions_test.rb +24 -16
  76. data/test/exclude_methods_test.rb +146 -146
  77. data/test/exclude_threads_test.rb +53 -53
  78. data/test/fiber_test.rb +79 -79
  79. data/test/issue137_test.rb +63 -63
  80. data/test/line_number_test.rb +80 -80
  81. data/test/measure_allocations_test.rb +26 -26
  82. data/test/measure_cpu_time_test.rb +212 -213
  83. data/test/measure_gc_runs_test.rb +32 -32
  84. data/test/measure_gc_time_test.rb +36 -36
  85. data/test/measure_memory_test.rb +33 -33
  86. data/test/measure_process_time_test.rb +61 -63
  87. data/test/measure_wall_time_test.rb +255 -255
  88. data/test/method_elimination_test.rb +84 -84
  89. data/test/module_test.rb +45 -45
  90. data/test/multi_printer_test.rb +104 -104
  91. data/test/no_method_class_test.rb +15 -15
  92. data/test/pause_resume_test.rb +166 -166
  93. data/test/prime.rb +54 -54
  94. data/test/printers_test.rb +275 -275
  95. data/test/printing_recursive_graph_test.rb +127 -127
  96. data/test/rack_test.rb +157 -157
  97. data/test/recursive_test.rb +215 -215
  98. data/test/singleton_test.rb +38 -38
  99. data/test/stack_printer_test.rb +77 -78
  100. data/test/stack_test.rb +138 -138
  101. data/test/start_stop_test.rb +112 -112
  102. data/test/test_helper.rb +267 -275
  103. data/test/thread_test.rb +187 -187
  104. data/test/unique_call_path_test.rb +202 -202
  105. data/test/yarv_test.rb +55 -55
  106. metadata +17 -96
  107. data/doc/LICENSE.html +0 -115
  108. data/doc/README_rdoc.html +0 -637
  109. data/doc/Rack.html +0 -96
  110. data/doc/Rack/RubyProf.html +0 -233
  111. data/doc/Rack/RubyProf/RackProfiler.html +0 -343
  112. data/doc/RubyProf.html +0 -974
  113. data/doc/RubyProf/AbstractPrinter.html +0 -625
  114. data/doc/RubyProf/AggregateCallInfo.html +0 -552
  115. data/doc/RubyProf/CallInfo.html +0 -579
  116. data/doc/RubyProf/CallInfoPrinter.html +0 -121
  117. data/doc/RubyProf/CallInfoVisitor.html +0 -199
  118. data/doc/RubyProf/CallStackPrinter.html +0 -1127
  119. data/doc/RubyProf/CallTreePrinter.html +0 -725
  120. data/doc/RubyProf/Cmd.html +0 -637
  121. data/doc/RubyProf/DeprecationWarnings.html +0 -148
  122. data/doc/RubyProf/DotPrinter.html +0 -258
  123. data/doc/RubyProf/FlatPrinter.html +0 -164
  124. data/doc/RubyProf/FlatPrinterWithLineNumbers.html +0 -210
  125. data/doc/RubyProf/GraphHtmlPrinter.html +0 -558
  126. data/doc/RubyProf/GraphPrinter.html +0 -140
  127. data/doc/RubyProf/MethodInfo.html +0 -676
  128. data/doc/RubyProf/MultiPrinter.html +0 -574
  129. data/doc/RubyProf/Profile.html +0 -908
  130. data/doc/RubyProf/Profile/ExcludeCommonMethods.html +0 -411
  131. data/doc/RubyProf/Profile/LegacyMethodElimination.html +0 -158
  132. data/doc/RubyProf/ProfileTask.html +0 -491
  133. data/doc/RubyProf/Thread.html +0 -275
  134. data/doc/created.rid +0 -33
  135. data/doc/css/fonts.css +0 -167
  136. data/doc/css/rdoc.css +0 -590
  137. data/doc/examples/flat_txt.html +0 -139
  138. data/doc/examples/graph_html.html +0 -910
  139. data/doc/examples/graph_txt.html +0 -248
  140. data/doc/fonts/Lato-Light.ttf +0 -0
  141. data/doc/fonts/Lato-LightItalic.ttf +0 -0
  142. data/doc/fonts/Lato-Regular.ttf +0 -0
  143. data/doc/fonts/Lato-RegularItalic.ttf +0 -0
  144. data/doc/fonts/SourceCodePro-Bold.ttf +0 -0
  145. data/doc/fonts/SourceCodePro-Regular.ttf +0 -0
  146. data/doc/images/add.png +0 -0
  147. data/doc/images/arrow_up.png +0 -0
  148. data/doc/images/brick.png +0 -0
  149. data/doc/images/brick_link.png +0 -0
  150. data/doc/images/bug.png +0 -0
  151. data/doc/images/bullet_black.png +0 -0
  152. data/doc/images/bullet_toggle_minus.png +0 -0
  153. data/doc/images/bullet_toggle_plus.png +0 -0
  154. data/doc/images/date.png +0 -0
  155. data/doc/images/delete.png +0 -0
  156. data/doc/images/find.png +0 -0
  157. data/doc/images/loadingAnimation.gif +0 -0
  158. data/doc/images/macFFBgHack.png +0 -0
  159. data/doc/images/package.png +0 -0
  160. data/doc/images/page_green.png +0 -0
  161. data/doc/images/page_white_text.png +0 -0
  162. data/doc/images/page_white_width.png +0 -0
  163. data/doc/images/plugin.png +0 -0
  164. data/doc/images/ruby.png +0 -0
  165. data/doc/images/tag_blue.png +0 -0
  166. data/doc/images/tag_green.png +0 -0
  167. data/doc/images/transparent.png +0 -0
  168. data/doc/images/wrench.png +0 -0
  169. data/doc/images/wrench_orange.png +0 -0
  170. data/doc/images/zoom.png +0 -0
  171. data/doc/index.html +0 -666
  172. data/doc/js/darkfish.js +0 -161
  173. data/doc/js/jquery.js +0 -4
  174. data/doc/js/navigation.js +0 -142
  175. data/doc/js/navigation.js.gz +0 -0
  176. data/doc/js/search.js +0 -109
  177. data/doc/js/search_index.js +0 -1
  178. data/doc/js/search_index.js.gz +0 -0
  179. data/doc/js/searcher.js +0 -229
  180. data/doc/js/searcher.js.gz +0 -0
  181. data/doc/table_of_contents.html +0 -1052
  182. data/examples/cachegrind.out.1 +0 -114
  183. data/examples/cachegrind.out.1.32313213 +0 -114
  184. data/ext/ruby_prof/vc/ruby_prof_18.vcxproj +0 -108
  185. data/ext/ruby_prof/vc/ruby_prof_19.vcxproj +0 -110
@@ -1,908 +0,0 @@
1
- <!DOCTYPE html>
2
-
3
- <html>
4
- <head>
5
- <meta charset="UTF-8">
6
-
7
- <title>class RubyProf::Profile - ruby-prof</title>
8
-
9
- <script type="text/javascript">
10
- var rdoc_rel_prefix = "../";
11
- var index_rel_prefix = "../";
12
- </script>
13
-
14
- <script src="../js/jquery.js"></script>
15
- <script src="../js/darkfish.js"></script>
16
-
17
- <link href="../css/fonts.css" rel="stylesheet">
18
- <link href="../css/rdoc.css" rel="stylesheet">
19
-
20
-
21
-
22
- <body id="top" role="document" class="class">
23
- <nav role="navigation">
24
- <div id="project-navigation">
25
- <div id="home-section" role="region" title="Quick navigation" class="nav-section">
26
- <h2>
27
- <a href="../index.html" rel="home">Home</a>
28
- </h2>
29
-
30
- <div id="table-of-contents-navigation">
31
- <a href="../table_of_contents.html#pages">Pages</a>
32
- <a href="../table_of_contents.html#classes">Classes</a>
33
- <a href="../table_of_contents.html#methods">Methods</a>
34
- </div>
35
- </div>
36
-
37
- <div id="search-section" role="search" class="project-section initially-hidden">
38
- <form action="#" method="get" accept-charset="utf-8">
39
- <div id="search-field-wrapper">
40
- <input id="search-field" role="combobox" aria-label="Search"
41
- aria-autocomplete="list" aria-controls="search-results"
42
- type="text" name="search" placeholder="Search" spellcheck="false"
43
- title="Type to search, Up and Down to navigate, Enter to load">
44
- </div>
45
-
46
- <ul id="search-results" aria-label="Search Results"
47
- aria-busy="false" aria-expanded="false"
48
- aria-atomic="false" class="initially-hidden"></ul>
49
- </form>
50
- </div>
51
-
52
- </div>
53
-
54
-
55
-
56
- <div id="class-metadata">
57
-
58
- <div id="parent-class-section" class="nav-section">
59
- <h3>Parent</h3>
60
-
61
-
62
- <p class="link">Object
63
-
64
- </div>
65
-
66
- <div id="includes-section" class="nav-section">
67
- <h3>Included Modules</h3>
68
-
69
- <ul class="link-list">
70
-
71
-
72
- <li><a class="include" href="Profile/LegacyMethodElimination.html">RubyProf::Profile::LegacyMethodElimination</a>
73
-
74
-
75
- </ul>
76
- </div>
77
-
78
-
79
- <!-- Method Quickref -->
80
- <div id="method-list-section" class="nav-section">
81
- <h3>Methods</h3>
82
-
83
- <ul class="link-list" role="directory">
84
-
85
- <li ><a href="#method-c-new">::new</a>
86
-
87
- <li ><a href="#method-c-profile">::profile</a>
88
-
89
- <li ><a href="#method-i-exclude_common_methods-21">#exclude_common_methods!</a>
90
-
91
- <li ><a href="#method-i-exclude_method-21">#exclude_method!</a>
92
-
93
- <li ><a href="#method-i-exclude_methods-21">#exclude_methods!</a>
94
-
95
- <li ><a href="#method-i-exclude_singleton_methods-21">#exclude_singleton_methods!</a>
96
-
97
- <li ><a href="#method-i-pause">#pause</a>
98
-
99
- <li ><a href="#method-i-paused-3F">#paused?</a>
100
-
101
- <li ><a href="#method-i-profile">#profile</a>
102
-
103
- <li ><a href="#method-i-resume">#resume</a>
104
-
105
- <li ><a href="#method-i-running-3F">#running?</a>
106
-
107
- <li ><a href="#method-i-start">#start</a>
108
-
109
- <li ><a href="#method-i-stop">#stop</a>
110
-
111
- <li ><a href="#method-i-threads">#threads</a>
112
-
113
- </ul>
114
- </div>
115
-
116
- </div>
117
- </nav>
118
-
119
- <main role="main" aria-labelledby="class-RubyProf::Profile">
120
- <h1 id="class-RubyProf::Profile" class="class">
121
- class RubyProf::Profile
122
- </h1>
123
-
124
- <section class="description">
125
-
126
- </section>
127
-
128
-
129
-
130
-
131
- <section id="5Buntitled-5D" class="documentation-section">
132
-
133
-
134
-
135
-
136
-
137
-
138
-
139
-
140
-
141
- <section id="public-class-5Buntitled-5D-method-details" class="method-section">
142
- <header>
143
- <h3>Public Class Methods</h3>
144
- </header>
145
-
146
-
147
- <div id="method-c-new" class="method-detail ">
148
-
149
-
150
- <div class="method-heading">
151
- <span class="method-callseq">
152
- new()
153
- </span>
154
-
155
- <span class="method-click-advice">click to toggle source</span>
156
-
157
- </div>
158
-
159
- <div class="method-heading">
160
- <span class="method-callseq">
161
- new(options)
162
- </span>
163
-
164
- </div>
165
-
166
-
167
-
168
- <div class="method-description">
169
-
170
- <p>Returns a new profiler. Possible options for the options hash are:</p>
171
- <dl class="rdoc-list note-list"><dt>measure_mode
172
- <dd>
173
- <p>Measure mode. Specifies the profile measure mode. If not specified,
174
- defaults to RubyProf::WALL_TIME.</p>
175
- </dd><dt>exclude_threads
176
- <dd>
177
- <p>Threads to exclude from the profiling results.</p>
178
- </dd><dt>include_threads
179
- <dd>
180
- <p>Focus profiling on only the given threads. This will ignore all other
181
- threads.</p>
182
- </dd><dt>merge_fibers
183
- <dd>
184
- <p>Whether to merge all fibers under a given thread. This should be used when
185
- profiling for a callgrind printer.</p>
186
- </dd></dl>
187
-
188
-
189
-
190
-
191
- <div class="method-source-code" id="new-source">
192
- <pre>static VALUE
193
- prof_initialize(int argc, VALUE *argv, VALUE self)
194
- {
195
- prof_profile_t* profile = prof_get_profile(self);
196
- VALUE mode_or_options;
197
- VALUE mode = Qnil;
198
- VALUE exclude_threads = Qnil;
199
- VALUE include_threads = Qnil;
200
- VALUE merge_fibers = Qnil;
201
- VALUE exclude_common = Qnil;
202
- int i;
203
-
204
- switch (rb_scan_args(argc, argv, &quot;02&quot;, &amp;mode_or_options, &amp;exclude_threads)) {
205
- case 0:
206
- break;
207
- case 1:
208
- if (FIXNUM_P(mode_or_options)) {
209
- mode = mode_or_options;
210
- }
211
- else {
212
- Check_Type(mode_or_options, T_HASH);
213
- mode = rb_hash_aref(mode_or_options, ID2SYM(rb_intern(&quot;measure_mode&quot;)));
214
- merge_fibers = rb_hash_aref(mode_or_options, ID2SYM(rb_intern(&quot;merge_fibers&quot;)));
215
- exclude_common = rb_hash_aref(mode_or_options, ID2SYM(rb_intern(&quot;exclude_common&quot;)));
216
- exclude_threads = rb_hash_aref(mode_or_options, ID2SYM(rb_intern(&quot;exclude_threads&quot;)));
217
- include_threads = rb_hash_aref(mode_or_options, ID2SYM(rb_intern(&quot;include_threads&quot;)));
218
- }
219
- break;
220
- case 2:
221
- Check_Type(exclude_threads, T_ARRAY);
222
- break;
223
- }
224
-
225
- if (mode == Qnil) {
226
- mode = INT2NUM(MEASURE_WALL_TIME);
227
- } else {
228
- Check_Type(mode, T_FIXNUM);
229
- }
230
- profile-&gt;measurer = prof_get_measurer(NUM2INT(mode));
231
- profile-&gt;merge_fibers = merge_fibers != Qnil &amp;&amp; merge_fibers != Qfalse;
232
-
233
- if (exclude_threads != Qnil) {
234
- Check_Type(exclude_threads, T_ARRAY);
235
- assert(profile-&gt;exclude_threads_tbl == NULL);
236
- profile-&gt;exclude_threads_tbl = threads_table_create();
237
- for (i = 0; i &lt; RARRAY_LEN(exclude_threads); i++) {
238
- VALUE thread = rb_ary_entry(exclude_threads, i);
239
- VALUE thread_id = rb_obj_id(thread);
240
- st_insert(profile-&gt;exclude_threads_tbl, thread_id, Qtrue);
241
- }
242
- }
243
-
244
- if (include_threads != Qnil) {
245
- Check_Type(include_threads, T_ARRAY);
246
- assert(profile-&gt;include_threads_tbl == NULL);
247
- profile-&gt;include_threads_tbl = threads_table_create();
248
- for (i = 0; i &lt; RARRAY_LEN(include_threads); i++) {
249
- VALUE thread = rb_ary_entry(include_threads, i);
250
- VALUE thread_id = rb_obj_id(thread);
251
- st_insert(profile-&gt;include_threads_tbl, thread_id, Qtrue);
252
- }
253
- }
254
-
255
- if (RTEST(exclude_common)) {
256
- prof_exclude_common_methods(self);
257
- }
258
-
259
- return self;
260
- }</pre>
261
- </div>
262
-
263
- </div>
264
-
265
-
266
-
267
-
268
- </div>
269
-
270
-
271
- <div id="method-c-profile" class="method-detail ">
272
-
273
-
274
- <div class="method-heading">
275
- <span class="method-callseq">
276
- profile(&amp;block) &rarr; self
277
- </span>
278
-
279
- <span class="method-click-advice">click to toggle source</span>
280
-
281
- </div>
282
-
283
- <div class="method-heading">
284
- <span class="method-callseq">
285
- profile(options, &amp;block) &rarr; self
286
- </span>
287
-
288
- </div>
289
-
290
-
291
-
292
- <div class="method-description">
293
-
294
- <p>Profiles the specified block and returns a <a
295
- href="Profile.html">RubyProf::Profile</a> object. Arguments are passed to
296
- <a href="Profile.html">Profile</a> initialize method.</p>
297
-
298
-
299
-
300
-
301
- <div class="method-source-code" id="profile-source">
302
- <pre>static VALUE
303
- prof_profile_class(int argc, VALUE *argv, VALUE klass)
304
- {
305
- int result;
306
- VALUE profile = rb_class_new_instance(argc, argv, cProfile);
307
-
308
- if (!rb_block_given_p())
309
- {
310
- rb_raise(rb_eArgError, &quot;A block must be provided to the profile method.&quot;);
311
- }
312
-
313
- prof_start(profile);
314
- rb_protect(rb_yield, profile, &amp;result);
315
- return prof_stop(profile);
316
- }</pre>
317
- </div>
318
-
319
- </div>
320
-
321
-
322
-
323
-
324
- </div>
325
-
326
-
327
- </section>
328
-
329
- <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
330
- <header>
331
- <h3>Public Instance Methods</h3>
332
- </header>
333
-
334
-
335
- <div id="method-i-exclude_common_methods-21" class="method-detail ">
336
-
337
- <div class="method-heading">
338
- <span class="method-name">exclude_common_methods!</span><span
339
- class="method-args">()</span>
340
-
341
- <span class="method-click-advice">click to toggle source</span>
342
-
343
- </div>
344
-
345
-
346
- <div class="method-description">
347
-
348
- <p>Hides methods that, when represented as a call graph, have extremely large
349
- in and out degrees and make navigation impossible.</p>
350
-
351
-
352
-
353
-
354
- <div class="method-source-code" id="exclude_common_methods-21-source">
355
- <pre><span class="ruby-comment"># File lib/ruby-prof/profile.rb, line 11</span>
356
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">exclude_common_methods!</span>
357
- <span class="ruby-constant">ExcludeCommonMethods</span>.<span class="ruby-identifier">apply!</span>(<span class="ruby-keyword">self</span>)
358
- <span class="ruby-keyword">end</span></pre>
359
- </div>
360
-
361
- </div>
362
-
363
-
364
-
365
-
366
- </div>
367
-
368
-
369
- <div id="method-i-exclude_method-21" class="method-detail ">
370
-
371
- <div class="method-heading">
372
- <span class="method-name">exclude_method!</span><span
373
- class="method-args">(p1, p2)</span>
374
-
375
- <span class="method-click-advice">click to toggle source</span>
376
-
377
- </div>
378
-
379
-
380
- <div class="method-description">
381
-
382
-
383
-
384
-
385
-
386
-
387
- <div class="method-source-code" id="exclude_method-21-source">
388
- <pre>static VALUE
389
- prof_exclude_method(VALUE self, VALUE klass, VALUE sym)
390
- {
391
- prof_profile_t* profile = prof_get_profile(self);
392
- ID mid = SYM2ID(sym);
393
-
394
- prof_method_key_t key;
395
- prof_method_t *method;
396
-
397
- if (profile-&gt;running == Qtrue)
398
- {
399
- rb_raise(rb_eRuntimeError, &quot;RubyProf.start was already called&quot;);
400
- }
401
-
402
- method_key(&amp;key, klass, mid);
403
- method = method_table_lookup(profile-&gt;exclude_methods_tbl, &amp;key);
404
-
405
- if (!method) {
406
- method = prof_method_create_excluded(klass, mid);
407
- method_table_insert(profile-&gt;exclude_methods_tbl, method-&gt;key, method);
408
- }
409
-
410
- return self;
411
- }</pre>
412
- </div>
413
-
414
- </div>
415
-
416
-
417
-
418
-
419
- </div>
420
-
421
-
422
- <div id="method-i-exclude_methods-21" class="method-detail ">
423
-
424
- <div class="method-heading">
425
- <span class="method-name">exclude_methods!</span><span
426
- class="method-args">(mod, *method_or_methods)</span>
427
-
428
- <span class="method-click-advice">click to toggle source</span>
429
-
430
- </div>
431
-
432
-
433
- <div class="method-description">
434
-
435
-
436
-
437
-
438
-
439
-
440
- <div class="method-source-code" id="exclude_methods-21-source">
441
- <pre><span class="ruby-comment"># File lib/ruby-prof/profile.rb, line 15</span>
442
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">exclude_methods!</span>(<span class="ruby-identifier">mod</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">method_or_methods</span>)
443
- [<span class="ruby-identifier">method_or_methods</span>].<span class="ruby-identifier">flatten</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">name</span><span class="ruby-operator">|</span>
444
- <span class="ruby-identifier">exclude_method!</span>(<span class="ruby-identifier">mod</span>, <span class="ruby-identifier">name</span>)
445
- <span class="ruby-keyword">end</span>
446
- <span class="ruby-keyword">end</span></pre>
447
- </div>
448
-
449
- </div>
450
-
451
-
452
-
453
-
454
- </div>
455
-
456
-
457
- <div id="method-i-exclude_singleton_methods-21" class="method-detail ">
458
-
459
- <div class="method-heading">
460
- <span class="method-name">exclude_singleton_methods!</span><span
461
- class="method-args">(mod, *method_or_methods)</span>
462
-
463
- <span class="method-click-advice">click to toggle source</span>
464
-
465
- </div>
466
-
467
-
468
- <div class="method-description">
469
-
470
-
471
-
472
-
473
-
474
-
475
- <div class="method-source-code" id="exclude_singleton_methods-21-source">
476
- <pre><span class="ruby-comment"># File lib/ruby-prof/profile.rb, line 21</span>
477
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">exclude_singleton_methods!</span>(<span class="ruby-identifier">mod</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">method_or_methods</span>)
478
- <span class="ruby-identifier">exclude_methods!</span>(<span class="ruby-identifier">mod</span>.<span class="ruby-identifier">singleton_class</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">method_or_methods</span>)
479
- <span class="ruby-keyword">end</span></pre>
480
- </div>
481
-
482
- </div>
483
-
484
-
485
-
486
-
487
- </div>
488
-
489
-
490
- <div id="method-i-pause" class="method-detail ">
491
-
492
-
493
- <div class="method-heading">
494
- <span class="method-callseq">
495
- pause &rarr; self
496
- </span>
497
-
498
- <span class="method-click-advice">click to toggle source</span>
499
-
500
- </div>
501
-
502
-
503
-
504
- <div class="method-description">
505
-
506
- <p>Pauses collecting profile data.</p>
507
-
508
-
509
-
510
-
511
- <div class="method-source-code" id="pause-source">
512
- <pre>static VALUE
513
- prof_pause(VALUE self)
514
- {
515
- prof_profile_t* profile = prof_get_profile(self);
516
- if (profile-&gt;running == Qfalse)
517
- {
518
- rb_raise(rb_eRuntimeError, &quot;RubyProf is not running.&quot;);
519
- }
520
-
521
- if (profile-&gt;paused == Qfalse)
522
- {
523
- profile-&gt;paused = Qtrue;
524
- profile-&gt;measurement_at_pause_resume = profile-&gt;measurer-&gt;measure();
525
- st_foreach(profile-&gt;threads_tbl, pause_thread, (st_data_t) profile);
526
- }
527
-
528
- return self;
529
- }</pre>
530
- </div>
531
-
532
- </div>
533
-
534
-
535
-
536
-
537
- </div>
538
-
539
-
540
- <div id="method-i-paused-3F" class="method-detail ">
541
-
542
-
543
- <div class="method-heading">
544
- <span class="method-callseq">
545
- paused? &rarr; boolean
546
- </span>
547
-
548
- <span class="method-click-advice">click to toggle source</span>
549
-
550
- </div>
551
-
552
-
553
-
554
- <div class="method-description">
555
-
556
- <p>Returns whether a profile is currently paused.</p>
557
-
558
-
559
-
560
-
561
- <div class="method-source-code" id="paused-3F-source">
562
- <pre>static VALUE
563
- prof_paused(VALUE self)
564
- {
565
- prof_profile_t* profile = prof_get_profile(self);
566
- return profile-&gt;paused;
567
- }</pre>
568
- </div>
569
-
570
- </div>
571
-
572
-
573
-
574
-
575
- </div>
576
-
577
-
578
- <div id="method-i-profile" class="method-detail ">
579
-
580
-
581
- <div class="method-heading">
582
- <span class="method-callseq">
583
- profile {block} &rarr; RubyProf::Result
584
- </span>
585
-
586
- <span class="method-click-advice">click to toggle source</span>
587
-
588
- </div>
589
-
590
-
591
-
592
- <div class="method-description">
593
-
594
- <p>Profiles the specified block and returns a RubyProf::Result object.</p>
595
-
596
-
597
-
598
-
599
- <div class="method-source-code" id="profile-source">
600
- <pre>static VALUE
601
- prof_profile_object(VALUE self)
602
- {
603
- int result;
604
- if (!rb_block_given_p())
605
- {
606
- rb_raise(rb_eArgError, &quot;A block must be provided to the profile method.&quot;);
607
- }
608
-
609
- prof_start(self);
610
- rb_protect(rb_yield, self, &amp;result);
611
- return prof_stop(self);
612
-
613
- }</pre>
614
- </div>
615
-
616
- </div>
617
-
618
-
619
-
620
-
621
- </div>
622
-
623
-
624
- <div id="method-i-resume" class="method-detail ">
625
-
626
-
627
- <div class="method-heading">
628
- <span class="method-callseq">
629
- resume &rarr; self
630
- </span>
631
-
632
- <span class="method-click-advice">click to toggle source</span>
633
-
634
- </div>
635
-
636
- <div class="method-heading">
637
- <span class="method-callseq">
638
- resume(&amp;block) &rarr; self
639
- </span>
640
-
641
- </div>
642
-
643
-
644
-
645
- <div class="method-description">
646
-
647
- <p>Resumes recording profile data.</p>
648
-
649
-
650
-
651
-
652
- <div class="method-source-code" id="resume-source">
653
- <pre>static VALUE
654
- prof_resume(VALUE self)
655
- {
656
- prof_profile_t* profile = prof_get_profile(self);
657
- if (profile-&gt;running == Qfalse)
658
- {
659
- rb_raise(rb_eRuntimeError, &quot;RubyProf is not running.&quot;);
660
- }
661
-
662
- if (profile-&gt;paused == Qtrue)
663
- {
664
- profile-&gt;paused = Qfalse;
665
- profile-&gt;measurement_at_pause_resume = profile-&gt;measurer-&gt;measure();
666
- st_foreach(profile-&gt;threads_tbl, unpause_thread, (st_data_t) profile);
667
- }
668
-
669
- return rb_block_given_p() ? rb_ensure(rb_yield, self, prof_pause, self) : self;
670
- }</pre>
671
- </div>
672
-
673
- </div>
674
-
675
-
676
-
677
-
678
- </div>
679
-
680
-
681
- <div id="method-i-running-3F" class="method-detail ">
682
-
683
-
684
- <div class="method-heading">
685
- <span class="method-callseq">
686
- running? &rarr; boolean
687
- </span>
688
-
689
- <span class="method-click-advice">click to toggle source</span>
690
-
691
- </div>
692
-
693
-
694
-
695
- <div class="method-description">
696
-
697
- <p>Returns whether a profile is currently running.</p>
698
-
699
-
700
-
701
-
702
- <div class="method-source-code" id="running-3F-source">
703
- <pre>static VALUE
704
- prof_running(VALUE self)
705
- {
706
- prof_profile_t* profile = prof_get_profile(self);
707
- return profile-&gt;running;
708
- }</pre>
709
- </div>
710
-
711
- </div>
712
-
713
-
714
-
715
-
716
- </div>
717
-
718
-
719
- <div id="method-i-start" class="method-detail ">
720
-
721
-
722
- <div class="method-heading">
723
- <span class="method-callseq">
724
- start &rarr; self
725
- </span>
726
-
727
- <span class="method-click-advice">click to toggle source</span>
728
-
729
- </div>
730
-
731
-
732
-
733
- <div class="method-description">
734
-
735
- <p>Starts recording profile data.</p>
736
-
737
-
738
-
739
-
740
- <div class="method-source-code" id="start-source">
741
- <pre>static VALUE
742
- prof_start(VALUE self)
743
- {
744
- char* trace_file_name;
745
-
746
- prof_profile_t* profile = prof_get_profile(self);
747
-
748
- if (profile-&gt;running == Qtrue)
749
- {
750
- rb_raise(rb_eRuntimeError, &quot;RubyProf.start was already called&quot;);
751
- }
752
-
753
- profile-&gt;running = Qtrue;
754
- profile-&gt;paused = Qfalse;
755
- profile-&gt;last_thread_data = NULL;
756
-
757
-
758
- /* open trace file if environment wants it */
759
- trace_file_name = getenv(&quot;RUBY_PROF_TRACE&quot;);
760
- if (trace_file_name != NULL)
761
- {
762
- if (strcmp(trace_file_name, &quot;stdout&quot;) == 0)
763
- {
764
- trace_file = stdout;
765
- }
766
- else if (strcmp(trace_file_name, &quot;stderr&quot;) == 0)
767
- {
768
- trace_file = stderr;
769
- }
770
- else
771
- {
772
- trace_file = fopen(trace_file_name, &quot;w&quot;);
773
- }
774
- }
775
-
776
- prof_install_hook(self);
777
- return self;
778
- }</pre>
779
- </div>
780
-
781
- </div>
782
-
783
-
784
-
785
-
786
- </div>
787
-
788
-
789
- <div id="method-i-stop" class="method-detail ">
790
-
791
-
792
- <div class="method-heading">
793
- <span class="method-callseq">
794
- stop &rarr; self
795
- </span>
796
-
797
- <span class="method-click-advice">click to toggle source</span>
798
-
799
- </div>
800
-
801
-
802
-
803
- <div class="method-description">
804
-
805
- <p>Stops collecting profile data.</p>
806
-
807
-
808
-
809
-
810
- <div class="method-source-code" id="stop-source">
811
- <pre>static VALUE
812
- prof_stop(VALUE self)
813
- {
814
- prof_profile_t* profile = prof_get_profile(self);
815
-
816
- if (profile-&gt;running == Qfalse)
817
- {
818
- rb_raise(rb_eRuntimeError, &quot;RubyProf.start was not yet called&quot;);
819
- }
820
-
821
- prof_remove_hook(self);
822
-
823
- /* close trace file if open */
824
- if (trace_file != NULL)
825
- {
826
- if (trace_file !=stderr &amp;&amp; trace_file != stdout)
827
- {
828
- #ifdef _MSC_VER
829
- _fcloseall();
830
- #else
831
- fclose(trace_file);
832
- #endif
833
- }
834
- trace_file = NULL;
835
- }
836
-
837
- prof_pop_threads(profile);
838
-
839
- /* Unset the last_thread_data (very important!)
840
- and the threads table */
841
- profile-&gt;running = profile-&gt;paused = Qfalse;
842
- profile-&gt;last_thread_data = NULL;
843
-
844
- return self;
845
- }</pre>
846
- </div>
847
-
848
- </div>
849
-
850
-
851
-
852
-
853
- </div>
854
-
855
-
856
- <div id="method-i-threads" class="method-detail ">
857
-
858
-
859
- <div class="method-heading">
860
- <span class="method-callseq">
861
- threads &rarr; Array of RubyProf::Thread
862
- </span>
863
-
864
- <span class="method-click-advice">click to toggle source</span>
865
-
866
- </div>
867
-
868
-
869
-
870
- <div class="method-description">
871
-
872
- <p>Returns an array of <a href="Thread.html">RubyProf::Thread</a> instances
873
- that were executed while the the program was being run.</p>
874
-
875
-
876
-
877
-
878
- <div class="method-source-code" id="threads-source">
879
- <pre>static VALUE
880
- prof_threads(VALUE self)
881
- {
882
- VALUE result = rb_ary_new();
883
- prof_profile_t* profile = prof_get_profile(self);
884
- st_foreach(profile-&gt;threads_tbl, collect_threads, result);
885
- return result;
886
- }</pre>
887
- </div>
888
-
889
- </div>
890
-
891
-
892
-
893
-
894
- </div>
895
-
896
-
897
- </section>
898
-
899
- </section>
900
- </main>
901
-
902
-
903
- <footer id="validator-badges" role="contentinfo">
904
- <p><a href="http://validator.w3.org/check/referer">Validate</a>
905
- <p>Generated by <a href="https://rdoc.github.io/rdoc">RDoc</a> 5.1.0.
906
- <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
907
- </footer>
908
-