ruby-prof 0.15.3 → 0.15.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES +9 -0
  3. data/README.rdoc +24 -39
  4. data/bin/ruby-prof +1 -2
  5. data/doc/created.rid +8 -8
  6. data/doc/js/search_index.js +1 -1
  7. data/doc/js/search_index.js.gz +0 -0
  8. data/ext/ruby_prof/rp_measure.c +20 -28
  9. data/ext/ruby_prof/rp_measure.h +6 -6
  10. data/ext/ruby_prof/rp_measure_allocations.c +9 -2
  11. data/ext/ruby_prof/rp_measure_memory.c +4 -0
  12. data/lib/ruby-prof.rb +9 -20
  13. data/lib/ruby-prof/compatibility.rb +12 -4
  14. data/lib/ruby-prof/printers/flat_printer.rb +1 -0
  15. data/lib/ruby-prof/version.rb +1 -1
  16. data/test/thread_test.rb +7 -4
  17. metadata +2 -54
  18. data/doc/LICENSE.html +0 -114
  19. data/doc/README_rdoc.html +0 -607
  20. data/doc/Rack.html +0 -95
  21. data/doc/Rack/RubyProf.html +0 -264
  22. data/doc/RubyProf.html +0 -965
  23. data/doc/RubyProf/AbstractPrinter.html +0 -546
  24. data/doc/RubyProf/AggregateCallInfo.html +0 -537
  25. data/doc/RubyProf/CallInfo.html +0 -468
  26. data/doc/RubyProf/CallInfoPrinter.html +0 -120
  27. data/doc/RubyProf/CallInfoVisitor.html +0 -200
  28. data/doc/RubyProf/CallStackPrinter.html +0 -1604
  29. data/doc/RubyProf/CallTreePrinter.html +0 -359
  30. data/doc/RubyProf/Cmd.html +0 -624
  31. data/doc/RubyProf/DotPrinter.html +0 -257
  32. data/doc/RubyProf/FlatPrinter.html +0 -163
  33. data/doc/RubyProf/FlatPrinterWithLineNumbers.html +0 -201
  34. data/doc/RubyProf/GraphHtmlPrinter.html +0 -575
  35. data/doc/RubyProf/GraphPrinter.html +0 -139
  36. data/doc/RubyProf/MethodInfo.html +0 -685
  37. data/doc/RubyProf/MultiPrinter.html +0 -358
  38. data/doc/RubyProf/Profile.html +0 -764
  39. data/doc/RubyProf/ProfileTask.html +0 -490
  40. data/doc/RubyProf/Thread.html +0 -199
  41. data/doc/examples/flat_txt.html +0 -149
  42. data/doc/examples/graph_html.html +0 -850
  43. data/doc/examples/graph_txt.html +0 -274
  44. data/doc/images/add.png +0 -0
  45. data/doc/images/arrow_up.png +0 -0
  46. data/doc/images/brick.png +0 -0
  47. data/doc/images/brick_link.png +0 -0
  48. data/doc/images/bug.png +0 -0
  49. data/doc/images/bullet_black.png +0 -0
  50. data/doc/images/bullet_toggle_minus.png +0 -0
  51. data/doc/images/bullet_toggle_plus.png +0 -0
  52. data/doc/images/date.png +0 -0
  53. data/doc/images/delete.png +0 -0
  54. data/doc/images/find.png +0 -0
  55. data/doc/images/macFFBgHack.png +0 -0
  56. data/doc/images/package.png +0 -0
  57. data/doc/images/page_green.png +0 -0
  58. data/doc/images/page_white_text.png +0 -0
  59. data/doc/images/page_white_width.png +0 -0
  60. data/doc/images/plugin.png +0 -0
  61. data/doc/images/ruby.png +0 -0
  62. data/doc/images/tag_blue.png +0 -0
  63. data/doc/images/tag_green.png +0 -0
  64. data/doc/images/transparent.png +0 -0
  65. data/doc/images/wrench.png +0 -0
  66. data/doc/images/wrench_orange.png +0 -0
  67. data/doc/images/zoom.png +0 -0
  68. data/doc/index.html +0 -633
  69. data/doc/table_of_contents.html +0 -859
