ruby-prof 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. data/CHANGES +17 -0
  2. data/LICENSE +23 -0
  3. data/README +220 -0
  4. data/Rakefile +141 -0
  5. data/bin/ruby-prof +154 -0
  6. data/doc/classes/RubyProf.html +563 -0
  7. data/doc/classes/RubyProf/CallInfo.html +274 -0
  8. data/doc/classes/RubyProf/FlatPrinter.html +207 -0
  9. data/doc/classes/RubyProf/GraphHtmlPrinter.html +538 -0
  10. data/doc/classes/RubyProf/GraphPrinter.html +240 -0
  11. data/doc/classes/RubyProf/MethodInfo.html +556 -0
  12. data/doc/classes/RubyProf/ProfileTask.html +395 -0
  13. data/doc/classes/RubyProf/Result.html +234 -0
  14. data/doc/created.rid +1 -0
  15. data/doc/files/LICENSE.html +142 -0
  16. data/doc/files/README.html +376 -0
  17. data/doc/files/bin/ruby-prof.html +143 -0
  18. data/doc/files/examples/flat_txt.html +187 -0
  19. data/doc/files/examples/graph_html.html +948 -0
  20. data/doc/files/examples/graph_txt.html +305 -0
  21. data/doc/files/ext/ruby_prof_c.html +101 -0
  22. data/doc/files/lib/ruby-prof/flat_printer_rb.html +101 -0
  23. data/doc/files/lib/ruby-prof/graph_html_printer_rb.html +108 -0
  24. data/doc/files/lib/ruby-prof/graph_printer_rb.html +101 -0
  25. data/doc/files/lib/ruby-prof/profiletask_rb.html +109 -0
  26. data/doc/files/lib/ruby-prof_rb.html +111 -0
  27. data/doc/files/lib/unprof_rb.html +108 -0
  28. data/doc/fr_class_index.html +34 -0
  29. data/doc/fr_file_index.html +39 -0
  30. data/doc/fr_method_index.html +67 -0
  31. data/doc/index.html +24 -0
  32. data/doc/rdoc-style.css +208 -0
  33. data/examples/flat.txt +57 -0
  34. data/examples/graph.html +827 -0
  35. data/examples/graph.txt +171 -0
  36. data/ext/extconf.rb +19 -0
  37. data/ext/ruby_prof.c +1433 -0
  38. data/lib/ruby-prof.rb +38 -0
  39. data/lib/ruby-prof/flat_printer.rb +76 -0
  40. data/lib/ruby-prof/graph_html_printer.rb +227 -0
  41. data/lib/ruby-prof/graph_printer.rb +142 -0
  42. data/lib/ruby-prof/profiletask.rb +150 -0
  43. data/lib/unprof.rb +8 -0
  44. data/test/basic_test.rb +141 -0
  45. data/test/clock_mode_test.rb +73 -0
  46. data/test/module_test.rb +45 -0
  47. data/test/prime.rb +58 -0
  48. data/test/prime_test.rb +24 -0
  49. data/test/printers_test.rb +28 -0
  50. data/test/recursive_test.rb +55 -0
  51. data/test/test.rb +3 -0
  52. data/test/test_helper.rb +45 -0
  53. data/test/test_suite.rb +9 -0
  54. data/test/thread_test.rb +32 -0
  55. data/test/timing_test.rb +90 -0
  56. metadata +121 -0
