ruby-prof 0.12.1 → 0.12.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. data/CHANGES +5 -1
  2. data/Rakefile +25 -7
  3. data/bin/ruby-prof +2 -2
  4. data/doc/LICENSE.html +155 -0
  5. data/doc/README_rdoc.html +640 -0
  6. data/doc/Rack.html +167 -0
  7. data/doc/Rack/RubyProf.html +319 -0
  8. data/doc/RubyProf.html +999 -0
  9. data/doc/RubyProf/AbstractPrinter.html +580 -0
  10. data/doc/RubyProf/AggregateCallInfo.html +570 -0
  11. data/doc/RubyProf/CallInfo.html +512 -0
  12. data/doc/RubyProf/CallInfoPrinter.html +190 -0
  13. data/doc/RubyProf/CallInfoVisitor.html +332 -0
  14. data/doc/RubyProf/CallStackPrinter.html +1597 -0
  15. data/doc/RubyProf/CallTreePrinter.html +413 -0
  16. data/doc/RubyProf/Cmd.html +669 -0
  17. data/doc/RubyProf/DotPrinter.html +312 -0
  18. data/doc/RubyProf/FlatPrinter.html +229 -0
  19. data/doc/RubyProf/FlatPrinterWithLineNumbers.html +267 -0
  20. data/doc/RubyProf/GraphHtmlPrinter.html +622 -0
  21. data/doc/RubyProf/GraphPrinter.html +209 -0
  22. data/doc/RubyProf/MethodInfo.html +713 -0
  23. data/doc/RubyProf/MultiPrinter.html +407 -0
  24. data/doc/RubyProf/Profile.html +821 -0
  25. data/doc/RubyProf/ProfileTask.html +532 -0
  26. data/doc/RubyProf/Test.html +578 -0
  27. data/doc/RubyProf/Thread.html +262 -0
  28. data/doc/created.rid +31 -0
  29. data/doc/examples/flat_txt.html +191 -0
  30. data/doc/examples/graph_txt.html +305 -0
  31. data/doc/images/add.png +0 -0
  32. data/doc/images/brick.png +0 -0
  33. data/doc/images/brick_link.png +0 -0
  34. data/doc/images/bug.png +0 -0
  35. data/doc/images/bullet_black.png +0 -0
  36. data/doc/images/bullet_toggle_minus.png +0 -0
  37. data/doc/images/bullet_toggle_plus.png +0 -0
  38. data/doc/images/date.png +0 -0
  39. data/doc/images/delete.png +0 -0
  40. data/doc/images/find.png +0 -0
  41. data/doc/images/loadingAnimation.gif +0 -0
  42. data/doc/images/macFFBgHack.png +0 -0
  43. data/doc/images/package.png +0 -0
  44. data/doc/images/page_green.png +0 -0
  45. data/doc/images/page_white_text.png +0 -0
  46. data/doc/images/page_white_width.png +0 -0
  47. data/doc/images/plugin.png +0 -0
  48. data/doc/images/ruby.png +0 -0
  49. data/doc/images/tag_blue.png +0 -0
  50. data/doc/images/tag_green.png +0 -0
  51. data/doc/images/transparent.png +0 -0
  52. data/doc/images/wrench.png +0 -0
  53. data/doc/images/wrench_orange.png +0 -0
  54. data/doc/images/zoom.png +0 -0
  55. data/doc/index.html +639 -0
  56. data/doc/js/darkfish.js +153 -0
  57. data/doc/js/jquery.js +18 -0
  58. data/doc/js/navigation.js +142 -0
  59. data/doc/js/search.js +94 -0
  60. data/doc/js/search_index.js +1 -0
  61. data/doc/js/searcher.js +228 -0
  62. data/doc/rdoc.css +543 -0
  63. data/doc/table_of_contents.html +462 -0
  64. data/examples/empty.png +0 -0
  65. data/examples/minus.png +0 -0
  66. data/examples/plus.png +0 -0
  67. data/ext/ruby_prof/extconf.rb +5 -1
  68. data/ext/ruby_prof/rp_call_info.c +1 -1
  69. data/ext/ruby_prof/rp_measure_gc_time.c +6 -10
  70. data/ext/ruby_prof/rp_measure_memory.c +0 -1
  71. data/ext/ruby_prof/rp_stack.c +0 -5
  72. data/ext/ruby_prof/vc/ruby_prof_18.vcxproj +0 -2
  73. data/ext/ruby_prof/vc/ruby_prof_19.vcxproj +1 -3
  74. data/ext/ruby_prof/vc/ruby_prof_20.vcxproj +1 -3
  75. data/ext/ruby_prof/version.h +2 -2
  76. data/lib/ruby-prof/compatibility.rb +8 -3
  77. data/lib/ruby-prof/images/empty.png +0 -0
  78. data/lib/ruby-prof/images/minus.png +0 -0
  79. data/lib/ruby-prof/images/plus.png +0 -0
  80. data/lib/ruby-prof/task.rb +0 -0
  81. data/ruby-prof.gemspec +2 -1
  82. data/test/aggregate_test.rb +0 -0
  83. data/test/basic_test.rb +0 -0
  84. data/test/duplicate_names_test.rb +0 -0
  85. data/test/dynamic_method_test.rb +8 -1
  86. data/test/enumerable_test.rb +0 -0
  87. data/test/exceptions_test.rb +0 -0
  88. data/test/exclude_threads_test.rb +0 -0
  89. data/test/exec_test.rb +0 -0
  90. data/test/line_number_test.rb +0 -0
  91. data/test/measure_gc_runs_test.rb +4 -1
  92. data/test/measure_gc_time_test.rb +10 -3
  93. data/test/measure_memory_test.rb +3 -8
  94. data/test/measure_process_time_test.rb +10 -4
  95. data/test/method_elimination_test.rb +1 -2
  96. data/test/module_test.rb +0 -0
  97. data/test/multi_printer_test.rb +5 -6
  98. data/test/no_method_class_test.rb +0 -0
  99. data/test/pause_resume_test.rb +6 -8
  100. data/test/printers_test.rb +0 -0
  101. data/test/recursive_test.rb +0 -0
  102. data/test/singleton_test.rb +0 -0
  103. data/test/stack_printer_test.rb +8 -5
  104. data/test/stack_test.rb +0 -0
  105. data/test/start_stop_test.rb +0 -0
  106. data/test/test_helper.rb +16 -4
  107. data/test/thread_test.rb +0 -0
  108. data/test/unique_call_path_test.rb +0 -0
  109. metadata +90 -17
