ruby-prof 0.4.0-mswin32
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +17 -0
- data/LICENSE +23 -0
- data/README +220 -0
- data/Rakefile +141 -0
- data/bin/ruby-prof +154 -0
- data/doc/classes/RubyProf.html +563 -0
- data/doc/classes/RubyProf/CallInfo.html +274 -0
- data/doc/classes/RubyProf/FlatPrinter.html +207 -0
- data/doc/classes/RubyProf/GraphHtmlPrinter.html +538 -0
- data/doc/classes/RubyProf/GraphPrinter.html +240 -0
- data/doc/classes/RubyProf/MethodInfo.html +556 -0
- data/doc/classes/RubyProf/ProfileTask.html +395 -0
- data/doc/classes/RubyProf/Result.html +234 -0
- data/doc/created.rid +1 -0
- data/doc/files/LICENSE.html +142 -0
- data/doc/files/README.html +376 -0
- data/doc/files/bin/ruby-prof.html +143 -0
- data/doc/files/examples/flat_txt.html +187 -0
- data/doc/files/examples/graph_html.html +948 -0
- data/doc/files/examples/graph_txt.html +305 -0
- data/doc/files/ext/ruby_prof_c.html +101 -0
- data/doc/files/lib/ruby-prof/flat_printer_rb.html +101 -0
- data/doc/files/lib/ruby-prof/graph_html_printer_rb.html +108 -0
- data/doc/files/lib/ruby-prof/graph_printer_rb.html +101 -0
- data/doc/files/lib/ruby-prof/profiletask_rb.html +109 -0
- data/doc/files/lib/ruby-prof_rb.html +111 -0
- data/doc/files/lib/unprof_rb.html +108 -0
- data/doc/fr_class_index.html +34 -0
- data/doc/fr_file_index.html +39 -0
- data/doc/fr_method_index.html +67 -0
- data/doc/index.html +24 -0
- data/doc/rdoc-style.css +208 -0
- data/examples/flat.txt +57 -0
- data/examples/graph.html +827 -0
- data/examples/graph.txt +171 -0
- data/ext/extconf.rb +19 -0
- data/ext/ruby_prof.c +1433 -0
- data/lib/ruby-prof.rb +38 -0
- data/lib/ruby-prof/flat_printer.rb +76 -0
- data/lib/ruby-prof/graph_html_printer.rb +227 -0
- data/lib/ruby-prof/graph_printer.rb +142 -0
- data/lib/ruby-prof/profiletask.rb +150 -0
- data/lib/ruby_prof.so +0 -0
- data/lib/unprof.rb +8 -0
- data/test/basic_test.rb +141 -0
- data/test/clock_mode_test.rb +73 -0
- data/test/module_test.rb +45 -0
- data/test/prime.rb +58 -0
- data/test/prime_test.rb +24 -0
- data/test/printers_test.rb +28 -0
- data/test/recursive_test.rb +55 -0
- data/test/test.rb +3 -0
- data/test/test_helper.rb +45 -0
- data/test/test_suite.rb +9 -0
- data/test/thread_test.rb +32 -0
- data/test/timing_test.rb +90 -0
- metadata +122 -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>
|
113
|
+
<a href="#M000019">link_name</a>
|
114
|
+
<a href="#M000013">new</a>
|
115
|
+
<a href="#M000014">print</a>
|
116
|
+
<a href="#M000017">self_percent</a>
|
117
|
+
<a href="#M000020">template</a>
|
118
|
+
<a href="#M000016">total_percent</a>
|
119
|
+
<a href="#M000015">total_time</a>
|
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"><</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">"<a href=\"##{link_name(thread_id, name)}\">#{name}</a>"</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">/[><#\.\?=:]/</span>,<span class="ruby-value str">"_"</span>) <span class="ruby-operator">+</span> <span class="ruby-value str">"_"</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"><<</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: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
337
|
+
95: <html>
|
338
|
+
96: <head>
|
339
|
+
97: <style media="all" type="text/css">
|
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: </style>
|
381
|
+
139: </head>
|
382
|
+
140: <body>
|
383
|
+
141: <h1>Profile Report</h1>
|
384
|
+
142: <!-- Threads Table -->
|
385
|
+
143: <table>
|
386
|
+
144: <tr>
|
387
|
+
145: <th>Thread ID</th>
|
388
|
+
146: <th>Total Time</th>
|
389
|
+
147: </tr>
|
390
|
+
148: <% for thread_id, methods in @result.threads %>
|
391
|
+
149: <tr>
|
392
|
+
150: <td><a href="#<%= thread_id %>"><%= thread_id %></a></td>
|
393
|
+
151: <td><%= @result.toplevel(thread_id).total_time %></td>
|
394
|
+
152: </tr>
|
395
|
+
153: <% end %>
|
396
|
+
154: </table>
|
397
|
+
155:
|
398
|
+
156: <!-- Methods Tables -->
|
399
|
+
157: <% for thread_id, methods in @result.threads %>
|
400
|
+
158: <h2><a name="<%= thread_id %>">Thread <%= thread_id %></a></h2>
|
401
|
+
159:
|
402
|
+
160: <table>
|
403
|
+
161: <tr>
|
404
|
+
162: <th><%= sprintf("%#{PERCENTAGE_WIDTH}s", "%Total") %></th>
|
405
|
+
163: <th><%= sprintf("%#{PERCENTAGE_WIDTH}s", "%Self") %></th>
|
406
|
+
164: <th><%= sprintf("%#{TIME_WIDTH}s", "Total") %></th>
|
407
|
+
165: <th><%= sprintf("%#{TIME_WIDTH}s", "Self") %></th>
|
408
|
+
166: <th><%= sprintf("%#{TIME_WIDTH+2}s", "Children") %></th>
|
409
|
+
167: <th><%= sprintf("%#{CALL_WIDTH}s", "Calls") %></th>
|
410
|
+
168: <th>Name</th>
|
411
|
+
169: </tr>
|
412
|
+
170:
|
413
|
+
171: <% methods = methods.values.sort.reverse %>
|
414
|
+
172: <% for method in methods %>
|
415
|
+
173: <% method_total_percent = self.total_percent(method) %>
|
416
|
+
174: <% next if method_total_percent < @min_percent %>
|
417
|
+
175: <% method_self_percent = self.self_percent(method) %>
|
418
|
+
176:
|
419
|
+
177: <!-- Parents -->
|
420
|
+
178: <% for name, call_info in method.parents %>
|
421
|
+
179: <tr>
|
422
|
+
180: <td>&nbsp;</td>
|
423
|
+
181: <td>&nbsp;</td>
|
424
|
+
182: <td><%= sprintf("%#{TIME_WIDTH}.2f", call_info.total_time) %></td>
|
425
|
+
183: <td><%= sprintf("%#{TIME_WIDTH}.2f", call_info.self_time) %></td>
|
426
|
+
184: <td><%= sprintf("%#{TIME_WIDTH}.2f", call_info.children_time) %></td>
|
427
|
+
185: <% called = "#{call_info.called}/#{method.called}" %>
|
428
|
+
186: <td><%= sprintf("%#{CALL_WIDTH}s", called) %></td>
|
429
|
+
187: <td><%= create_link(thread_id, name) %></td>
|
430
|
+
188: </tr>
|
431
|
+
189: <% end %>
|
432
|
+
190:
|
433
|
+
191: <tr class="method">
|
434
|
+
192: <td><%= sprintf("%#{PERCENTAGE_WIDTH-1}.2f\%", method_total_percent) %></td>
|
435
|
+
193: <td><%= sprintf("%#{PERCENTAGE_WIDTH-1}.2f\%", method_self_percent) %></td>
|
436
|
+
194: <td><%= sprintf("%#{TIME_WIDTH}.2f", method.total_time) %></td>
|
437
|
+
195: <td><%= sprintf("%#{TIME_WIDTH}.2f", method.self_time) %></td>
|
438
|
+
196: <td><%= sprintf("%#{TIME_WIDTH}.2f", method.children_time) %></td>
|
439
|
+
197: <td><%= sprintf("%#{CALL_WIDTH}i", method.called) %></td>
|
440
|
+
198: <td><a name="<%= link_name(thread_id, method.name) %>"><%= method.name %></a></td>
|
441
|
+
199: </tr>
|
442
|
+
200:
|
443
|
+
201: <!-- Children -->
|
444
|
+
202: <% for name, call_info in method.children %>
|
445
|
+
203: <% methods = @result.threads[thread_id] %>
|
446
|
+
204: <% child = methods[name] %>
|
447
|
+
205:
|
448
|
+
206: <tr>
|
449
|
+
207: <td>&nbsp;</td>
|
450
|
+
208: <td>&nbsp;</td>
|
451
|
+
209: <td><%= sprintf("%#{TIME_WIDTH}.2f", call_info.total_time) %></td>
|
452
|
+
210: <td><%= sprintf("%#{TIME_WIDTH}.2f", call_info.self_time) %></td>
|
453
|
+
211: <td><%= sprintf("%#{TIME_WIDTH}.2f", call_info.children_time) %></td>
|
454
|
+
212: <% called = "#{call_info.called}/#{child.called}" %>
|
455
|
+
213: <td><%= sprintf("%#{CALL_WIDTH}s", called) %></td>
|
456
|
+
214: <td><%= create_link(thread_id, name) %></td>
|
457
|
+
215: </tr>
|
458
|
+
216: <% end %>
|
459
|
+
217: <!-- Create divider row -->
|
460
|
+
218: <tr class="break"><td colspan="7"></td></tr>
|
461
|
+
219: <% end %>
|
462
|
+
220: </table>
|
463
|
+
221: <% end %>
|
464
|
+
222: </body>
|
465
|
+
223: </html>'</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’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>
|