@@ -0,0 +1,538 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Class: RubyProf::GraphHtmlPrinter</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Class</strong></td>
53
+ <td class="class-name-in-header">RubyProf::GraphHtmlPrinter</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../files/lib/ruby-prof/graph_html_printer_rb.html">
59
+ lib/ruby-prof/graph_html_printer.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ <tr class="top-aligned-row">
66
+ <td><strong>Parent:</strong></td>
67
+ <td>
68
+ Object
69
+ </td>
70
+ </tr>
71
+ </table>
72
+ </div>
73
+ <!-- banner header -->
74
+
75
+ <div id="bodyContent">
76
+
77
+
78
+
79
+ <div id="contextContent">
80
+
81
+ <div id="description">
82
+ <p>
83
+ Generates <a href="../../files/examples/graph_html.html">graph</a> profile
84
+ reports as html. To use the grap html printer:
85
+ </p>
86
+ <pre>
87
+ result = RubyProf.profile do
88
+ [code to profile]
89
+ end
90
+
91
+ printer = RubyProf::GraphHtmlPrinter.new(result, 5)
92
+ printer.print(STDOUT, 0)
93
+ </pre>
94
+ <p>
95
+ The constructor takes two arguments. The first is a <a
96
+ href="Result.html">RubyProf::Result</a> object generated from a profiling
97
+ run. The second is the minimum %total (the methods total time divided by
98
+ the overall total time) that a method must take for it to be printed out in
99
+ the report. Use this parameter to eliminate methods that are not important
100
+ to the overall profiling results.
101
+ </p>
102
+
103
+ </div>
104
+
105
+
106
+ </div>
107
+
108
+ <div id="method-list">
109
+ <h3 class="section-bar">Methods</h3>
110
+
111
+ <div class="name-list">
112
+ <a href="#M000018">create_link</a>&nbsp;&nbsp;
113
+ <a href="#M000019">link_name</a>&nbsp;&nbsp;
114
+ <a href="#M000013">new</a>&nbsp;&nbsp;
115
+ <a href="#M000014">print</a>&nbsp;&nbsp;
116
+ <a href="#M000017">self_percent</a>&nbsp;&nbsp;
117
+ <a href="#M000020">template</a>&nbsp;&nbsp;
118
+ <a href="#M000016">total_percent</a>&nbsp;&nbsp;
119
+ <a href="#M000015">total_time</a>&nbsp;&nbsp;
120
+ </div>
121
+ </div>
122
+
123
+ </div>
124
+
125
+
126
+ <!-- if includes -->
127
+
128
+ <div id="section">
129
+
130
+
131
+ <div id="constants-list">
132
+ <h3 class="section-bar">Constants</h3>
133
+
134
+ <div class="name-list">
135
+ <table summary="Constants">
136
+ <tr class="top-aligned-row context-row">
137
+ <td class="context-item-name">PERCENTAGE_WIDTH</td>
138
+ <td>=</td>
139
+ <td class="context-item-value">8</td>
140
+ </tr>
141
+ <tr class="top-aligned-row context-row">
142
+ <td class="context-item-name">TIME_WIDTH</td>
143
+ <td>=</td>
144
+ <td class="context-item-value">10</td>
145
+ </tr>
146
+ <tr class="top-aligned-row context-row">
147
+ <td class="context-item-name">CALL_WIDTH</td>
148
+ <td>=</td>
149
+ <td class="context-item-value">20</td>
150
+ </tr>
151
+ </table>
152
+ </div>
153
+ </div>
154
+
155
+
156
+
157
+
158
+
159
+
160
+ <!-- if method_list -->
161
+ <div id="methods">
162
+ <h3 class="section-bar">Public Class methods</h3>
163
+
164
+ <div id="method-M000013" class="method-detail">
165
+ <a name="M000013"></a>
166
+
167
+ <div class="method-heading">
168
+ <a href="#M000013" class="method-signature">
169
+ <span class="method-name">new</span><span class="method-args">(result)</span>
170
+ </a>
171
+ </div>
172
+
173
+ <div class="method-description">
174
+ <p>
175
+ Create a <a href="GraphPrinter.html">GraphPrinter</a>. <a
176
+ href="Result.html">Result</a> is a <a
177
+ href="Result.html">RubyProf::Result</a> object generated from a profiling
178
+ run.
179
+ </p>
180
+ <p><a class="source-toggle" href="#"
181
+ onclick="toggleCode('M000013-source');return false;">[Source]</a></p>
182
+ <div class="method-source-code" id="M000013-source">
183
+ <pre>
184
+ <span class="ruby-comment cmt"># File lib/ruby-prof/graph_html_printer.rb, line 29</span>
185
+ 29: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">result</span>)
186
+ 30: <span class="ruby-ivar">@result</span> = <span class="ruby-identifier">result</span>
187
+ 31: <span class="ruby-keyword kw">end</span>
188
+ </pre>
189
+ </div>
190
+ </div>
191
+ </div>
192
+
193
+ <h3 class="section-bar">Public Instance methods</h3>
194
+
195
+ <div id="method-M000018" class="method-detail">
196
+ <a name="M000018"></a>
197
+
198
+ <div class="method-heading">
199
+ <a href="#M000018" class="method-signature">
200
+ <span class="method-name">create_link</span><span class="method-args">(thread_id, name)</span>
201
+ </a>
202
+ </div>
203
+
204
+ <div class="method-description">
205
+ <p>
206
+ Creates a link to a method. Note that we do not create links to methods
207
+ which are under the min_perecent specified by the user, since they will not
208
+ be printed out.
209
+ </p>
210
+ <p><a class="source-toggle" href="#"
211
+ onclick="toggleCode('M000018-source');return false;">[Source]</a></p>
212
+ <div class="method-source-code" id="M000018-source">
213
+ <pre>
214
+ <span class="ruby-comment cmt"># File lib/ruby-prof/graph_html_printer.rb, line 75</span>
215
+ 75: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">create_link</span>(<span class="ruby-identifier">thread_id</span>, <span class="ruby-identifier">name</span>)
216
+ 76: <span class="ruby-comment cmt"># Get method</span>
217
+ 77: <span class="ruby-identifier">method</span> = <span class="ruby-ivar">@result</span>.<span class="ruby-identifier">threads</span>[<span class="ruby-identifier">thread_id</span>][<span class="ruby-identifier">name</span>]
218
+ 78:
219
+ 79: <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">total_percent</span>(<span class="ruby-identifier">method</span>) <span class="ruby-operator">&lt;</span> <span class="ruby-ivar">@min_percent</span>
220
+ 80: <span class="ruby-comment cmt"># Just return name</span>
221
+ 81: <span class="ruby-identifier">name</span>
222
+ 82: <span class="ruby-keyword kw">else</span>
223
+ 83: <span class="ruby-comment cmt"># Create link</span>
224
+ 84: <span class="ruby-node">&quot;&lt;a href=\&quot;##{link_name(thread_id, name)}\&quot;&gt;#{name}&lt;/a&gt;&quot;</span>
225
+ 85: <span class="ruby-keyword kw">end</span>
226
+ 86: <span class="ruby-keyword kw">end</span>
227
+ </pre>
228
+ </div>
229
+ </div>
230
+ </div>
231
+
232
+ <div id="method-M000019" class="method-detail">
233
+ <a name="M000019"></a>
234
+
235
+ <div class="method-heading">
236
+ <a href="#M000019" class="method-signature">
237
+ <span class="method-name">link_name</span><span class="method-args">(thread_id, name)</span>
238
+ </a>
239
+ </div>
240
+
241
+ <div class="method-description">
242
+ <p><a class="source-toggle" href="#"
243
+ onclick="toggleCode('M000019-source');return false;">[Source]</a></p>
244
+ <div class="method-source-code" id="M000019-source">
245
+ <pre>
246
+ <span class="ruby-comment cmt"># File lib/ruby-prof/graph_html_printer.rb, line 88</span>
247
+ 88: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">link_name</span>(<span class="ruby-identifier">thread_id</span>, <span class="ruby-identifier">name</span>)\
248
+ 89: <span class="ruby-identifier">name</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/[&gt;&lt;#\.\?=:]/</span>,<span class="ruby-value str">&quot;_&quot;</span>) <span class="ruby-operator">+</span> <span class="ruby-value str">&quot;_&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">thread_id</span>.<span class="ruby-identifier">to_s</span>
249
+ 90: <span class="ruby-keyword kw">end</span>
250
+ </pre>
251
+ </div>
252
+ </div>
253
+ </div>
254
+
255
+ <div id="method-M000014" class="method-detail">
256
+ <a name="M000014"></a>
257
+
258
+ <div class="method-heading">
259
+ <a href="#M000014" class="method-signature">
260
+ <span class="method-name">print</span><span class="method-args">(output = STDOUT, min_percent = 0)</span>
261
+ </a>
262
+ </div>
263
+
264
+ <div class="method-description">
265
+ <p>
266
+ Print a graph html report to the provided output.
267
+ </p>
268
+ <p>
269
+ output - Any IO oject, including STDOUT or a file. The default value is
270
+ STDOUT.
271
+ </p>
272
+ <p>
273
+ min_percent - The minimum %total (the methods total time divided by the
274
+ overall total time) that a method must take for it to be printed out in the
275
+ report. Default value is 0.
276
+ </p>
277
+ <p><a class="source-toggle" href="#"
278
+ onclick="toggleCode('M000014-source');return false;">[Source]</a></p>
279
+ <div class="method-source-code" id="M000014-source">
280
+ <pre>
281
+ <span class="ruby-comment cmt"># File lib/ruby-prof/graph_html_printer.rb, line 42</span>
282
+ 42: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">print</span>(<span class="ruby-identifier">output</span> = <span class="ruby-constant">STDOUT</span>, <span class="ruby-identifier">min_percent</span> = <span class="ruby-value">0</span>)
283
+ 43: <span class="ruby-ivar">@output</span> = <span class="ruby-identifier">output</span>
284
+ 44: <span class="ruby-ivar">@min_percent</span> = <span class="ruby-identifier">min_percent</span>
285
+ 45:
286
+ 46: <span class="ruby-identifier">_erbout</span> = <span class="ruby-ivar">@output</span>
287
+ 47: <span class="ruby-identifier">erb</span> = <span class="ruby-constant">ERB</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">template</span>, <span class="ruby-keyword kw">nil</span>, <span class="ruby-keyword kw">nil</span>)
288
+ 48: <span class="ruby-ivar">@output</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">erb</span>.<span class="ruby-identifier">result</span>(<span class="ruby-identifier">binding</span>)
289
+ 49: <span class="ruby-keyword kw">end</span>
290
+ </pre>
291
+ </div>
292
+ </div>
293
+ </div>
294
+
295
+ <div id="method-M000017" class="method-detail">
296
+ <a name="M000017"></a>
297
+
298
+ <div class="method-heading">
299
+ <a href="#M000017" class="method-signature">
300
+ <span class="method-name">self_percent</span><span class="method-args">(method)</span>
301
+ </a>
302
+ </div>
303
+
304
+ <div class="method-description">
305
+ <p><a class="source-toggle" href="#"
306
+ onclick="toggleCode('M000017-source');return false;">[Source]</a></p>
307
+ <div class="method-source-code" id="M000017-source">
308
+ <pre>
309
+ <span class="ruby-comment cmt"># File lib/ruby-prof/graph_html_printer.rb, line 66</span>
310
+ 66: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">self_percent</span>(<span class="ruby-identifier">method</span>)
311
+ 67: <span class="ruby-identifier">overall_time</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">total_time</span>(<span class="ruby-identifier">method</span>.<span class="ruby-identifier">thread_id</span>)
312
+ 68: (<span class="ruby-identifier">method</span>.<span class="ruby-identifier">self_time</span><span class="ruby-operator">/</span><span class="ruby-identifier">overall_time</span>) <span class="ruby-operator">*</span> <span class="ruby-value">100</span>
313
+ 69: <span class="ruby-keyword kw">end</span>
314
+ </pre>
315
+ </div>
316
+ </div>
317
+ </div>
318
+
319
+ <div id="method-M000020" class="method-detail">
320
+ <a name="M000020"></a>
321
+
322
+ <div class="method-heading">
323
+ <a href="#M000020" class="method-signature">
324
+ <span class="method-name">template</span><span class="method-args">()</span>
325
+ </a>
326
+ </div>
327
+
328
+ <div class="method-description">
329
+ <p><a class="source-toggle" href="#"
330
+ onclick="toggleCode('M000020-source');return false;">[Source]</a></p>
331
+ <div class="method-source-code" id="M000020-source">
332
+ <pre>
333
+ <span class="ruby-comment cmt"># File lib/ruby-prof/graph_html_printer.rb, line 92</span>
334
+ 92: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">template</span>
335
+ 93: <span class="ruby-value str">'
336
+ 94: &lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01//EN&quot; &quot;http://www.w3.org/TR/html4/strict.dtd&quot;&gt;
337
+ 95: &lt;html&gt;
338
+ 96: &lt;head&gt;
339
+ 97: &lt;style media=&quot;all&quot; type=&quot;text/css&quot;&gt;
340
+ 98: table {
341
+ 99: border-collapse: collapse;
342
+ 100: border: 1px solid #CCC;
343
+ 101: font-family: Verdana, Arial, Helvetica, sans-serif;
344
+ 102: font-size: 9pt;
345
+ 103: line-height: normal;
346
+ 104: }
347
+ 105:
348
+ 106: th {
349
+ 107: text-align: center;
350
+ 108: border-top: 1px solid #FB7A31;
351
+ 109: border-bottom: 1px solid #FB7A31;
352
+ 110: background: #FFC;
353
+ 111: padding: 0.3em;
354
+ 112: border-left: 1px solid silver;
355
+ 113: }
356
+ 114:
357
+ 115: tr.break td {
358
+ 116: border: 0;
359
+ 117: border-top: 1px solid #FB7A31;
360
+ 118: padding: 0;
361
+ 119: margin: 0;
362
+ 120: }
363
+ 121:
364
+ 122: tr.method td {
365
+ 123: font-weight: bold;
366
+ 124: }
367
+ 125:
368
+ 126: td {
369
+ 127: padding: 0.3em;
370
+ 128: }
371
+ 129:
372
+ 130: td:first-child {
373
+ 131: width: 190px;
374
+ 132: }
375
+ 133:
376
+ 134: td {
377
+ 135: border-left: 1px solid #CCC;
378
+ 136: text-align: center;
379
+ 137: }
380
+ 138: &lt;/style&gt;
381
+ 139: &lt;/head&gt;
382
+ 140: &lt;body&gt;
383
+ 141: &lt;h1&gt;Profile Report&lt;/h1&gt;
384
+ 142: &lt;!-- Threads Table --&gt;
385
+ 143: &lt;table&gt;
386
+ 144: &lt;tr&gt;
387
+ 145: &lt;th&gt;Thread ID&lt;/th&gt;
388
+ 146: &lt;th&gt;Total Time&lt;/th&gt;
389
+ 147: &lt;/tr&gt;
390
+ 148: &lt;% for thread_id, methods in @result.threads %&gt;
391
+ 149: &lt;tr&gt;
392
+ 150: &lt;td&gt;&lt;a href=&quot;#&lt;%= thread_id %&gt;&quot;&gt;&lt;%= thread_id %&gt;&lt;/a&gt;&lt;/td&gt;
393
+ 151: &lt;td&gt;&lt;%= @result.toplevel(thread_id).total_time %&gt;&lt;/td&gt;
394
+ 152: &lt;/tr&gt;
395
+ 153: &lt;% end %&gt;
396
+ 154: &lt;/table&gt;
397
+ 155:
398
+ 156: &lt;!-- Methods Tables --&gt;
399
+ 157: &lt;% for thread_id, methods in @result.threads %&gt;
400
+ 158: &lt;h2&gt;&lt;a name=&quot;&lt;%= thread_id %&gt;&quot;&gt;Thread &lt;%= thread_id %&gt;&lt;/a&gt;&lt;/h2&gt;
401
+ 159:
402
+ 160: &lt;table&gt;
403
+ 161: &lt;tr&gt;
404
+ 162: &lt;th&gt;&lt;%= sprintf(&quot;%#{PERCENTAGE_WIDTH}s&quot;, &quot;%Total&quot;) %&gt;&lt;/th&gt;
405
+ 163: &lt;th&gt;&lt;%= sprintf(&quot;%#{PERCENTAGE_WIDTH}s&quot;, &quot;%Self&quot;) %&gt;&lt;/th&gt;
406
+ 164: &lt;th&gt;&lt;%= sprintf(&quot;%#{TIME_WIDTH}s&quot;, &quot;Total&quot;) %&gt;&lt;/th&gt;
407
+ 165: &lt;th&gt;&lt;%= sprintf(&quot;%#{TIME_WIDTH}s&quot;, &quot;Self&quot;) %&gt;&lt;/th&gt;
408
+ 166: &lt;th&gt;&lt;%= sprintf(&quot;%#{TIME_WIDTH+2}s&quot;, &quot;Children&quot;) %&gt;&lt;/th&gt;
409
+ 167: &lt;th&gt;&lt;%= sprintf(&quot;%#{CALL_WIDTH}s&quot;, &quot;Calls&quot;) %&gt;&lt;/th&gt;
410
+ 168: &lt;th&gt;Name&lt;/th&gt;
411
+ 169: &lt;/tr&gt;
412
+ 170:
413
+ 171: &lt;% methods = methods.values.sort.reverse %&gt;
414
+ 172: &lt;% for method in methods %&gt;
415
+ 173: &lt;% method_total_percent = self.total_percent(method) %&gt;
416
+ 174: &lt;% next if method_total_percent &lt; @min_percent %&gt;
417
+ 175: &lt;% method_self_percent = self.self_percent(method) %&gt;
418
+ 176:
419
+ 177: &lt;!-- Parents --&gt;
420
+ 178: &lt;% for name, call_info in method.parents %&gt;
421
+ 179: &lt;tr&gt;
422
+ 180: &lt;td&gt;&amp;nbsp;&lt;/td&gt;
423
+ 181: &lt;td&gt;&amp;nbsp;&lt;/td&gt;
424
+ 182: &lt;td&gt;&lt;%= sprintf(&quot;%#{TIME_WIDTH}.2f&quot;, call_info.total_time) %&gt;&lt;/td&gt;
425
+ 183: &lt;td&gt;&lt;%= sprintf(&quot;%#{TIME_WIDTH}.2f&quot;, call_info.self_time) %&gt;&lt;/td&gt;
426
+ 184: &lt;td&gt;&lt;%= sprintf(&quot;%#{TIME_WIDTH}.2f&quot;, call_info.children_time) %&gt;&lt;/td&gt;
427
+ 185: &lt;% called = &quot;#{call_info.called}/#{method.called}&quot; %&gt;
428
+ 186: &lt;td&gt;&lt;%= sprintf(&quot;%#{CALL_WIDTH}s&quot;, called) %&gt;&lt;/td&gt;
429
+ 187: &lt;td&gt;&lt;%= create_link(thread_id, name) %&gt;&lt;/td&gt;
430
+ 188: &lt;/tr&gt;
431
+ 189: &lt;% end %&gt;
432
+ 190:
433
+ 191: &lt;tr class=&quot;method&quot;&gt;
434
+ 192: &lt;td&gt;&lt;%= sprintf(&quot;%#{PERCENTAGE_WIDTH-1}.2f\%&quot;, method_total_percent) %&gt;&lt;/td&gt;
435
+ 193: &lt;td&gt;&lt;%= sprintf(&quot;%#{PERCENTAGE_WIDTH-1}.2f\%&quot;, method_self_percent) %&gt;&lt;/td&gt;
436
+ 194: &lt;td&gt;&lt;%= sprintf(&quot;%#{TIME_WIDTH}.2f&quot;, method.total_time) %&gt;&lt;/td&gt;
437
+ 195: &lt;td&gt;&lt;%= sprintf(&quot;%#{TIME_WIDTH}.2f&quot;, method.self_time) %&gt;&lt;/td&gt;
438
+ 196: &lt;td&gt;&lt;%= sprintf(&quot;%#{TIME_WIDTH}.2f&quot;, method.children_time) %&gt;&lt;/td&gt;
439
+ 197: &lt;td&gt;&lt;%= sprintf(&quot;%#{CALL_WIDTH}i&quot;, method.called) %&gt;&lt;/td&gt;
440
+ 198: &lt;td&gt;&lt;a name=&quot;&lt;%= link_name(thread_id, method.name) %&gt;&quot;&gt;&lt;%= method.name %&gt;&lt;/a&gt;&lt;/td&gt;
441
+ 199: &lt;/tr&gt;
442
+ 200:
443
+ 201: &lt;!-- Children --&gt;
444
+ 202: &lt;% for name, call_info in method.children %&gt;
445
+ 203: &lt;% methods = @result.threads[thread_id] %&gt;
446
+ 204: &lt;% child = methods[name] %&gt;
447
+ 205:
448
+ 206: &lt;tr&gt;
449
+ 207: &lt;td&gt;&amp;nbsp;&lt;/td&gt;
450
+ 208: &lt;td&gt;&amp;nbsp;&lt;/td&gt;
451
+ 209: &lt;td&gt;&lt;%= sprintf(&quot;%#{TIME_WIDTH}.2f&quot;, call_info.total_time) %&gt;&lt;/td&gt;
452
+ 210: &lt;td&gt;&lt;%= sprintf(&quot;%#{TIME_WIDTH}.2f&quot;, call_info.self_time) %&gt;&lt;/td&gt;
453
+ 211: &lt;td&gt;&lt;%= sprintf(&quot;%#{TIME_WIDTH}.2f&quot;, call_info.children_time) %&gt;&lt;/td&gt;
454
+ 212: &lt;% called = &quot;#{call_info.called}/#{child.called}&quot; %&gt;
455
+ 213: &lt;td&gt;&lt;%= sprintf(&quot;%#{CALL_WIDTH}s&quot;, called) %&gt;&lt;/td&gt;
456
+ 214: &lt;td&gt;&lt;%= create_link(thread_id, name) %&gt;&lt;/td&gt;
457
+ 215: &lt;/tr&gt;
458
+ 216: &lt;% end %&gt;
459
+ 217: &lt;!-- Create divider row --&gt;
460
+ 218: &lt;tr class=&quot;break&quot;&gt;&lt;td colspan=&quot;7&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
461
+ 219: &lt;% end %&gt;
462
+ 220: &lt;/table&gt;
463
+ 221: &lt;% end %&gt;
464
+ 222: &lt;/body&gt;
465
+ 223: &lt;/html&gt;'</span>
466
+ 224: <span class="ruby-keyword kw">end</span>
467
+ </pre>
468
+ </div>
469
+ </div>
470
+ </div>
471
+
472
+ <div id="method-M000016" class="method-detail">
473
+ <a name="M000016"></a>
474
+
475
+ <div class="method-heading">
476
+ <a href="#M000016" class="method-signature">
477
+ <span class="method-name">total_percent</span><span class="method-args">(method)</span>
478
+ </a>
479
+ </div>
480
+
481
+ <div class="method-description">
482
+ <p><a class="source-toggle" href="#"
483
+ onclick="toggleCode('M000016-source');return false;">[Source]</a></p>
484
+ <div class="method-source-code" id="M000016-source">
485
+ <pre>
486
+ <span class="ruby-comment cmt"># File lib/ruby-prof/graph_html_printer.rb, line 61</span>
487
+ 61: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">total_percent</span>(<span class="ruby-identifier">method</span>)
488
+ 62: <span class="ruby-identifier">overall_time</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">total_time</span>(<span class="ruby-identifier">method</span>.<span class="ruby-identifier">thread_id</span>)
489
+ 63: (<span class="ruby-identifier">method</span>.<span class="ruby-identifier">total_time</span><span class="ruby-operator">/</span><span class="ruby-identifier">overall_time</span>) <span class="ruby-operator">*</span> <span class="ruby-value">100</span>
490
+ 64: <span class="ruby-keyword kw">end</span>
491
+ </pre>
492
+ </div>
493
+ </div>
494
+ </div>
495
+
496
+ <div id="method-M000015" class="method-detail">
497
+ <a name="M000015"></a>
498
+
499
+ <div class="method-heading">
500
+ <a href="#M000015" class="method-signature">
501
+ <span class="method-name">total_time</span><span class="method-args">(thread_id)</span>
502
+ </a>
503
+ </div>
504
+
505
+ <div class="method-description">
506
+ <p>
507
+ These methods should be private but then ERB doesn&#8217;t work. Turn off
508
+ RDOC though
509
+ </p>
510
+ <p><a class="source-toggle" href="#"
511
+ onclick="toggleCode('M000015-source');return false;">[Source]</a></p>
512
+ <div class="method-source-code" id="M000015-source">
513
+ <pre>
514
+ <span class="ruby-comment cmt"># File lib/ruby-prof/graph_html_printer.rb, line 54</span>
515
+ 54: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">total_time</span>(<span class="ruby-identifier">thread_id</span>)
516
+ 55: <span class="ruby-identifier">toplevel</span> = <span class="ruby-ivar">@result</span>.<span class="ruby-identifier">toplevel</span>(<span class="ruby-identifier">thread_id</span>)
517
+ 56: <span class="ruby-identifier">total_time</span> = <span class="ruby-identifier">toplevel</span>.<span class="ruby-identifier">total_time</span>
518
+ 57: <span class="ruby-identifier">total_time</span> = <span class="ruby-value">0</span><span class="ruby-value">.01</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">total_time</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
519
+ 58: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">total_time</span>
520
+ 59: <span class="ruby-keyword kw">end</span>
521
+ </pre>
522
+ </div>
523
+ </div>
524
+ </div>
525
+
526
+
527
+ </div>
528
+
529
+
530
+ </div>
531
+
532
+
533
+ <div id="validator-badges">
534
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
535
+ </div>
536
+
537
+ </body>
538
+ </html>