@@ -0,0 +1,578 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
6
+
7
+ <title>module RubyProf::Test - ruby-prof</title>
8
+
9
+ <link type="text/css" media="screen" href="../rdoc.css" rel="stylesheet">
10
+
11
+ <script type="text/javascript">
12
+ var rdoc_rel_prefix = "../";
13
+ </script>
14
+
15
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
16
+ <script type="text/javascript" charset="utf-8" src="../js/navigation.js"></script>
17
+ <script type="text/javascript" charset="utf-8" src="../js/search_index.js"></script>
18
+ <script type="text/javascript" charset="utf-8" src="../js/search.js"></script>
19
+ <script type="text/javascript" charset="utf-8" src="../js/searcher.js"></script>
20
+ <script type="text/javascript" charset="utf-8" src="../js/darkfish.js"></script>
21
+
22
+
23
+ <body id="top" class="module">
24
+ <nav id="metadata">
25
+ <nav id="home-section" class="section">
26
+ <h3 class="section-header">
27
+ <a href="../index.html">Home</a>
28
+ <a href="../table_of_contents.html#classes">Classes</a>
29
+ <a href="../table_of_contents.html#methods">Methods</a>
30
+ </h3>
31
+ </nav>
32
+
33
+
34
+ <nav id="search-section" class="section project-section" class="initially-hidden">
35
+ <form action="#" method="get" accept-charset="utf-8">
36
+ <h3 class="section-header">
37
+ <input type="text" name="search" placeholder="Search" id="search-field"
38
+ title="Type to search, Up and Down to navigate, Enter to load">
39
+ </h3>
40
+ </form>
41
+
42
+ <ul id="search-results" class="initially-hidden"></ul>
43
+ </nav>
44
+
45
+
46
+ <div id="file-metadata">
47
+ <nav id="file-list-section" class="section">
48
+ <h3 class="section-header">Defined In</h3>
49
+ <ul>
50
+ <li>lib/ruby-prof/test.rb
51
+ </ul>
52
+ </nav>
53
+
54
+
55
+ </div>
56
+
57
+ <div id="class-metadata">
58
+
59
+
60
+
61
+ <!-- Method Quickref -->
62
+ <nav id="method-list-section" class="section">
63
+ <h3 class="section-header">Methods</h3>
64
+
65
+ <ul class="link-list">
66
+
67
+ <li><a href="#method-i-format_profile_total">#format_profile_total</a>
68
+
69
+ <li><a href="#method-i-measure_mode_name">#measure_mode_name</a>
70
+
71
+ <li><a href="#method-i-output_dir">#output_dir</a>
72
+
73
+ <li><a href="#method-i-report_filename">#report_filename</a>
74
+
75
+ <li><a href="#method-i-report_profile">#report_profile</a>
76
+
77
+ <li><a href="#method-i-run">#run</a>
78
+
79
+ <li><a href="#method-i-run_profile">#run_profile</a>
80
+
81
+ <li><a href="#method-i-run_test">#run_test</a>
82
+
83
+ <li><a href="#method-i-run_warmup">#run_warmup</a>
84
+
85
+ </ul>
86
+ </nav>
87
+
88
+ </div>
89
+
90
+ <div id="project-metadata">
91
+ <nav id="fileindex-section" class="section project-section">
92
+ <h3 class="section-header">Pages</h3>
93
+
94
+ <ul>
95
+
96
+ <li class="file"><a href="../LICENSE.html">LICENSE</a>
97
+
98
+ <li class="file"><a href="../README_rdoc.html">README</a>
99
+
100
+ <li class="file"><a href="../examples/flat_txt.html">flat</a>
101
+
102
+ <li class="file"><a href="../examples/graph_txt.html">graph</a>
103
+
104
+ </ul>
105
+ </nav>
106
+
107
+ <nav id="classindex-section" class="section project-section">
108
+ <h3 class="section-header">Class and Module Index</h3>
109
+
110
+ <ul class="link-list">
111
+
112
+ <li><a href="../RubyProf.html">RubyProf</a>
113
+
114
+ <li><a href="../RubyProf/AbstractPrinter.html">RubyProf::AbstractPrinter</a>
115
+
116
+ <li><a href="../RubyProf/AggregateCallInfo.html">RubyProf::AggregateCallInfo</a>
117
+
118
+ <li><a href="../RubyProf/CallInfo.html">RubyProf::CallInfo</a>
119
+
120
+ <li><a href="../RubyProf/CallInfoPrinter.html">RubyProf::CallInfoPrinter</a>
121
+
122
+ <li><a href="../RubyProf/CallInfoVisitor.html">RubyProf::CallInfoVisitor</a>
123
+
124
+ <li><a href="../RubyProf/CallStackPrinter.html">RubyProf::CallStackPrinter</a>
125
+
126
+ <li><a href="../RubyProf/CallTreePrinter.html">RubyProf::CallTreePrinter</a>
127
+
128
+ <li><a href="../RubyProf/Cmd.html">RubyProf::Cmd</a>
129
+
130
+ <li><a href="../RubyProf/DotPrinter.html">RubyProf::DotPrinter</a>
131
+
132
+ <li><a href="../RubyProf/FlatPrinter.html">RubyProf::FlatPrinter</a>
133
+
134
+ <li><a href="../RubyProf/FlatPrinterWithLineNumbers.html">RubyProf::FlatPrinterWithLineNumbers</a>
135
+
136
+ <li><a href="../RubyProf/GraphHtmlPrinter.html">RubyProf::GraphHtmlPrinter</a>
137
+
138
+ <li><a href="../RubyProf/GraphPrinter.html">RubyProf::GraphPrinter</a>
139
+
140
+ <li><a href="../RubyProf/MethodInfo.html">RubyProf::MethodInfo</a>
141
+
142
+ <li><a href="../RubyProf/MultiPrinter.html">RubyProf::MultiPrinter</a>
143
+
144
+ <li><a href="../RubyProf/Profile.html">RubyProf::Profile</a>
145
+
146
+ <li><a href="../RubyProf/ProfileTask.html">RubyProf::ProfileTask</a>
147
+
148
+ <li><a href="../RubyProf/Test.html">RubyProf::Test</a>
149
+
150
+ <li><a href="../RubyProf/Thread.html">RubyProf::Thread</a>
151
+
152
+ <li><a href="../Rack.html">Rack</a>
153
+
154
+ <li><a href="../Rack/RubyProf.html">Rack::RubyProf</a>
155
+
156
+ </ul>
157
+ </nav>
158
+
159
+ </div>
160
+ </nav>
161
+
162
+ <div id="documentation">
163
+ <h1 class="module">module RubyProf::Test</h1>
164
+
165
+ <div id="description" class="description">
166
+
167
+ </div><!-- description -->
168
+
169
+
170
+
171
+
172
+ <section id="5Buntitled-5D" class="documentation-section">
173
+
174
+
175
+
176
+
177
+
178
+ <!-- Constants -->
179
+ <section id="constants-list" class="section">
180
+ <h3 class="section-header">Constants</h3>
181
+ <dl>
182
+
183
+ <dt id="PROFILE_OPTIONS">PROFILE_OPTIONS
184
+
185
+ <dd class="description">
186
+
187
+
188
+ </dl>
189
+ </section>
190
+
191
+
192
+
193
+
194
+ <!-- Methods -->
195
+
196
+ <section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
197
+ <h3 class="section-header">Public Instance Methods</h3>
198
+
199
+
200
+ <div id="method-i-format_profile_total" class="method-detail ">
201
+
202
+ <div class="method-heading">
203
+ <span class="method-name">format_profile_total</span><span
204
+ class="method-args">(total, measure_mode)</span>
205
+ <span class="method-click-advice">click to toggle source</span>
206
+ </div>
207
+
208
+
209
+ <div class="method-description">
210
+
211
+
212
+
213
+
214
+
215
+ <div class="method-source-code" id="format_profile_total-source">
216
+ <pre><span class="ruby-comment"># File lib/ruby-prof/test.rb, line 96</span>
217
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">format_profile_total</span>(<span class="ruby-identifier">total</span>, <span class="ruby-identifier">measure_mode</span>)
218
+ <span class="ruby-keyword">case</span> <span class="ruby-identifier">measure_mode</span>
219
+ <span class="ruby-keyword">when</span> <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">PROCESS_TIME</span>, <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">WALL_TIME</span>
220
+ <span class="ruby-string">&quot;%.2f seconds&quot;</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">total</span>
221
+ <span class="ruby-keyword">when</span> <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">MEMORY</span>
222
+ <span class="ruby-string">&quot;%.2f kilobytes&quot;</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">total</span>
223
+ <span class="ruby-keyword">when</span> <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">ALLOCATIONS</span>
224
+ <span class="ruby-string">&quot;%d allocations&quot;</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">total</span>
225
+ <span class="ruby-keyword">else</span>
226
+ <span class="ruby-node">&quot;%.2f #{measure_mode}&quot;</span>
227
+ <span class="ruby-keyword">end</span>
228
+ <span class="ruby-keyword">end</span></pre>
229
+ </div><!-- format_profile_total-source -->
230
+
231
+ </div>
232
+
233
+
234
+
235
+
236
+ </div><!-- format_profile_total-method -->
237
+
238
+
239
+ <div id="method-i-measure_mode_name" class="method-detail ">
240
+
241
+ <div class="method-heading">
242
+ <span class="method-name">measure_mode_name</span><span
243
+ class="method-args">(measure_mode)</span>
244
+ <span class="method-click-advice">click to toggle source</span>
245
+ </div>
246
+
247
+
248
+ <div class="method-description">
249
+
250
+
251
+
252
+
253
+
254
+ <div class="method-source-code" id="measure_mode_name-source">
255
+ <pre><span class="ruby-comment"># File lib/ruby-prof/test.rb, line 139</span>
256
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">measure_mode_name</span>(<span class="ruby-identifier">measure_mode</span>)
257
+ <span class="ruby-keyword">case</span> <span class="ruby-identifier">measure_mode</span>
258
+ <span class="ruby-keyword">when</span> <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">PROCESS_TIME</span>; <span class="ruby-string">'process_time'</span>
259
+ <span class="ruby-keyword">when</span> <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">WALL_TIME</span>; <span class="ruby-string">'wall_time'</span>
260
+ <span class="ruby-keyword">when</span> <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">MEMORY</span>; <span class="ruby-string">'memory'</span>
261
+ <span class="ruby-keyword">when</span> <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">ALLOCATIONS</span>; <span class="ruby-string">'allocations'</span>
262
+ <span class="ruby-keyword">else</span> <span class="ruby-node">&quot;measure#{measure_mode}&quot;</span>
263
+ <span class="ruby-keyword">end</span>
264
+ <span class="ruby-keyword">end</span></pre>
265
+ </div><!-- measure_mode_name-source -->
266
+
267
+ </div>
268
+
269
+
270
+
271
+
272
+ </div><!-- measure_mode_name-method -->
273
+
274
+
275
+ <div id="method-i-output_dir" class="method-detail ">
276
+
277
+ <div class="method-heading">
278
+ <span class="method-name">output_dir</span><span
279
+ class="method-args">()</span>
280
+ <span class="method-click-advice">click to toggle source</span>
281
+ </div>
282
+
283
+
284
+ <div class="method-description">
285
+
286
+
287
+
288
+
289
+
290
+ <div class="method-source-code" id="output_dir-source">
291
+ <pre><span class="ruby-comment"># File lib/ruby-prof/test.rb, line 16</span>
292
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">output_dir</span>
293
+ <span class="ruby-constant">PROFILE_OPTIONS</span>[<span class="ruby-value">:output_dir</span>]
294
+ <span class="ruby-keyword">end</span></pre>
295
+ </div><!-- output_dir-source -->
296
+
297
+ </div>
298
+
299
+
300
+
301
+
302
+ </div><!-- output_dir-method -->
303
+
304
+
305
+ <div id="method-i-report_filename" class="method-detail ">
306
+
307
+ <div class="method-heading">
308
+ <span class="method-name">report_filename</span><span
309
+ class="method-args">(printer, measure_mode)</span>
310
+ <span class="method-click-advice">click to toggle source</span>
311
+ </div>
312
+
313
+
314
+ <div class="method-description">
315
+
316
+ <p>The report filename is test_name + measure_mode + report_type</p>
317
+
318
+
319
+
320
+ <div class="method-source-code" id="report_filename-source">
321
+ <pre><span class="ruby-comment"># File lib/ruby-prof/test.rb, line 126</span>
322
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">report_filename</span>(<span class="ruby-identifier">printer</span>, <span class="ruby-identifier">measure_mode</span>)
323
+ <span class="ruby-identifier">suffix</span> =
324
+ <span class="ruby-keyword">case</span> <span class="ruby-identifier">printer</span>
325
+ <span class="ruby-keyword">when</span> <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">FlatPrinter</span>; <span class="ruby-string">'flat.txt'</span>
326
+ <span class="ruby-keyword">when</span> <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">GraphPrinter</span>; <span class="ruby-string">'graph.txt'</span>
327
+ <span class="ruby-keyword">when</span> <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">GraphHtmlPrinter</span>; <span class="ruby-string">'graph.html'</span>
328
+ <span class="ruby-keyword">when</span> <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">CallTreePrinter</span>; <span class="ruby-string">'tree.txt'</span>
329
+ <span class="ruby-keyword">else</span> <span class="ruby-identifier">printer</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">downcase</span>
330
+ <span class="ruby-keyword">end</span>
331
+
332
+ <span class="ruby-node">&quot;#{output_dir}/#{method_name}_#{measure_mode_name(measure_mode)}_#{suffix}&quot;</span>
333
+ <span class="ruby-keyword">end</span></pre>
334
+ </div><!-- report_filename-source -->
335
+
336
+ </div>
337
+
338
+
339
+
340
+
341
+ </div><!-- report_filename-method -->
342
+
343
+
344
+ <div id="method-i-report_profile" class="method-detail ">
345
+
346
+ <div class="method-heading">
347
+ <span class="method-name">report_profile</span><span
348
+ class="method-args">(data, measure_mode)</span>
349
+ <span class="method-click-advice">click to toggle source</span>
350
+ </div>
351
+
352
+
353
+ <div class="method-description">
354
+
355
+
356
+
357
+
358
+
359
+ <div class="method-source-code" id="report_profile-source">
360
+ <pre><span class="ruby-comment"># File lib/ruby-prof/test.rb, line 109</span>
361
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">report_profile</span>(<span class="ruby-identifier">data</span>, <span class="ruby-identifier">measure_mode</span>)
362
+ <span class="ruby-constant">PROFILE_OPTIONS</span>[<span class="ruby-value">:printers</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">printer_klass</span><span class="ruby-operator">|</span>
363
+ <span class="ruby-identifier">printer</span> = <span class="ruby-identifier">printer_klass</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">data</span>)
364
+
365
+ <span class="ruby-comment"># Makes sure the output directory exits</span>
366
+ <span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">mkdir_p</span>(<span class="ruby-identifier">output_dir</span>)
367
+
368
+ <span class="ruby-comment"># Open the file</span>
369
+ <span class="ruby-identifier">file_name</span> = <span class="ruby-identifier">report_filename</span>(<span class="ruby-identifier">printer</span>, <span class="ruby-identifier">measure_mode</span>)
370
+
371
+ <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">file_name</span>, <span class="ruby-string">'wb'</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">file</span><span class="ruby-operator">|</span>
372
+ <span class="ruby-identifier">printer</span>.<span class="ruby-identifier">print</span>(<span class="ruby-identifier">file</span>, <span class="ruby-constant">PROFILE_OPTIONS</span>)
373
+ <span class="ruby-keyword">end</span>
374
+ <span class="ruby-keyword">end</span>
375
+ <span class="ruby-keyword">end</span></pre>
376
+ </div><!-- report_profile-source -->
377
+
378
+ </div>
379
+
380
+
381
+
382
+
383
+ </div><!-- report_profile-method -->
384
+
385
+
386
+ <div id="method-i-run" class="method-detail ">
387
+
388
+ <div class="method-heading">
389
+ <span class="method-name">run</span><span
390
+ class="method-args">(result) { |STARTED, name| ... }</span>
391
+ <span class="method-click-advice">click to toggle source</span>
392
+ </div>
393
+
394
+
395
+ <div class="method-description">
396
+
397
+
398
+
399
+
400
+
401
+ <div class="method-source-code" id="run-source">
402
+ <pre><span class="ruby-comment"># File lib/ruby-prof/test.rb, line 20</span>
403
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">run</span>(<span class="ruby-identifier">result</span>)
404
+ <span class="ruby-keyword">return</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@method_name</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">==</span> <span class="ruby-string">&quot;default_test&quot;</span>
405
+
406
+ <span class="ruby-keyword">yield</span>(<span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span><span class="ruby-operator">::</span><span class="ruby-constant">STARTED</span>, <span class="ruby-identifier">name</span>)
407
+ <span class="ruby-ivar">@_result</span> = <span class="ruby-identifier">result</span>
408
+ <span class="ruby-identifier">run_warmup</span>
409
+ <span class="ruby-constant">PROFILE_OPTIONS</span>[<span class="ruby-value">:measure_modes</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">measure_mode</span><span class="ruby-operator">|</span>
410
+ <span class="ruby-identifier">data</span> = <span class="ruby-identifier">run_profile</span>(<span class="ruby-identifier">measure_mode</span>)
411
+ <span class="ruby-identifier">report_profile</span>(<span class="ruby-identifier">data</span>, <span class="ruby-identifier">measure_mode</span>)
412
+ <span class="ruby-identifier">result</span>.<span class="ruby-identifier">add_run</span>
413
+ <span class="ruby-keyword">end</span>
414
+ <span class="ruby-keyword">yield</span>(<span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span><span class="ruby-operator">::</span><span class="ruby-constant">FINISHED</span>, <span class="ruby-identifier">name</span>)
415
+ <span class="ruby-keyword">end</span></pre>
416
+ </div><!-- run-source -->
417
+
418
+ </div>
419
+
420
+
421
+
422
+
423
+ </div><!-- run-method -->
424
+
425
+
426
+ <div id="method-i-run_profile" class="method-detail ">
427
+
428
+ <div class="method-heading">
429
+ <span class="method-name">run_profile</span><span
430
+ class="method-args">(measure_mode)</span>
431
+ <span class="method-click-advice">click to toggle source</span>
432
+ </div>
433
+
434
+
435
+ <div class="method-description">
436
+
437
+
438
+
439
+
440
+
441
+ <div class="method-source-code" id="run_profile-source">
442
+ <pre><span class="ruby-comment"># File lib/ruby-prof/test.rb, line 64</span>
443
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">run_profile</span>(<span class="ruby-identifier">measure_mode</span>)
444
+ <span class="ruby-constant">RubyProf</span>.<span class="ruby-identifier">measure_mode</span> = <span class="ruby-identifier">measure_mode</span>
445
+
446
+ <span class="ruby-identifier">print</span> <span class="ruby-string">' '</span>
447
+ <span class="ruby-constant">PROFILE_OPTIONS</span>[<span class="ruby-value">:count</span>].<span class="ruby-identifier">times</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
448
+ <span class="ruby-identifier">run_test</span> <span class="ruby-keyword">do</span>
449
+ <span class="ruby-keyword">begin</span>
450
+ <span class="ruby-identifier">print</span> <span class="ruby-string">'.'</span>
451
+ <span class="ruby-identifier">$stdout</span>.<span class="ruby-identifier">flush</span>
452
+ <span class="ruby-constant">GC</span>.<span class="ruby-identifier">disable</span>
453
+
454
+ <span class="ruby-constant">RubyProf</span>.<span class="ruby-identifier">resume</span> <span class="ruby-keyword">do</span>
455
+ <span class="ruby-identifier">__send__</span>(<span class="ruby-ivar">@method_name</span>)
456
+ <span class="ruby-keyword">end</span>
457
+ <span class="ruby-keyword">ensure</span>
458
+ <span class="ruby-constant">GC</span>.<span class="ruby-identifier">enable</span>
459
+ <span class="ruby-keyword">end</span>
460
+ <span class="ruby-keyword">end</span>
461
+ <span class="ruby-keyword">end</span>
462
+
463
+ <span class="ruby-identifier">data</span> = <span class="ruby-constant">RubyProf</span>.<span class="ruby-identifier">stop</span>
464
+ <span class="ruby-identifier">bench</span> = <span class="ruby-identifier">data</span>.<span class="ruby-identifier">threads</span>.<span class="ruby-identifier">values</span>.<span class="ruby-identifier">inject</span>(<span class="ruby-value">0</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">total</span>, <span class="ruby-identifier">method_infos</span><span class="ruby-operator">|</span>
465
+ <span class="ruby-identifier">top</span> = <span class="ruby-identifier">method_infos</span>.<span class="ruby-identifier">max</span>
466
+ <span class="ruby-identifier">total</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">top</span>.<span class="ruby-identifier">total_time</span>
467
+ <span class="ruby-identifier">total</span>
468
+ <span class="ruby-keyword">end</span>
469
+
470
+ <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;\n #{measure_mode_name(measure_mode)}: #{format_profile_total(bench, measure_mode)}\n&quot;</span>
471
+
472
+ <span class="ruby-identifier">data</span>
473
+ <span class="ruby-keyword">end</span></pre>
474
+ </div><!-- run_profile-source -->
475
+
476
+ </div>
477
+
478
+
479
+
480
+
481
+ </div><!-- run_profile-method -->
482
+
483
+
484
+ <div id="method-i-run_test" class="method-detail ">
485
+
486
+ <div class="method-heading">
487
+ <span class="method-name">run_test</span><span
488
+ class="method-args">() { || ... }</span>
489
+ <span class="method-click-advice">click to toggle source</span>
490
+ </div>
491
+
492
+
493
+ <div class="method-description">
494
+
495
+
496
+
497
+
498
+
499
+ <div class="method-source-code" id="run_test-source">
500
+ <pre><span class="ruby-comment"># File lib/ruby-prof/test.rb, line 34</span>
501
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">run_test</span>
502
+ <span class="ruby-keyword">begin</span>
503
+ <span class="ruby-identifier">setup</span>
504
+ <span class="ruby-keyword">yield</span>
505
+ <span class="ruby-keyword">rescue</span> <span class="ruby-operator">::</span><span class="ruby-constant">Test</span><span class="ruby-operator">::</span><span class="ruby-constant">Unit</span><span class="ruby-operator">::</span><span class="ruby-constant">AssertionFailedError</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
506
+ <span class="ruby-identifier">add_failure</span>(<span class="ruby-identifier">e</span>.<span class="ruby-identifier">message</span>, <span class="ruby-identifier">e</span>.<span class="ruby-identifier">backtrace</span>)
507
+ <span class="ruby-keyword">rescue</span> <span class="ruby-constant">StandardError</span>, <span class="ruby-constant">ScriptError</span>
508
+ <span class="ruby-identifier">add_error</span>(<span class="ruby-identifier">$!</span>)
509
+ <span class="ruby-keyword">ensure</span>
510
+ <span class="ruby-keyword">begin</span>
511
+ <span class="ruby-identifier">teardown</span>
512
+ <span class="ruby-keyword">rescue</span> <span class="ruby-operator">::</span><span class="ruby-constant">Test</span><span class="ruby-operator">::</span><span class="ruby-constant">Unit</span><span class="ruby-operator">::</span><span class="ruby-constant">AssertionFailedError</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
513
+ <span class="ruby-identifier">add_failure</span>(<span class="ruby-identifier">e</span>.<span class="ruby-identifier">message</span>, <span class="ruby-identifier">e</span>.<span class="ruby-identifier">backtrace</span>)
514
+ <span class="ruby-keyword">rescue</span> <span class="ruby-constant">StandardError</span>, <span class="ruby-constant">ScriptError</span>
515
+ <span class="ruby-identifier">add_error</span>(<span class="ruby-identifier">$!</span>)
516
+ <span class="ruby-keyword">end</span>
517
+ <span class="ruby-keyword">end</span>
518
+ <span class="ruby-keyword">end</span></pre>
519
+ </div><!-- run_test-source -->
520
+
521
+ </div>
522
+
523
+
524
+
525
+
526
+ </div><!-- run_test-method -->
527
+
528
+
529
+ <div id="method-i-run_warmup" class="method-detail ">
530
+
531
+ <div class="method-heading">
532
+ <span class="method-name">run_warmup</span><span
533
+ class="method-args">()</span>
534
+ <span class="method-click-advice">click to toggle source</span>
535
+ </div>
536
+
537
+
538
+ <div class="method-description">
539
+
540
+
541
+
542
+
543
+
544
+ <div class="method-source-code" id="run_warmup-source">
545
+ <pre><span class="ruby-comment"># File lib/ruby-prof/test.rb, line 53</span>
546
+ <span class="ruby-keyword">def</span> <span class="ruby-identifier">run_warmup</span>
547
+ <span class="ruby-identifier">print</span> <span class="ruby-node">&quot;\n#{self.class.name}##{method_name}&quot;</span>
548
+
549
+ <span class="ruby-identifier">run_test</span> <span class="ruby-keyword">do</span>
550
+ <span class="ruby-identifier">bench</span> = <span class="ruby-constant">Benchmark</span>.<span class="ruby-identifier">realtime</span> <span class="ruby-keyword">do</span>
551
+ <span class="ruby-identifier">__send__</span>(<span class="ruby-ivar">@method_name</span>)
552
+ <span class="ruby-keyword">end</span>
553
+ <span class="ruby-identifier">puts</span> <span class="ruby-string">&quot; (%.2fs warmup)&quot;</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">bench</span>
554
+ <span class="ruby-keyword">end</span>
555
+ <span class="ruby-keyword">end</span></pre>
556
+ </div><!-- run_warmup-source -->
557
+
558
+ </div>
559
+
560
+
561
+
562
+
563
+ </div><!-- run_warmup-method -->
564
+
565
+
566
+ </section><!-- public-instance-method-details -->
567
+
568
+ </section><!-- 5Buntitled-5D -->
569
+
570
+ </div><!-- documentation -->
571
+
572
+
573
+ <footer id="validator-badges">
574
+ <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
575
+ <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.
576
+ <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
577
+ </footer>
578
+