@@ -1,120 +0,0 @@
1
- <!DOCTYPE html>
2
-
3
- <html>
4
- <head>
5
- <meta charset="UTF-8">
6
-
7
- <title>class RubyProf::CallInfoPrinter - ruby-prof</title>
8
-
9
- <script type="text/javascript">
10
- var rdoc_rel_prefix = "../";
11
- </script>
12
-
13
- <script src="../js/jquery.js"></script>
14
- <script src="../js/darkfish.js"></script>
15
-
16
- <link href="../css/fonts.css" rel="stylesheet">
17
- <link href="../css/rdoc.css" rel="stylesheet">
18
-
19
-
20
-
21
- <body id="top" role="document" class="class">
22
- <nav role="navigation">
23
- <div id="project-navigation">
24
- <div id="home-section" role="region" title="Quick navigation" class="nav-section">
25
- <h2>
26
- <a href="../index.html" rel="home">Home</a>
27
- </h2>
28
-
29
- <div id="table-of-contents-navigation">
30
- <a href="../table_of_contents.html#pages">Pages</a>
31
- <a href="../table_of_contents.html#classes">Classes</a>
32
- <a href="../table_of_contents.html#methods">Methods</a>
33
- </div>
34
- </div>
35
-
36
- <div id="search-section" role="search" class="project-section initially-hidden">
37
- <form action="#" method="get" accept-charset="utf-8">
38
- <div id="search-field-wrapper">
39
- <input id="search-field" role="combobox" aria-label="Search"
40
- aria-autocomplete="list" aria-controls="search-results"
41
- type="text" name="search" placeholder="Search" spellcheck="false"
42
- title="Type to search, Up and Down to navigate, Enter to load">
43
- </div>
44
-
45
- <ul id="search-results" aria-label="Search Results"
46
- aria-busy="false" aria-expanded="false"
47
- aria-atomic="false" class="initially-hidden"></ul>
48
- </form>
49
- </div>
50
-
51
- </div>
52
-
53
-
54
-
55
- <div id="class-metadata">
56
-
57
- <div id="parent-class-section" class="nav-section">
58
- <h3>Parent</h3>
59
-
60
-
61
- <p class="link"><a href="AbstractPrinter.html">RubyProf::AbstractPrinter</a>
62
-
63
- </div>
64
-
65
-
66
-
67
-
68
- </div>
69
- </nav>
70
-
71
- <main role="main" aria-labelledby="class-RubyProf::CallInfoPrinter">
72
- <h1 id="class-RubyProf::CallInfoPrinter" class="class">
73
- class RubyProf::CallInfoPrinter
74
- </h1>
75
-
76
- <section class="description">
77
-
78
- <p>Prints out the call graph based on <a href="CallInfo.html">CallInfo</a>
79
- instances. This is mainly for debugging purposes as it provides access
80
- into into RubyProf&#39;s internals.</p>
81
-
82
- </section>
83
-
84
-
85
-
86
-
87
- <section id="5Buntitled-5D" class="documentation-section">
88
-
89
-
90
-
91
-
92
-
93
- <section class="constants-list">
94
- <header>
95
- <h3>Constants</h3>
96
- </header>
97
- <dl>
98
-
99
- <dt id="TIME_WIDTH">TIME_WIDTH
100
-
101
- <dd>
102
-
103
-
104
- </dl>
105
- </section>
106
-
107
-
108
-
109
-
110
-
111
- </section>
112
- </main>
113
-
114
-
115
- <footer id="validator-badges" role="contentinfo">
116
- <p><a href="http://validator.w3.org/check/referer">Validate</a>
117
- <p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.0.
118
- <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
119
- </footer>
120
-
@@ -1,200 +0,0 @@
1
- <!DOCTYPE html>
2
-
3
- <html>
4
- <head>
5
- <meta charset="UTF-8">
6
-
7
- <title>class RubyProf::CallInfoVisitor - ruby-prof</title>
8
-
9
- <script type="text/javascript">
10
- var rdoc_rel_prefix = "../";
11
- </script>
12
-
13
- <script src="../js/jquery.js"></script>
14
- <script src="../js/darkfish.js"></script>
15
-
16
- <link href="../css/fonts.css" rel="stylesheet">
17
- <link href="../css/rdoc.css" rel="stylesheet">
18
-
19
-
20
-
21
- <body id="top" role="document" class="class">
22
- <nav role="navigation">
23
- <div id="project-navigation">
24
- <div id="home-section" role="region" title="Quick navigation" class="nav-section">
25
- <h2>
26
- <a href="../index.html" rel="home">Home</a>
27
- </h2>
28
-
29
- <div id="table-of-contents-navigation">
30
- <a href="../table_of_contents.html#pages">Pages</a>
31
- <a href="../table_of_contents.html#classes">Classes</a>
32
- <a href="../table_of_contents.html#methods">Methods</a>
33
- </div>
34
- </div>
35
-
36
- <div id="search-section" role="search" class="project-section initially-hidden">
37
- <form action="#" method="get" accept-charset="utf-8">
38
- <div id="search-field-wrapper">
39
- <input id="search-field" role="combobox" aria-label="Search"
40
- aria-autocomplete="list" aria-controls="search-results"
41
- type="text" name="search" placeholder="Search" spellcheck="false"
42
- title="Type to search, Up and Down to navigate, Enter to load">
43
- </div>
44
-
45
- <ul id="search-results" aria-label="Search Results"
46
- aria-busy="false" aria-expanded="false"
47
- aria-atomic="false" class="initially-hidden"></ul>
48
- </form>
49
- </div>
50
-
51
- </div>
52
-
53
-
54
-
55
- <div id="class-metadata">
56
-
57
- <div id="parent-class-section" class="nav-section">
58
- <h3>Parent</h3>
59
-
60
-
61
- <p class="link">Object
62
-
63
- </div>
64
-
65
-
66
-
67
- <!-- Method Quickref -->
68
- <div id="method-list-section" class="nav-section">
69
- <h3>Methods</h3>
70
-
71
- <ul class="link-list" role="directory">
72
-
73
- <li ><a href="#method-c-new">::new</a>
74
-
75
- <li ><a href="#method-i-visit">#visit</a>
76
-
77
- </ul>
78
- </div>
79
-
80
- </div>
81
- </nav>
82
-
83
- <main role="main" aria-labelledby="class-RubyProf::CallInfoVisitor">
84
- <h1 id="class-RubyProf::CallInfoVisitor" class="class">
85
- class RubyProf::CallInfoVisitor
86
- </h1>
87
-
88
- <section class="description">
89
-
90
- </section>
91
-
92
-
93
-
94
-
95
- <section id="5Buntitled-5D" class="documentation-section">
96
-
97
-
98
-
99
-
100
-
101
-
102
-
103
-
104
-
105
- <section id="public-class-5Buntitled-5D-method-details" class="method-section">
106
- <header>
107
- <h3>Public Class Methods</h3>
108
- </header>
109
-
110
-
111
- <div id="method-c-new" class="method-detail ">
112
-
113
- <div class="method-heading">
114
- <span class="method-name">new</span><span
115
- class="method-args">(thread)</span>
116
-
117
- <span class="method-click-advice">click to toggle source</span>
118
-
119
- </div>
120
-
121
-
122
- <div class="method-description">
123
-
124
-
125
-
126
-
127
-
128
-
129
- <div class="method-source-code" id="new-source">
130
- <pre><span class="ruby-comment"># File lib/ruby-prof/call_info_visitor.rb, line 21</span>
131
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">thread</span>)
132
- <span class="ruby-ivar">@thread</span> = <span class="ruby-identifier">thread</span>
133
- <span class="ruby-keyword">end</span></pre>
134
- </div>
135
-
136
- </div>
137
-
138
-
139
-
140
-
141
- </div>
142
-
143
-
144
- </section>
145
-
146
- <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
147
- <header>
148
- <h3>Public Instance Methods</h3>
149
- </header>
150
-
151
-
152
- <div id="method-i-visit" class="method-detail ">
153
-
154
- <div class="method-heading">
155
- <span class="method-name">visit</span><span
156
- class="method-args">(&block)</span>
157
-
158
- <span class="method-click-advice">click to toggle source</span>
159
-
160
- </div>
161
-
162
-
163
- <div class="method-description">
164
-
165
-
166
-
167
-
168
-
169
-
170
- <div class="method-source-code" id="visit-source">
171
- <pre><span class="ruby-comment"># File lib/ruby-prof/call_info_visitor.rb, line 25</span>
172
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">visit</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
173
- <span class="ruby-ivar">@thread</span>.<span class="ruby-identifier">top_methods</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">method_info</span><span class="ruby-operator">|</span>
174
- <span class="ruby-identifier">method_info</span>.<span class="ruby-identifier">call_infos</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">call_info</span><span class="ruby-operator">|</span>
175
- <span class="ruby-identifier">visit_call_info</span>(<span class="ruby-identifier">call_info</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
176
- <span class="ruby-keyword">end</span>
177
- <span class="ruby-keyword">end</span>
178
- <span class="ruby-keyword">end</span></pre>
179
- </div>
180
-
181
- </div>
182
-
183
-
184
-
185
-
186
- </div>
187
-
188
-
189
- </section>
190
-
191
- </section>
192
- </main>
193
-
194
-
195
- <footer id="validator-badges" role="contentinfo">
196
- <p><a href="http://validator.w3.org/check/referer">Validate</a>
197
- <p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.0.
198
- <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
199
- </footer>
200
-
@@ -1,1604 +0,0 @@
1
- <!DOCTYPE html>
2
-
3
- <html>
4
- <head>
5
- <meta charset="UTF-8">
6
-
7
- <title>class RubyProf::CallStackPrinter - ruby-prof</title>
8
-
9
- <script type="text/javascript">
10
- var rdoc_rel_prefix = "../";
11
- </script>
12
-
13
- <script src="../js/jquery.js"></script>
14
- <script src="../js/darkfish.js"></script>
15
-
16
- <link href="../css/fonts.css" rel="stylesheet">
17
- <link href="../css/rdoc.css" rel="stylesheet">
18
-
19
-
20
-
21
- <body id="top" role="document" class="class">
22
- <nav role="navigation">
23
- <div id="project-navigation">
24
- <div id="home-section" role="region" title="Quick navigation" class="nav-section">
25
- <h2>
26
- <a href="../index.html" rel="home">Home</a>
27
- </h2>
28
-
29
- <div id="table-of-contents-navigation">
30
- <a href="../table_of_contents.html#pages">Pages</a>
31
- <a href="../table_of_contents.html#classes">Classes</a>
32
- <a href="../table_of_contents.html#methods">Methods</a>
33
- </div>
34
- </div>
35
-
36
- <div id="search-section" role="search" class="project-section initially-hidden">
37
- <form action="#" method="get" accept-charset="utf-8">
38
- <div id="search-field-wrapper">
39
- <input id="search-field" role="combobox" aria-label="Search"
40
- aria-autocomplete="list" aria-controls="search-results"
41
- type="text" name="search" placeholder="Search" spellcheck="false"
42
- title="Type to search, Up and Down to navigate, Enter to load">
43
- </div>
44
-
45
- <ul id="search-results" aria-label="Search Results"
46
- aria-busy="false" aria-expanded="false"
47
- aria-atomic="false" class="initially-hidden"></ul>
48
- </form>
49
- </div>
50
-
51
- </div>
52
-
53
-
54
-
55
- <div id="class-metadata">
56
-
57
- <div id="parent-class-section" class="nav-section">
58
- <h3>Parent</h3>
59
-
60
-
61
- <p class="link"><a href="AbstractPrinter.html">RubyProf::AbstractPrinter</a>
62
-
63
- </div>
64
-
65
- <div id="includes-section" class="nav-section">
66
- <h3>Included Modules</h3>
67
-
68
- <ul class="link-list">
69
-
70
-
71
- <li><span class="include">ERB::Util</span>
72
-
73
-
74
- </ul>
75
- </div>
76
-
77
-
78
- <!-- Method Quickref -->
79
- <div id="method-list-section" class="nav-section">
80
- <h3>Methods</h3>
81
-
82
- <ul class="link-list" role="directory">
83
-
84
- <li ><a href="#method-i-application">#application</a>
85
-
86
- <li ><a href="#method-i-arguments">#arguments</a>
87
-
88
- <li ><a href="#method-i-color">#color</a>
89
-
90
- <li ><a href="#method-i-copy_image_files">#copy_image_files</a>
91
-
92
- <li ><a href="#method-i-dump">#dump</a>
93
-
94
- <li ><a href="#method-i-expansion">#expansion</a>
95
-
96
- <li ><a href="#method-i-graph_link">#graph_link</a>
97
-
98
- <li ><a href="#method-i-link">#link</a>
99
-
100
- <li ><a href="#method-i-method_href">#method_href</a>
101
-
102
- <li ><a href="#method-i-name">#name</a>
103
-
104
- <li ><a href="#method-i-print">#print</a>
105
-
106
- <li ><a href="#method-i-print_commands">#print_commands</a>
107
-
108
- <li ><a href="#method-i-print_css">#print_css</a>
109
-
110
- <li ><a href="#method-i-print_footer">#print_footer</a>
111
-
112
- <li ><a href="#method-i-print_header">#print_header</a>
113
-
114
- <li ><a href="#method-i-print_help">#print_help</a>
115
-
116
- <li ><a href="#method-i-print_java_script">#print_java_script</a>
117
-
118
- <li ><a href="#method-i-print_stack">#print_stack</a>
119
-
120
- <li ><a href="#method-i-print_title_bar">#print_title_bar</a>
121
-
122
- <li ><a href="#method-i-sum">#sum</a>
123
-
124
- <li ><a href="#method-i-threshold">#threshold</a>
125
-
126
- <li ><a href="#method-i-title">#title</a>
127
-
128
- <li ><a href="#method-i-total_time">#total_time</a>
129
-
130
- </ul>
131
- </div>
132
-
133
- </div>
134
- </nav>
135
-
136
- <main role="main" aria-labelledby="class-RubyProf::CallStackPrinter">
137
- <h1 id="class-RubyProf::CallStackPrinter" class="class">
138
- class RubyProf::CallStackPrinter
139
- </h1>
140
-
141
- <section class="description">
142
-
143
- <p>prints a HTML visualization of the call tree</p>
144
-
145
- </section>
146
-
147
-
148
-
149
-
150
- <section id="5Buntitled-5D" class="documentation-section">
151
-
152
-
153
-
154
-
155
-
156
-
157
-
158
-
159
-
160
- <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
161
- <header>
162
- <h3>Public Instance Methods</h3>
163
- </header>
164
-
165
-
166
- <div id="method-i-application" class="method-detail ">
167
-
168
- <div class="method-heading">
169
- <span class="method-name">application</span><span
170
- class="method-args">()</span>
171
-
172
- <span class="method-click-advice">click to toggle source</span>
173
-
174
- </div>
175
-
176
-
177
- <div class="method-description">
178
-
179
-
180
-
181
-
182
-
183
-
184
- <div class="method-source-code" id="application-source">
185
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 162</span>
186
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">application</span>
187
- <span class="ruby-ivar">@options</span>[<span class="ruby-value">:application</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">$PROGRAM_NAME</span>
188
- <span class="ruby-keyword">end</span></pre>
189
- </div>
190
-
191
- </div>
192
-
193
-
194
-
195
-
196
- </div>
197
-
198
-
199
- <div id="method-i-arguments" class="method-detail ">
200
-
201
- <div class="method-heading">
202
- <span class="method-name">arguments</span><span
203
- class="method-args">()</span>
204
-
205
- <span class="method-click-advice">click to toggle source</span>
206
-
207
- </div>
208
-
209
-
210
- <div class="method-description">
211
-
212
-
213
-
214
-
215
-
216
-
217
- <div class="method-source-code" id="arguments-source">
218
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 166</span>
219
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">arguments</span>
220
- <span class="ruby-constant">ARGV</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">&#39; &#39;</span>)
221
- <span class="ruby-keyword">end</span></pre>
222
- </div>
223
-
224
- </div>
225
-
226
-
227
-
228
-
229
- </div>
230
-
231
-
232
- <div id="method-i-color" class="method-detail ">
233
-
234
- <div class="method-heading">
235
- <span class="method-name">color</span><span
236
- class="method-args">(p)</span>
237
-
238
- <span class="method-click-advice">click to toggle source</span>
239
-
240
- </div>
241
-
242
-
243
- <div class="method-description">
244
-
245
-
246
-
247
-
248
-
249
-
250
- <div class="method-source-code" id="color-source">
251
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 149</span>
252
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">color</span>(<span class="ruby-identifier">p</span>)
253
- <span class="ruby-keyword">case</span> <span class="ruby-identifier">i</span> = <span class="ruby-identifier">p</span>.<span class="ruby-identifier">to_i</span>
254
- <span class="ruby-keyword">when</span> <span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-value">5</span>
255
- <span class="ruby-string">&quot;01&quot;</span>
256
- <span class="ruby-keyword">when</span> <span class="ruby-value">5</span><span class="ruby-operator">..</span><span class="ruby-value">10</span>
257
- <span class="ruby-string">&quot;05&quot;</span>
258
- <span class="ruby-keyword">when</span> <span class="ruby-value">100</span>
259
- <span class="ruby-string">&quot;9&quot;</span>
260
- <span class="ruby-keyword">else</span>
261
- <span class="ruby-node">&quot;#{i/10}&quot;</span>
262
- <span class="ruby-keyword">end</span>
263
- <span class="ruby-keyword">end</span></pre>
264
- </div>
265
-
266
- </div>
267
-
268
-
269
-
270
-
271
- </div>
272
-
273
-
274
- <div id="method-i-copy_image_files" class="method-detail ">
275
-
276
- <div class="method-heading">
277
- <span class="method-name">copy_image_files</span><span
278
- class="method-args">()</span>
279
-
280
- <span class="method-click-advice">click to toggle source</span>
281
-
282
- </div>
283
-
284
-
285
- <div class="method-description">
286
-
287
-
288
-
289
-
290
-
291
-
292
- <div class="method-source-code" id="copy_image_files-source">
293
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 182</span>
294
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">copy_image_files</span>
295
- <span class="ruby-keyword">if</span> <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">File</span>)
296
- <span class="ruby-identifier">target_dir</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-ivar">@output</span>.<span class="ruby-identifier">path</span>)
297
- <span class="ruby-identifier">image_dir</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-keyword">__FILE__</span>), <span class="ruby-string">&#39;..&#39;</span>, <span class="ruby-string">&#39;images&#39;</span>)
298
- <span class="ruby-node">%w(empty plus minus)</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">img</span><span class="ruby-operator">|</span>
299
- <span class="ruby-identifier">source_file</span> = <span class="ruby-node">&quot;#{image_dir}/#{img}.png&quot;</span>
300
- <span class="ruby-identifier">target_file</span> = <span class="ruby-node">&quot;#{target_dir}/#{img}.png&quot;</span>
301
- <span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">cp</span>(<span class="ruby-identifier">source_file</span>, <span class="ruby-identifier">target_file</span>) <span class="ruby-keyword">unless</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-identifier">target_file</span>)
302
- <span class="ruby-keyword">end</span>
303
- <span class="ruby-keyword">end</span>
304
- <span class="ruby-keyword">end</span></pre>
305
- </div>
306
-
307
- </div>
308
-
309
-
310
-
311
-
312
- </div>
313
-
314
-
315
- <div id="method-i-dump" class="method-detail ">
316
-
317
- <div class="method-heading">
318
- <span class="method-name">dump</span><span
319
- class="method-args">(ci)</span>
320
-
321
- <span class="method-click-advice">click to toggle source</span>
322
-
323
- </div>
324
-
325
-
326
- <div class="method-description">
327
-
328
-
329
-
330
-
331
-
332
-
333
- <div class="method-source-code" id="dump-source">
334
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 145</span>
335
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">dump</span>(<span class="ruby-identifier">ci</span>)
336
- <span class="ruby-identifier">$stderr</span>.<span class="ruby-identifier">printf</span> <span class="ruby-string">&quot;%s/%d t:%f s:%f w:%f \n&quot;</span>, <span class="ruby-identifier">ci</span>, <span class="ruby-identifier">ci</span>.<span class="ruby-identifier">object_id</span>, <span class="ruby-identifier">ci</span>.<span class="ruby-identifier">total_time</span>, <span class="ruby-identifier">ci</span>.<span class="ruby-identifier">self_time</span>, <span class="ruby-identifier">ci</span>.<span class="ruby-identifier">wait_time</span>
337
- <span class="ruby-keyword">end</span></pre>
338
- </div>
339
-
340
- </div>
341
-
342
-
343
-
344
-
345
- </div>
346
-
347
-
348
- <div id="method-i-expansion" class="method-detail ">
349
-
350
- <div class="method-heading">
351
- <span class="method-name">expansion</span><span
352
- class="method-args">()</span>
353
-
354
- <span class="method-click-advice">click to toggle source</span>
355
-
356
- </div>
357
-
358
-
359
- <div class="method-description">
360
-
361
-
362
-
363
-
364
-
365
-
366
- <div class="method-source-code" id="expansion-source">
367
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 178</span>
368
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">expansion</span>
369
- <span class="ruby-ivar">@options</span>[<span class="ruby-value">:expansion</span>] <span class="ruby-operator">||</span> <span class="ruby-value">10.0</span>
370
- <span class="ruby-keyword">end</span></pre>
371
- </div>
372
-
373
- </div>
374
-
375
-
376
-
377
-
378
- </div>
379
-
380
-
381
- <div id="method-i-graph_link" class="method-detail ">
382
-
383
- <div class="method-heading">
384
- <span class="method-name">graph_link</span><span
385
- class="method-args">(call_info)</span>
386
-
387
- <span class="method-click-advice">click to toggle source</span>
388
-
389
- </div>
390
-
391
-
392
- <div class="method-description">
393
-
394
-
395
-
396
-
397
-
398
-
399
- <div class="method-source-code" id="graph_link-source">
400
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 126</span>
401
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">graph_link</span>(<span class="ruby-identifier">call_info</span>)
402
- <span class="ruby-identifier">total_calls</span> = <span class="ruby-identifier">call_info</span>.<span class="ruby-identifier">target</span>.<span class="ruby-identifier">call_infos</span>.<span class="ruby-identifier">inject</span>(<span class="ruby-value">0</span>){<span class="ruby-operator">|</span><span class="ruby-identifier">t</span>, <span class="ruby-identifier">ci</span><span class="ruby-operator">|</span> <span class="ruby-identifier">t</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">ci</span>.<span class="ruby-identifier">called</span>}
403
- <span class="ruby-identifier">href</span> = <span class="ruby-node">&quot;#{@graph_html}##{method_href(call_info.target)}&quot;</span>
404
- <span class="ruby-identifier">totals</span> = <span class="ruby-ivar">@graph_html</span> <span class="ruby-operator">?</span> <span class="ruby-node">&quot;&lt;a href=&#39;#{href}&#39;&gt;#{total_calls}&lt;/a&gt;&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">total_calls</span>.<span class="ruby-identifier">to_s</span>
405
- <span class="ruby-node">&quot;[#{call_info.called} calls, #{totals} total]&quot;</span>
406
- <span class="ruby-keyword">end</span></pre>
407
- </div>
408
-
409
- </div>
410
-
411
-
412
-
413
-
414
- </div>
415
-
416
-
417
- <div id="method-i-link" class="method-detail ">
418
-
419
- <div class="method-heading">
420
- <span class="method-name">link</span><span
421
- class="method-args">(call_info)</span>
422
-
423
- <span class="method-click-advice">click to toggle source</span>
424
-
425
- </div>
426
-
427
-
428
- <div class="method-description">
429
-
430
-
431
-
432
-
433
-
434
-
435
- <div class="method-source-code" id="link-source">
436
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 112</span>
437
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">link</span>(<span class="ruby-identifier">call_info</span>)
438
- <span class="ruby-identifier">method</span> = <span class="ruby-identifier">call_info</span>.<span class="ruby-identifier">target</span>
439
- <span class="ruby-identifier">file</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-identifier">method</span>.<span class="ruby-identifier">source_file</span>)
440
- <span class="ruby-keyword">if</span> <span class="ruby-identifier">file</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/\/ruby_runtime$/</span>
441
- <span class="ruby-identifier">h</span>(<span class="ruby-identifier">name</span>(<span class="ruby-identifier">call_info</span>))
442
- <span class="ruby-keyword">else</span>
443
- <span class="ruby-keyword">if</span> <span class="ruby-constant">RUBY_PLATFORM</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/darwin/</span>
444
- <span class="ruby-node">&quot;&lt;a href=\&quot;txmt://open?url=file://#{file}&amp;line=#{method.line}\&quot;&gt;#{h(name(call_info))}&lt;/a&gt;&quot;</span>
445
- <span class="ruby-keyword">else</span>
446
- <span class="ruby-node">&quot;&lt;a href=\&quot;file://#{file}##{method.line}\&quot;&gt;#{h(name(call_info))}&lt;/a&gt;&quot;</span>
447
- <span class="ruby-keyword">end</span>
448
- <span class="ruby-keyword">end</span>
449
- <span class="ruby-keyword">end</span></pre>
450
- </div>
451
-
452
- </div>
453
-
454
-
455
-
456
-
457
- </div>
458
-
459
-
460
- <div id="method-i-method_href" class="method-detail ">
461
-
462
- <div class="method-heading">
463
- <span class="method-name">method_href</span><span
464
- class="method-args">(method)</span>
465
-
466
- <span class="method-click-advice">click to toggle source</span>
467
-
468
- </div>
469
-
470
-
471
- <div class="method-description">
472
-
473
-
474
-
475
-
476
-
477
-
478
- <div class="method-source-code" id="method_href-source">
479
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 133</span>
480
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">method_href</span>(<span class="ruby-identifier">method</span>)
481
- <span class="ruby-identifier">h</span>(<span class="ruby-identifier">method</span>.<span class="ruby-identifier">full_name</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-node">/[&gt;&lt;#\.\?=:]/</span>,<span class="ruby-string">&quot;_&quot;</span>) <span class="ruby-operator">+</span> <span class="ruby-string">&quot;_&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@current_thread_id</span>.<span class="ruby-identifier">to_s</span>)
482
- <span class="ruby-keyword">end</span></pre>
483
- </div>
484
-
485
- </div>
486
-
487
-
488
-
489
-
490
- </div>
491
-
492
-
493
- <div id="method-i-name" class="method-detail ">
494
-
495
- <div class="method-heading">
496
- <span class="method-name">name</span><span
497
- class="method-args">(call_info)</span>
498
-
499
- <span class="method-click-advice">click to toggle source</span>
500
-
501
- </div>
502
-
503
-
504
- <div class="method-description">
505
-
506
-
507
-
508
-
509
-
510
-
511
- <div class="method-source-code" id="name-source">
512
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 107</span>
513
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">name</span>(<span class="ruby-identifier">call_info</span>)
514
- <span class="ruby-identifier">method</span> = <span class="ruby-identifier">call_info</span>.<span class="ruby-identifier">target</span>
515
- <span class="ruby-identifier">method</span>.<span class="ruby-identifier">full_name</span>
516
- <span class="ruby-keyword">end</span></pre>
517
- </div>
518
-
519
- </div>
520
-
521
-
522
-
523
-
524
- </div>
525
-
526
-
527
- <div id="method-i-print" class="method-detail ">
528
-
529
- <div class="method-heading">
530
- <span class="method-name">print</span><span
531
- class="method-args">(output = STDOUT, options = {})</span>
532
-
533
- <span class="method-click-advice">click to toggle source</span>
534
-
535
- </div>
536
-
537
-
538
- <div class="method-description">
539
-
540
- <p>Specify print options.</p>
541
-
542
- <p>options - Hash table</p>
543
-
544
- <pre>:min_percent - Number 0 to 100 that specifes the minimum
545
- %self (the methods self time divided by the
546
- overall total time) that a method must take
547
- for it to be printed out in the report.
548
- Default value is 0.
549
-
550
- :print_file - True or false. Specifies if a method&#39;s source
551
- file should be printed. Default value if false.
552
-
553
- :threshold - a float from 0 to 100 that sets the threshold of
554
- results displayed.
555
- Default value is 1.0
556
-
557
- :title - a String to overide the default &quot;ruby-prof call tree&quot;
558
- title of the report.
559
-
560
- :expansion - a float from 0 to 100 that sets the threshold of
561
- results that are expanded, if the percent_total
562
- exceeds it.
563
- Default value is 10.0
564
-
565
- :application - a String to overide the name of the application,
566
- as it appears on the report.</pre>
567
-
568
-
569
-
570
-
571
- <div class="method-source-code" id="print-source">
572
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 37</span>
573
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">print</span>(<span class="ruby-identifier">output</span> = <span class="ruby-constant">STDOUT</span>, <span class="ruby-identifier">options</span> = {})
574
- <span class="ruby-ivar">@output</span> = <span class="ruby-identifier">output</span>
575
- <span class="ruby-identifier">setup_options</span>(<span class="ruby-identifier">options</span>)
576
- <span class="ruby-keyword">if</span> <span class="ruby-ivar">@graph_html</span> = <span class="ruby-identifier">options</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value">:graph</span>)
577
- <span class="ruby-ivar">@graph_html</span> = <span class="ruby-string">&quot;file://&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@graph_html</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@graph_html</span>[<span class="ruby-value">0</span>]<span class="ruby-operator">==</span><span class="ruby-string">&quot;/&quot;</span>
578
- <span class="ruby-keyword">end</span>
579
-
580
- <span class="ruby-identifier">print_header</span>
581
-
582
- <span class="ruby-ivar">@overall_threads_time</span> = <span class="ruby-ivar">@result</span>.<span class="ruby-identifier">threads</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">val</span>, <span class="ruby-identifier">thread</span><span class="ruby-operator">|</span>
583
- <span class="ruby-identifier">val</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">thread</span>.<span class="ruby-identifier">total_time</span>
584
- <span class="ruby-keyword">end</span>
585
-
586
- <span class="ruby-ivar">@result</span>.<span class="ruby-identifier">threads</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">thread</span><span class="ruby-operator">|</span>
587
- <span class="ruby-ivar">@current_thread_id</span> = <span class="ruby-identifier">thread</span>.<span class="ruby-identifier">fiber_id</span>
588
- <span class="ruby-ivar">@overall_time</span> = <span class="ruby-identifier">thread</span>.<span class="ruby-identifier">total_time</span>
589
- <span class="ruby-identifier">thread_info</span> = <span class="ruby-node">&quot;Thread: #{thread.id}&quot;</span>
590
- <span class="ruby-identifier">thread_info</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;, Fiber: #{thread.fiber_id}&quot;</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">thread</span>.<span class="ruby-identifier">id</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">thread</span>.<span class="ruby-identifier">fiber_id</span>
591
- <span class="ruby-identifier">thread_info</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot; (#{&quot;%4.2f%%&quot; % ((@overall_time/@overall_threads_time)*100)} ~ #{@overall_time})&quot;</span>
592
- <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">print</span> <span class="ruby-node">&quot;&lt;div class=\&quot;thread\&quot;&gt;#{thread_info}&lt;/div&gt;&quot;</span>
593
- <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">print</span> <span class="ruby-string">&quot;&lt;ul name=\&quot;thread\&quot;&gt;&quot;</span>
594
- <span class="ruby-identifier">thread</span>.<span class="ruby-identifier">methods</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">m</span><span class="ruby-operator">|</span>
595
- <span class="ruby-comment"># $stderr.print m.dump</span>
596
- <span class="ruby-keyword">next</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">m</span>.<span class="ruby-identifier">root?</span>
597
- <span class="ruby-identifier">m</span>.<span class="ruby-identifier">call_infos</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">ci</span><span class="ruby-operator">|</span>
598
- <span class="ruby-keyword">next</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">ci</span>.<span class="ruby-identifier">root?</span>
599
- <span class="ruby-identifier">print_stack</span> <span class="ruby-identifier">ci</span>, <span class="ruby-identifier">thread</span>.<span class="ruby-identifier">total_time</span>
600
- <span class="ruby-keyword">end</span>
601
- <span class="ruby-keyword">end</span>
602
- <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">print</span> <span class="ruby-string">&quot;&lt;/ul&gt;&quot;</span>
603
- <span class="ruby-keyword">end</span>
604
-
605
- <span class="ruby-identifier">print_footer</span>
606
-
607
- <span class="ruby-identifier">copy_image_files</span>
608
- <span class="ruby-keyword">end</span></pre>
609
- </div>
610
-
611
- </div>
612
-
613
-
614
-
615
-
616
- </div>
617
-
618
-
619
- <div id="method-i-print_commands" class="method-detail ">
620
-
621
- <div class="method-heading">
622
- <span class="method-name">print_commands</span><span
623
- class="method-args">()</span>
624
-
625
- <span class="method-click-advice">click to toggle source</span>
626
-
627
- </div>
628
-
629
-
630
- <div class="method-description">
631
-
632
-
633
-
634
-
635
-
636
-
637
- <div class="method-source-code" id="print_commands-source">
638
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 740</span>
639
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">print_commands</span>
640
- <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">puts</span> <span class="ruby-value">&lt;&lt;-&quot;end_commands&quot;
641
- &lt;div id=\&quot;commands\&quot;&gt;
642
- &lt;span style=\&quot;font-size: 11pt; font-weight: bold;\&quot;&gt;Threshold:&lt;/span&gt;
643
- &lt;input value=\&quot;#{h threshold}\&quot; size=\&quot;3\&quot; id=\&quot;threshold\&quot; type=\&quot;text\&quot;&gt;
644
- &lt;input value=\&quot;Apply\&quot; onclick=\&quot;setThreshold();\&quot; type=\&quot;submit\&quot;&gt;
645
- &lt;input value=\&quot;Expand All\&quot; onclick=\&quot;expandAll(event);\&quot; type=\&quot;submit\&quot;&gt;
646
- &lt;input value=\&quot;Collapse All\&quot; onclick=\&quot;collapseAll(event);\&quot; type=\&quot;submit\&quot;&gt;
647
- &lt;input value=\&quot;Show Help\&quot; onclick=\&quot;toggleHelp(this);\&quot; type=\&quot;submit\&quot;&gt;
648
- &lt;/div&gt;
649
- end_commands</span>
650
- <span class="ruby-keyword">end</span></pre>
651
- </div>
652
-
653
- </div>
654
-
655
-
656
-
657
-
658
- </div>
659
-
660
-
661
- <div id="method-i-print_css" class="method-detail ">
662
-
663
- <div class="method-heading">
664
- <span class="method-name">print_css</span><span
665
- class="method-args">()</span>
666
-
667
- <span class="method-click-advice">click to toggle source</span>
668
-
669
- </div>
670
-
671
-
672
- <div class="method-description">
673
-
674
-
675
-
676
-
677
-
678
-
679
- <div class="method-source-code" id="print_css-source">
680
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 210</span>
681
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">print_css</span>
682
- <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">puts</span> <span class="ruby-value">&lt;&lt;-&#39;end_css&#39;
683
- &lt;style type=&quot;text/css&quot;&gt;
684
- &lt;!--
685
- body {
686
- font-size:70%;
687
- padding:0px;
688
- margin:5px;
689
- margin-right:0px;
690
- margin-left:0px;
691
- background: #ffffff;
692
- }
693
- ul {
694
- margin-left:0px;
695
- margin-top:0px;
696
- margin-bottom:0px;
697
- padding-left:0px;
698
- list-style-type:none;
699
- }
700
- li {
701
- margin-left:11px;
702
- padding:0px;
703
- white-space:nowrap;
704
- border-top:1px solid #cccccc;
705
- border-left:1px solid #cccccc;
706
- border-bottom:none;
707
- }
708
- .thread {
709
- margin-left:11px;
710
- background:#708090;
711
- padding-top:3px;
712
- padding-left:12px;
713
- padding-bottom:2px;
714
- border-left:1px solid #CCCCCC;
715
- border-top:1px solid #CCCCCC;
716
- font-weight:bold;
717
- }
718
- .hidden {
719
- display:none;
720
- width:0px;
721
- height:0px;
722
- margin:0px;
723
- padding:0px;
724
- border-style:none;
725
- }
726
- .color01 { background:#adbdeb }
727
- .color05 { background:#9daddb }
728
- .color0 { background:#8d9dcb }
729
- .color1 { background:#89bccb }
730
- .color2 { background:#56e3e7 }
731
- .color3 { background:#32cd70 }
732
- .color4 { background:#a3d53c }
733
- .color5 { background:#c4cb34 }
734
- .color6 { background:#dcb66d }
735
- .color7 { background:#cda59e }
736
- .color8 { background:#be9d9c }
737
- .color9 { background:#cf947a }
738
- #commands {
739
- font-size:10pt;
740
- padding:10px;
741
- margin-left:11px;
742
- margin-bottom:0px;
743
- margin-top:0px;
744
- background:#708090;
745
- border-top:1px solid #cccccc;
746
- border-left:1px solid #cccccc;
747
- border-bottom:none;
748
- }
749
- #titlebar {
750
- font-size:10pt;
751
- padding:10px;
752
- margin-left:11px;
753
- margin-bottom:0px;
754
- margin-top:10px;
755
- background:#8090a0;
756
- border-top:1px solid #cccccc;
757
- border-left:1px solid #cccccc;
758
- border-bottom:none;
759
- }
760
- #help {
761
- font-size:10pt;
762
- padding:10px;
763
- margin-left:11px;
764
- margin-bottom:0px;
765
- margin-top:0px;
766
- background:#8090a0;
767
- display:none;
768
- border-top:1px solid #cccccc;
769
- border-left:1px solid #cccccc;
770
- border-bottom:none;
771
- }
772
- #sentinel {
773
- height: 400px;
774
- margin-left:11px;
775
- background:#8090a0;
776
- border-top:1px solid #cccccc;
777
- border-left:1px solid #cccccc;
778
- border-bottom:none;
779
- }
780
- input { margin-left:10px; }
781
- --&gt;
782
- &lt;/style&gt;
783
- end_css</span>
784
- <span class="ruby-keyword">end</span></pre>
785
- </div>
786
-
787
- </div>
788
-
789
-
790
-
791
-
792
- </div>
793
-
794
-
795
- <div id="method-i-print_footer" class="method-detail ">
796
-
797
- <div class="method-heading">
798
- <span class="method-name">print_footer</span><span
799
- class="method-args">()</span>
800
-
801
- <span class="method-click-advice">click to toggle source</span>
802
-
803
- </div>
804
-
805
-
806
- <div class="method-description">
807
-
808
-
809
-
810
-
811
-
812
-
813
- <div class="method-source-code" id="print_footer-source">
814
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 206</span>
815
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">print_footer</span>
816
- <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">puts</span> <span class="ruby-string">&#39;&lt;div id=&quot;sentinel&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/body&gt;&lt;/html&gt;&#39;</span>
817
- <span class="ruby-keyword">end</span></pre>
818
- </div>
819
-
820
- </div>
821
-
822
-
823
-
824
-
825
- </div>
826
-
827
-
828
- <div id="method-i-print_header" class="method-detail ">
829
-
830
- <div class="method-heading">
831
- <span class="method-name">print_header</span><span
832
- class="method-args">()</span>
833
-
834
- <span class="method-click-advice">click to toggle source</span>
835
-
836
- </div>
837
-
838
-
839
- <div class="method-description">
840
-
841
-
842
-
843
-
844
-
845
-
846
- <div class="method-source-code" id="print_header-source">
847
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 194</span>
848
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">print_header</span>
849
- <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">puts</span> <span class="ruby-string">&quot;&lt;html&gt;&lt;head&gt;&quot;</span>
850
- <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">puts</span> <span class="ruby-string">&#39;&lt;meta http-equiv=&quot;content-type&quot; content=&quot;text/html; charset=utf-8&quot;&gt;&#39;</span>
851
- <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;&lt;title&gt;#{h title}&lt;/title&gt;&quot;</span>
852
- <span class="ruby-identifier">print_css</span>
853
- <span class="ruby-identifier">print_java_script</span>
854
- <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">puts</span> <span class="ruby-string">&#39;&lt;/head&gt;&lt;body&gt;&lt;div style=&quot;display: inline-block;&quot;&gt;&#39;</span>
855
- <span class="ruby-identifier">print_title_bar</span>
856
- <span class="ruby-identifier">print_commands</span>
857
- <span class="ruby-identifier">print_help</span>
858
- <span class="ruby-keyword">end</span></pre>
859
- </div>
860
-
861
- </div>
862
-
863
-
864
-
865
-
866
- </div>
867
-
868
-
869
- <div id="method-i-print_help" class="method-detail ">
870
-
871
- <div class="method-heading">
872
- <span class="method-name">print_help</span><span
873
- class="method-args">()</span>
874
-
875
- <span class="method-click-advice">click to toggle source</span>
876
-
877
- </div>
878
-
879
-
880
- <div class="method-description">
881
-
882
-
883
-
884
-
885
-
886
-
887
- <div class="method-source-code" id="print_help-source">
888
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 753</span>
889
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">print_help</span>
890
- <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">puts</span> <span class="ruby-value">&lt;&lt;-&#39;end_help&#39;
891
- &lt;div style=&quot;display: none;&quot; id=&quot;help&quot;&gt;
892
- &lt;img src=&quot;empty.png&quot;&gt; Enter a decimal value &lt;i&gt;d&lt;/i&gt; into the threshold field and click &quot;Apply&quot;
893
- to hide all nodes marked with time values lower than &lt;i&gt;d&lt;/i&gt;.&lt;br&gt;
894
- &lt;img src=&quot;empty.png&quot;&gt; Click on &quot;Expand All&quot; for full tree expansion.&lt;br&gt;
895
- &lt;img src=&quot;empty.png&quot;&gt; Click on &quot;Collapse All&quot; to show only top level nodes.&lt;br&gt;
896
- &lt;img src=&quot;empty.png&quot;&gt; Use a, s, d, w as in Quake or Urban Terror to navigate the tree.&lt;br&gt;
897
- &lt;img src=&quot;empty.png&quot;&gt; Use f and b to navigate the tree in preorder forward and backwards.&lt;br&gt;
898
- &lt;img src=&quot;empty.png&quot;&gt; Use x to toggle visibility of a subtree.&lt;br&gt;
899
- &lt;img src=&quot;empty.png&quot;&gt; Use * to expand/collapse a whole subtree.&lt;br&gt;
900
- &lt;img src=&quot;empty.png&quot;&gt; Use h to navigate to thread root.&lt;br&gt;
901
- &lt;img src=&quot;empty.png&quot;&gt; Use n and p to navigate between threads.&lt;br&gt;
902
- &lt;img src=&quot;empty.png&quot;&gt; Click on background to move focus to a subtree.&lt;br&gt;
903
- &lt;/div&gt;
904
- end_help</span>
905
- <span class="ruby-keyword">end</span></pre>
906
- </div>
907
-
908
- </div>
909
-
910
-
911
-
912
-
913
- </div>
914
-
915
-
916
- <div id="method-i-print_java_script" class="method-detail ">
917
-
918
- <div class="method-heading">
919
- <span class="method-name">print_java_script</span><span
920
- class="method-args">()</span>
921
-
922
- <span class="method-click-advice">click to toggle source</span>
923
-
924
- </div>
925
-
926
-
927
- <div class="method-description">
928
-
929
-
930
-
931
-
932
-
933
-
934
- <div class="method-source-code" id="print_java_script-source">
935
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 315</span>
936
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">print_java_script</span>
937
- <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">puts</span> <span class="ruby-value">&lt;&lt;-&#39;end_java_script&#39;
938
- &lt;script type=&quot;text/javascript&quot;&gt;
939
- /*
940
- Copyright (C) 2005,2009 Stefan Kaes
941
- skaes@railsexpress.de
942
- */
943
-
944
- function rootNode() {
945
- return currentThread;
946
- }
947
-
948
- function hideUL(node) {
949
- var lis = node.childNodes
950
- var l = lis.length;
951
- for (var i=0; i &lt; l ; i++ ) {
952
- hideLI(lis[i]);
953
- }
954
- }
955
-
956
- function showUL(node) {
957
- var lis = node.childNodes;
958
- var l = lis.length;
959
- for (var i=0; i &lt; l ; i++ ) {
960
- showLI(lis[i]);
961
- }
962
- }
963
-
964
- function findUlChild(li){
965
- var ul = li.childNodes[2];
966
- while (ul &amp;&amp; ul.nodeName != &quot;UL&quot;) {
967
- ul = ul.nextSibling;
968
- }
969
- return ul;
970
- }
971
-
972
- function isLeafNode(li) {
973
- var img = li.firstChild;
974
- return (img.src.indexOf(&#39;empty.png&#39;) &gt; -1);
975
- }
976
-
977
- function hideLI(li) {
978
- if (isLeafNode(li))
979
- return;
980
-
981
- var img = li.firstChild;
982
- img.src = &#39;plus.png&#39;;
983
-
984
- var ul = findUlChild(li);
985
- if (ul) {
986
- ul.style.display = &#39;none&#39;;
987
- hideUL(ul);
988
- }
989
- }
990
-
991
- function showLI(li) {
992
- if (isLeafNode(li))
993
- return;
994
-
995
- var img = li.firstChild;
996
- img.src = &#39;minus.png&#39;;
997
-
998
- var ul = findUlChild(li);
999
- if (ul) {
1000
- ul.style.display = &#39;block&#39;;
1001
- showUL(ul);
1002
- }
1003
- }
1004
-
1005
- function toggleLI(li) {
1006
- var img = li.firstChild;
1007
- if (img.src.indexOf(&quot;minus.png&quot;)&gt;-1)
1008
- hideLI(li);
1009
- else {
1010
- if (img.src.indexOf(&quot;plus.png&quot;)&gt;-1)
1011
- showLI(li);
1012
- }
1013
- }
1014
-
1015
- function aboveThreshold(text, threshold) {
1016
- var match = text.match(/\d+[.,]\d+/);
1017
- return (match &amp;&amp; parseFloat(match[0].replace(/,/, &#39;.&#39;))&gt;=threshold);
1018
- }
1019
-
1020
- function setThresholdLI(li, threshold) {
1021
- var img = li.firstChild;
1022
- var text = img.nextSibling;
1023
- var ul = findUlChild(li);
1024
-
1025
- var visible = aboveThreshold(text.nodeValue, threshold) ? 1 : 0;
1026
-
1027
- var count = 0;
1028
- if (ul) {
1029
- count = setThresholdUL(ul, threshold);
1030
- }
1031
- if (count&gt;0) {
1032
- img.src = &#39;minus.png&#39;;
1033
- }
1034
- else {
1035
- img.src = &#39;empty.png&#39;;
1036
- }
1037
- if (visible) {
1038
- li.style.display = &#39;block&#39;
1039
- }
1040
- else {
1041
- li.style.display = &#39;none&#39;
1042
- }
1043
- return visible;
1044
- }
1045
-
1046
- function setThresholdUL(node, threshold) {
1047
- var lis = node.childNodes;
1048
- var l = lis.length;
1049
-
1050
- var count = 0;
1051
- for ( var i = 0; i &lt; l ; i++ ) {
1052
- count = count + setThresholdLI(lis[i], threshold);
1053
- }
1054
-
1055
- var visible = (count &gt; 0) ? 1 : 0;
1056
- if (visible) {
1057
- node.style.display = &#39;block&#39;;
1058
- }
1059
- else {
1060
- node.style.display = &#39;none&#39;;
1061
- }
1062
- return visible;
1063
- }
1064
-
1065
- function toggleChildren(img, event) {
1066
- event.cancelBubble=true;
1067
-
1068
- if (img.src.indexOf(&#39;empty.png&#39;) &gt; -1)
1069
- return;
1070
-
1071
- var minus = (img.src.indexOf(&#39;minus.png&#39;) &gt; -1);
1072
-
1073
- if (minus) {
1074
- img.src = &#39;plus.png&#39;;
1075
- }
1076
- else
1077
- img.src = &#39;minus.png&#39;;
1078
-
1079
- var li = img.parentNode;
1080
- var ul = findUlChild(li);
1081
- if (ul) {
1082
- if (minus)
1083
- ul.style.display = &#39;none&#39;;
1084
- else
1085
- ul.style.display = &#39;block&#39;;
1086
- }
1087
- if (minus)
1088
- moveSelectionIfNecessary(li);
1089
- }
1090
-
1091
- function showChildren(li) {
1092
- var img = li.firstChild;
1093
- if (img.src.indexOf(&#39;empty.png&#39;) &gt; -1)
1094
- return;
1095
- img.src = &#39;minus.png&#39;;
1096
-
1097
- var ul = findUlChild(li);
1098
- if (ul) {
1099
- ul.style.display = &#39;block&#39;;
1100
- }
1101
- }
1102
-
1103
- function setThreshold() {
1104
- var tv = document.getElementById(&quot;threshold&quot;).value;
1105
- if (tv.match(/[0-9]+([.,][0-9]+)?/)) {
1106
- var f = parseFloat(tv.replace(/,/, &#39;.&#39;));
1107
- var threads = document.getElementsByName(&quot;thread&quot;);
1108
- var l = threads.length;
1109
- for ( var i = 0; i &lt; l ; i++ ) {
1110
- setThresholdUL(threads[i], f);
1111
- }
1112
- var p = selectedNode;
1113
- while (p &amp;&amp; p.style.display==&#39;none&#39;)
1114
- p=p.parentNode.parentNode;
1115
- if (p &amp;&amp; p.nodeName==&quot;LI&quot;)
1116
- selectNode(p);
1117
- }
1118
- else {
1119
- alert(&quot;Please specify a decimal number as threshold value!&quot;);
1120
- }
1121
- }
1122
-
1123
- function collapseAll(event) {
1124
- event.cancelBubble=true;
1125
- var threads = document.getElementsByName(&quot;thread&quot;);
1126
- var l = threads.length;
1127
- for ( var i = 0; i &lt; l ; i++ ) {
1128
- hideUL(threads[i]);
1129
- }
1130
- selectNode(rootNode(), null);
1131
- }
1132
-
1133
- function expandAll(event) {
1134
- event.cancelBubble=true;
1135
- var threads = document.getElementsByName(&quot;thread&quot;);
1136
- var l = threads.length;
1137
- for ( var i = 0; i &lt; l ; i++ ) {
1138
- showUL(threads[i]);
1139
- }
1140
- }
1141
-
1142
- function toggleHelp(node) {
1143
- var help = document.getElementById(&quot;help&quot;);
1144
- if (node.value == &quot;Show Help&quot;) {
1145
- node.value = &quot;Hide Help&quot;;
1146
- help.style.display = &#39;block&#39;;
1147
- }
1148
- else {
1149
- node.value = &quot;Show Help&quot;;
1150
- help.style.display = &#39;none&#39;;
1151
- }
1152
- }
1153
-
1154
- var selectedNode = null;
1155
- var selectedColor = null;
1156
- var selectedThread = null;
1157
-
1158
- function descendentOf(a,b){
1159
- while (a!=b &amp;&amp; b!=null)
1160
- b=b.parentNode;
1161
- return (a==b);
1162
- }
1163
-
1164
- function moveSelectionIfNecessary(node){
1165
- if (descendentOf(node, selectedNode))
1166
- selectNode(node, null);
1167
- }
1168
-
1169
- function selectNode(node, event) {
1170
- if (event) {
1171
- event.cancelBubble = true;
1172
- thread = findThread(node);
1173
- selectThread(thread);
1174
- }
1175
- if (selectedNode) {
1176
- selectedNode.style.background = selectedColor;
1177
- }
1178
- selectedNode = node;
1179
- selectedColor = node.style.background;
1180
- selectedNode.style.background = &quot;red&quot;;
1181
- selectedNode.scrollIntoView();
1182
- window.scrollBy(0,-400);
1183
- }
1184
-
1185
- function moveUp(){
1186
- var p = selectedNode.previousSibling;
1187
- while (p &amp;&amp; p.style.display == &#39;none&#39;)
1188
- p = p.previousSibling;
1189
- if (p &amp;&amp; p.nodeName == &quot;LI&quot;) {
1190
- selectNode(p, null);
1191
- }
1192
- }
1193
-
1194
- function moveDown(){
1195
- var p = selectedNode.nextSibling;
1196
- while (p &amp;&amp; p.style.display == &#39;none&#39;)
1197
- p = p.nextSibling;
1198
- if (p &amp;&amp; p.nodeName == &quot;LI&quot;) {
1199
- selectNode(p, null);
1200
- }
1201
- }
1202
-
1203
- function moveLeft(){
1204
- var p = selectedNode.parentNode.parentNode;
1205
- if (p &amp;&amp; p.nodeName==&quot;LI&quot;) {
1206
- selectNode(p, null);
1207
- }
1208
- }
1209
-
1210
- function moveRight(){
1211
- if (!isLeafNode(selectedNode)) {
1212
- showChildren(selectedNode);
1213
- var ul = findUlChild(selectedNode);
1214
- if (ul) {
1215
- selectNode(ul.firstChild, null);
1216
- }
1217
- }
1218
- }
1219
-
1220
- function moveForward(){
1221
- if (isLeafNode(selectedNode)) {
1222
- var p = selectedNode;
1223
- while ((p.nextSibling == null || p.nextSibling.style.display==&#39;none&#39;) &amp;&amp; p.nodeName==&quot;LI&quot;) {
1224
- p = p.parentNode.parentNode;
1225
- }
1226
- if (p.nodeName==&quot;LI&quot;)
1227
- selectNode(p.nextSibling, null);
1228
- }
1229
- else {
1230
- moveRight();
1231
- }
1232
- }
1233
-
1234
- function isExpandedNode(li){
1235
- var img = li.firstChild;
1236
- return(img.src.indexOf(&#39;minus.png&#39;)&gt;-1);
1237
- }
1238
-
1239
- function moveBackward(){
1240
- var p = selectedNode;
1241
- var q = p.previousSibling;
1242
- while (q != null &amp;&amp; q.style.display==&#39;none&#39;)
1243
- q = q.previousSibling;
1244
- if (q == null) {
1245
- p = p.parentNode.parentNode;
1246
- } else {
1247
- while (!isLeafNode(q) &amp;&amp; isExpandedNode(q)) {
1248
- q = findUlChild(q).lastChild;
1249
- while (q.style.display==&#39;none&#39;)
1250
- q = q.previousSibling;
1251
- }
1252
- p = q;
1253
- }
1254
- if (p.nodeName==&quot;LI&quot;)
1255
- selectNode(p, null);
1256
- }
1257
-
1258
- function moveHome() {
1259
- selectNode(currentThread);
1260
- }
1261
-
1262
- var currentThreadIndex = null;
1263
-
1264
- function findThread(node){
1265
- while (node &amp;&amp; node.parentNode.nodeName!=&quot;BODY&quot;) {
1266
- node = node.parentNode;
1267
- }
1268
- return node.firstChild;
1269
- }
1270
-
1271
- function selectThread(node){
1272
- var threads = document.getElementsByName(&quot;thread&quot;);
1273
- currentThread = node;
1274
- for (var i=0; i&lt;threads.length; i++) {
1275
- if (threads[i]==currentThread.parentNode)
1276
- currentThreadIndex = i;
1277
- }
1278
- }
1279
-
1280
- function nextThread(){
1281
- var threads = document.getElementsByName(&quot;thread&quot;);
1282
- if (currentThreadIndex==threads.length-1)
1283
- currentThreadIndex = 0;
1284
- else
1285
- currentThreadIndex += 1
1286
- currentThread = threads[currentThreadIndex].firstChild;
1287
- selectNode(currentThread, null);
1288
- }
1289
-
1290
- function previousThread(){
1291
- var threads = document.getElementsByName(&quot;thread&quot;);
1292
- if (currentThreadIndex==0)
1293
- currentThreadIndex = threads.length-1;
1294
- else
1295
- currentThreadIndex -= 1
1296
- currentThread = threads[currentThreadIndex].firstChild;
1297
- selectNode(currentThread, null);
1298
- }
1299
-
1300
- function switchThread(node, event){
1301
- event.cancelBubble = true;
1302
- selectThread(node.nextSibling.firstChild);
1303
- selectNode(currentThread, null);
1304
- }
1305
-
1306
- function handleKeyEvent(event){
1307
- var code = event.charCode ? event.charCode : event.keyCode;
1308
- var str = String.fromCharCode(code);
1309
- switch (str) {
1310
- case &quot;a&quot;: moveLeft(); break;
1311
- case &quot;s&quot;: moveDown(); break;
1312
- case &quot;d&quot;: moveRight(); break;
1313
- case &quot;w&quot;: moveUp(); break;
1314
- case &quot;f&quot;: moveForward(); break;
1315
- case &quot;b&quot;: moveBackward(); break;
1316
- case &quot;x&quot;: toggleChildren(selectedNode.firstChild, event); break;
1317
- case &quot;*&quot;: toggleLI(selectedNode); break;
1318
- case &quot;n&quot;: nextThread(); break;
1319
- case &quot;h&quot;: moveHome(); break;
1320
- case &quot;p&quot;: previousThread(); break;
1321
- }
1322
- }
1323
- document.onkeypress=function(event){ handleKeyEvent(event) };
1324
-
1325
- window.onload=function(){
1326
- var images = document.getElementsByTagName(&quot;img&quot;);
1327
- for (var i=0; i&lt;images.length; i++) {
1328
- var img = images[i];
1329
- if (img.className == &quot;toggle&quot;) {
1330
- img.onclick = function(event){ toggleChildren(this, event); };
1331
- }
1332
- }
1333
- var divs = document.getElementsByTagName(&quot;div&quot;);
1334
- for (i=0; i&lt;divs.length; i++) {
1335
- var div = divs[i];
1336
- if (div.className == &quot;thread&quot;)
1337
- div.onclick = function(event){ switchThread(this, event) };
1338
- }
1339
- var lis = document.getElementsByTagName(&quot;li&quot;);
1340
- for (var i=0; i&lt;lis.length; i++) {
1341
- lis[i].onclick = function(event){ selectNode(this, event); };
1342
- }
1343
- var threads = document.getElementsByName(&quot;thread&quot;);
1344
- currentThreadIndex = 0;
1345
- currentThread = threads[0].firstChild;
1346
- selectNode(currentThread, null);
1347
- }
1348
- &lt;/script&gt;
1349
- end_java_script</span>
1350
- <span class="ruby-keyword">end</span></pre>
1351
- </div>
1352
-
1353
- </div>
1354
-
1355
-
1356
-
1357
-
1358
- </div>
1359
-
1360
-
1361
- <div id="method-i-print_stack" class="method-detail ">
1362
-
1363
- <div class="method-heading">
1364
- <span class="method-name">print_stack</span><span
1365
- class="method-args">(call_info, parent_time)</span>
1366
-
1367
- <span class="method-click-advice">click to toggle source</span>
1368
-
1369
- </div>
1370
-
1371
-
1372
- <div class="method-description">
1373
-
1374
-
1375
-
1376
-
1377
-
1378
-
1379
- <div class="method-source-code" id="print_stack-source">
1380
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 74</span>
1381
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">print_stack</span>(<span class="ruby-identifier">call_info</span>, <span class="ruby-identifier">parent_time</span>)
1382
- <span class="ruby-identifier">total_time</span> = <span class="ruby-identifier">call_info</span>.<span class="ruby-identifier">total_time</span>
1383
- <span class="ruby-identifier">percent_parent</span> = (<span class="ruby-identifier">total_time</span><span class="ruby-operator">/</span><span class="ruby-identifier">parent_time</span>)<span class="ruby-operator">*</span><span class="ruby-value">100</span>
1384
- <span class="ruby-identifier">percent_total</span> = (<span class="ruby-identifier">total_time</span><span class="ruby-operator">/</span><span class="ruby-ivar">@overall_time</span>)<span class="ruby-operator">*</span><span class="ruby-value">100</span>
1385
- <span class="ruby-keyword">return</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">percent_total</span> <span class="ruby-operator">&gt;</span> <span class="ruby-identifier">min_percent</span>
1386
- <span class="ruby-identifier">color</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">color</span>(<span class="ruby-identifier">percent_total</span>)
1387
- <span class="ruby-identifier">kids</span> = <span class="ruby-identifier">call_info</span>.<span class="ruby-identifier">children</span>
1388
- <span class="ruby-identifier">visible</span> = <span class="ruby-identifier">percent_total</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-identifier">threshold</span>
1389
- <span class="ruby-identifier">expanded</span> = <span class="ruby-identifier">percent_total</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-identifier">expansion</span>
1390
- <span class="ruby-identifier">display</span> = <span class="ruby-identifier">visible</span> <span class="ruby-operator">?</span> <span class="ruby-string">&quot;block&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-string">&quot;none&quot;</span>
1391
- <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">print</span> <span class="ruby-node">&quot;&lt;li class=\&quot;color#{color}\&quot; style=\&quot;display:#{display}\&quot;&gt;&quot;</span>
1392
- <span class="ruby-keyword">if</span> <span class="ruby-identifier">kids</span>.<span class="ruby-identifier">empty?</span>
1393
- <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">print</span> <span class="ruby-string">&quot;&lt;img src=\&quot;empty.png\&quot;&gt;&quot;</span>
1394
- <span class="ruby-keyword">else</span>
1395
- <span class="ruby-identifier">visible_children</span> = <span class="ruby-identifier">kids</span>.<span class="ruby-identifier">any?</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">ci</span><span class="ruby-operator">|</span> (<span class="ruby-identifier">ci</span>.<span class="ruby-identifier">total_time</span><span class="ruby-operator">/</span><span class="ruby-ivar">@overall_time</span>)<span class="ruby-operator">*</span><span class="ruby-value">100</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-identifier">threshold</span>}
1396
- <span class="ruby-identifier">image</span> = <span class="ruby-identifier">visible_children</span> <span class="ruby-operator">?</span> (<span class="ruby-identifier">expanded</span> <span class="ruby-operator">?</span> <span class="ruby-string">&quot;minus&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-string">&quot;plus&quot;</span>) <span class="ruby-operator">:</span> <span class="ruby-string">&quot;empty&quot;</span>
1397
- <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">print</span> <span class="ruby-node">&quot;&lt;img class=\&quot;toggle\&quot; src=\&quot;#{image}.png\&quot;&gt;&quot;</span>
1398
- <span class="ruby-keyword">end</span>
1399
- <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">printf</span> <span class="ruby-string">&quot; %4.2f%% (%4.2f%%) %s %s\n&quot;</span>, <span class="ruby-identifier">percent_total</span>, <span class="ruby-identifier">percent_parent</span>, <span class="ruby-identifier">link</span>(<span class="ruby-identifier">call_info</span>), <span class="ruby-identifier">graph_link</span>(<span class="ruby-identifier">call_info</span>)
1400
- <span class="ruby-keyword">unless</span> <span class="ruby-identifier">kids</span>.<span class="ruby-identifier">empty?</span>
1401
- <span class="ruby-keyword">if</span> <span class="ruby-identifier">expanded</span>
1402
- <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">print</span> <span class="ruby-string">&quot;&lt;ul&gt;&quot;</span>
1403
- <span class="ruby-keyword">else</span>
1404
- <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">print</span> <span class="ruby-string">&#39;&lt;ul style=&quot;display:none&quot;&gt;&#39;</span>
1405
- <span class="ruby-keyword">end</span>
1406
- <span class="ruby-identifier">kids</span>.<span class="ruby-identifier">sort_by</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">c</span><span class="ruby-operator">|</span> <span class="ruby-operator">-</span><span class="ruby-identifier">c</span>.<span class="ruby-identifier">total_time</span>}.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">callinfo</span><span class="ruby-operator">|</span>
1407
- <span class="ruby-identifier">print_stack</span> <span class="ruby-identifier">callinfo</span>, <span class="ruby-identifier">total_time</span>
1408
- <span class="ruby-keyword">end</span>
1409
- <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">print</span> <span class="ruby-string">&quot;&lt;/ul&gt;&quot;</span>
1410
- <span class="ruby-keyword">end</span>
1411
- <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">print</span> <span class="ruby-string">&quot;&lt;/li&gt;&quot;</span>
1412
- <span class="ruby-keyword">end</span></pre>
1413
- </div>
1414
-
1415
- </div>
1416
-
1417
-
1418
-
1419
-
1420
- </div>
1421
-
1422
-
1423
- <div id="method-i-print_title_bar" class="method-detail ">
1424
-
1425
- <div class="method-heading">
1426
- <span class="method-name">print_title_bar</span><span
1427
- class="method-args">()</span>
1428
-
1429
- <span class="method-click-advice">click to toggle source</span>
1430
-
1431
- </div>
1432
-
1433
-
1434
- <div class="method-description">
1435
-
1436
-
1437
-
1438
-
1439
-
1440
-
1441
- <div class="method-source-code" id="print_title_bar-source">
1442
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 731</span>
1443
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">print_title_bar</span>
1444
- <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">puts</span> <span class="ruby-value">&lt;&lt;-&quot;end_title_bar&quot;
1445
- &lt;div id=&quot;titlebar&quot;&gt;
1446
- Call tree for application &lt;b&gt;#{h application} #{h arguments}&lt;/b&gt;&lt;br/&gt;
1447
- Generated on #{Time.now} with options #{h @options.inspect}&lt;br/&gt;
1448
- &lt;/div&gt;
1449
- end_title_bar</span>
1450
- <span class="ruby-keyword">end</span></pre>
1451
- </div>
1452
-
1453
- </div>
1454
-
1455
-
1456
-
1457
-
1458
- </div>
1459
-
1460
-
1461
- <div id="method-i-sum" class="method-detail ">
1462
-
1463
- <div class="method-heading">
1464
- <span class="method-name">sum</span><span
1465
- class="method-args">(a)</span>
1466
-
1467
- <span class="method-click-advice">click to toggle source</span>
1468
-
1469
- </div>
1470
-
1471
-
1472
- <div class="method-description">
1473
-
1474
-
1475
-
1476
-
1477
-
1478
-
1479
- <div class="method-source-code" id="sum-source">
1480
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 141</span>
1481
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">sum</span>(<span class="ruby-identifier">a</span>)
1482
- <span class="ruby-identifier">a</span>.<span class="ruby-identifier">inject</span>(<span class="ruby-value">0.0</span>){<span class="ruby-operator">|</span><span class="ruby-identifier">s</span>,<span class="ruby-identifier">t</span><span class="ruby-operator">|</span> <span class="ruby-identifier">s</span><span class="ruby-operator">+=</span><span class="ruby-identifier">t</span>}
1483
- <span class="ruby-keyword">end</span></pre>
1484
- </div>
1485
-
1486
- </div>
1487
-
1488
-
1489
-
1490
-
1491
- </div>
1492
-
1493
-
1494
- <div id="method-i-threshold" class="method-detail ">
1495
-
1496
- <div class="method-heading">
1497
- <span class="method-name">threshold</span><span
1498
- class="method-args">()</span>
1499
-
1500
- <span class="method-click-advice">click to toggle source</span>
1501
-
1502
- </div>
1503
-
1504
-
1505
- <div class="method-description">
1506
-
1507
-
1508
-
1509
-
1510
-
1511
-
1512
- <div class="method-source-code" id="threshold-source">
1513
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 174</span>
1514
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">threshold</span>
1515
- <span class="ruby-ivar">@options</span>[<span class="ruby-value">:threshold</span>] <span class="ruby-operator">||</span> <span class="ruby-value">1.0</span>
1516
- <span class="ruby-keyword">end</span></pre>
1517
- </div>
1518
-
1519
- </div>
1520
-
1521
-
1522
-
1523
-
1524
- </div>
1525
-
1526
-
1527
- <div id="method-i-title" class="method-detail ">
1528
-
1529
- <div class="method-heading">
1530
- <span class="method-name">title</span><span
1531
- class="method-args">()</span>
1532
-
1533
- <span class="method-click-advice">click to toggle source</span>
1534
-
1535
- </div>
1536
-
1537
-
1538
- <div class="method-description">
1539
-
1540
-
1541
-
1542
-
1543
-
1544
-
1545
- <div class="method-source-code" id="title-source">
1546
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 170</span>
1547
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">title</span>
1548
- <span class="ruby-ivar">@title</span> <span class="ruby-operator">||=</span> <span class="ruby-ivar">@options</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value">:title</span>) <span class="ruby-operator">||</span> <span class="ruby-string">&quot;ruby-prof call tree&quot;</span>
1549
- <span class="ruby-keyword">end</span></pre>
1550
- </div>
1551
-
1552
- </div>
1553
-
1554
-
1555
-
1556
-
1557
- </div>
1558
-
1559
-
1560
- <div id="method-i-total_time" class="method-detail ">
1561
-
1562
- <div class="method-heading">
1563
- <span class="method-name">total_time</span><span
1564
- class="method-args">(call_infos)</span>
1565
-
1566
- <span class="method-click-advice">click to toggle source</span>
1567
-
1568
- </div>
1569
-
1570
-
1571
- <div class="method-description">
1572
-
1573
-
1574
-
1575
-
1576
-
1577
-
1578
- <div class="method-source-code" id="total_time-source">
1579
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 137</span>
1580
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">total_time</span>(<span class="ruby-identifier">call_infos</span>)
1581
- <span class="ruby-identifier">sum</span>(<span class="ruby-identifier">call_infos</span>.<span class="ruby-identifier">map</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">ci</span><span class="ruby-operator">|</span> <span class="ruby-identifier">ci</span>.<span class="ruby-identifier">total_time</span>})
1582
- <span class="ruby-keyword">end</span></pre>
1583
- </div>
1584
-
1585
- </div>
1586
-
1587
-
1588
-
1589
-
1590
- </div>
1591
-
1592
-
1593
- </section>
1594
-
1595
- </section>
1596
- </main>
1597
-
1598
-
1599
- <footer id="validator-badges" role="contentinfo">
1600
- <p><a href="http://validator.w3.org/check/referer">Validate</a>
1601
- <p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.0.
1602
- <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
1603
- </footer>
1604
-