ruby-prof 0.15.7 → 0.15.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES +5 -0
  3. data/doc/created.rid +4 -4
  4. data/doc/js/search_index.js.gz +0 -0
  5. data/examples/graph.dot +53 -75
  6. data/examples/multi.flat.txt +21 -21
  7. data/examples/multi.graph.html +693 -839
  8. data/examples/multi.grind.dat +93 -173
  9. data/examples/multi.stack.html +411 -437
  10. data/examples/stack.html +411 -437
  11. data/lib/ruby-prof/assets/call_stack_printer.css.html +117 -0
  12. data/lib/ruby-prof/assets/call_stack_printer.js.html +385 -0
  13. data/lib/ruby-prof/assets/call_stack_printer.png +0 -0
  14. data/lib/ruby-prof/printers/flat_printer.rb +1 -1
  15. data/lib/ruby-prof/printers/graph_html_printer.rb +43 -48
  16. data/lib/ruby-prof/version.rb +1 -1
  17. data/ruby-prof.gemspec +1 -1
  18. data/test/measure_memory_test.rb +5 -3
  19. data/test/printers_test.rb +1 -1
  20. metadata +5 -58
  21. data/doc/LICENSE.html +0 -114
  22. data/doc/README_rdoc.html +0 -592
  23. data/doc/Rack.html +0 -95
  24. data/doc/Rack/RubyProf.html +0 -264
  25. data/doc/RubyProf.html +0 -961
  26. data/doc/RubyProf/AbstractPrinter.html +0 -546
  27. data/doc/RubyProf/AggregateCallInfo.html +0 -537
  28. data/doc/RubyProf/CallInfo.html +0 -716
  29. data/doc/RubyProf/CallInfoPrinter.html +0 -120
  30. data/doc/RubyProf/CallInfoVisitor.html +0 -198
  31. data/doc/RubyProf/CallStackPrinter.html +0 -1121
  32. data/doc/RubyProf/CallTreePrinter.html +0 -359
  33. data/doc/RubyProf/Cmd.html +0 -631
  34. data/doc/RubyProf/DotPrinter.html +0 -257
  35. data/doc/RubyProf/FlatPrinter.html +0 -163
  36. data/doc/RubyProf/FlatPrinterWithLineNumbers.html +0 -208
  37. data/doc/RubyProf/GraphHtmlPrinter.html +0 -579
  38. data/doc/RubyProf/GraphPrinter.html +0 -139
  39. data/doc/RubyProf/MethodInfo.html +0 -885
  40. data/doc/RubyProf/MultiPrinter.html +0 -358
  41. data/doc/RubyProf/Profile.html +0 -713
  42. data/doc/RubyProf/ProfileTask.html +0 -490
  43. data/doc/RubyProf/Thread.html +0 -303
  44. data/doc/examples/flat_txt.html +0 -149
  45. data/doc/examples/graph_html.html +0 -850
  46. data/doc/examples/graph_txt.html +0 -274
  47. data/doc/images/add.png +0 -0
  48. data/doc/images/arrow_up.png +0 -0
  49. data/doc/images/brick.png +0 -0
  50. data/doc/images/brick_link.png +0 -0
  51. data/doc/images/bug.png +0 -0
  52. data/doc/images/bullet_black.png +0 -0
  53. data/doc/images/bullet_toggle_minus.png +0 -0
  54. data/doc/images/bullet_toggle_plus.png +0 -0
  55. data/doc/images/date.png +0 -0
  56. data/doc/images/delete.png +0 -0
  57. data/doc/images/find.png +0 -0
  58. data/doc/images/macFFBgHack.png +0 -0
  59. data/doc/images/package.png +0 -0
  60. data/doc/images/page_green.png +0 -0
  61. data/doc/images/page_white_text.png +0 -0
  62. data/doc/images/page_white_width.png +0 -0
  63. data/doc/images/plugin.png +0 -0
  64. data/doc/images/ruby.png +0 -0
  65. data/doc/images/tag_blue.png +0 -0
  66. data/doc/images/tag_green.png +0 -0
  67. data/doc/images/transparent.png +0 -0
  68. data/doc/images/wrench.png +0 -0
  69. data/doc/images/wrench_orange.png +0 -0
  70. data/doc/images/zoom.png +0 -0
  71. data/doc/index.html +0 -618
  72. data/doc/table_of_contents.html +0 -934
  73. data/examples/empty.png +0 -0
  74. data/examples/graph.png +0 -0
  75. data/examples/minus.png +0 -0
  76. data/examples/plus.png +0 -0
@@ -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 into
80
- 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,198 +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">(call_infos)</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 20</span>
131
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">call_infos</span>)
132
- <span class="ruby-ivar">@call_infos</span> = <span class="ruby-constant">CallInfo</span>.<span class="ruby-identifier">roots_of</span>(<span class="ruby-identifier">call_infos</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 24</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">@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>
174
- <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>)
175
- <span class="ruby-keyword">end</span>
176
- <span class="ruby-keyword">end</span></pre>
177
- </div>
178
-
179
- </div>
180
-
181
-
182
-
183
-
184
- </div>
185
-
186
-
187
- </section>
188
-
189
- </section>
190
- </main>
191
-
192
-
193
- <footer id="validator-badges" role="contentinfo">
194
- <p><a href="http://validator.w3.org/check/referer">Validate</a>
195
- <p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.0.
196
- <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
197
- </footer>
198
-
@@ -1,1121 +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-base64_image">#base64_image</a>
89
-
90
- <li ><a href="#method-i-color">#color</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-open_asset">#open_asset</a>
105
-
106
- <li ><a href="#method-i-print">#print</a>
107
-
108
- <li ><a href="#method-i-print_commands">#print_commands</a>
109
-
110
- <li ><a href="#method-i-print_css">#print_css</a>
111
-
112
- <li ><a href="#method-i-print_footer">#print_footer</a>
113
-
114
- <li ><a href="#method-i-print_header">#print_header</a>
115
-
116
- <li ><a href="#method-i-print_help">#print_help</a>
117
-
118
- <li ><a href="#method-i-print_java_script">#print_java_script</a>
119
-
120
- <li ><a href="#method-i-print_stack">#print_stack</a>
121
-
122
- <li ><a href="#method-i-print_title_bar">#print_title_bar</a>
123
-
124
- <li ><a href="#method-i-sum">#sum</a>
125
-
126
- <li ><a href="#method-i-threshold">#threshold</a>
127
-
128
- <li ><a href="#method-i-title">#title</a>
129
-
130
- <li ><a href="#method-i-total_time">#total_time</a>
131
-
132
- </ul>
133
- </div>
134
-
135
- </div>
136
- </nav>
137
-
138
- <main role="main" aria-labelledby="class-RubyProf::CallStackPrinter">
139
- <h1 id="class-RubyProf::CallStackPrinter" class="class">
140
- class RubyProf::CallStackPrinter
141
- </h1>
142
-
143
- <section class="description">
144
-
145
- <p>prints a HTML visualization of the call tree</p>
146
-
147
- </section>
148
-
149
-
150
-
151
-
152
- <section id="5Buntitled-5D" class="documentation-section">
153
-
154
-
155
-
156
-
157
-
158
-
159
-
160
-
161
-
162
- <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
163
- <header>
164
- <h3>Public Instance Methods</h3>
165
- </header>
166
-
167
-
168
- <div id="method-i-application" class="method-detail ">
169
-
170
- <div class="method-heading">
171
- <span class="method-name">application</span><span
172
- class="method-args">()</span>
173
-
174
- <span class="method-click-advice">click to toggle source</span>
175
-
176
- </div>
177
-
178
-
179
- <div class="method-description">
180
-
181
-
182
-
183
-
184
-
185
-
186
- <div class="method-source-code" id="application-source">
187
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 162</span>
188
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">application</span>
189
- <span class="ruby-ivar">@options</span>[<span class="ruby-value">:application</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">$PROGRAM_NAME</span>
190
- <span class="ruby-keyword">end</span></pre>
191
- </div>
192
-
193
- </div>
194
-
195
-
196
-
197
-
198
- </div>
199
-
200
-
201
- <div id="method-i-arguments" class="method-detail ">
202
-
203
- <div class="method-heading">
204
- <span class="method-name">arguments</span><span
205
- class="method-args">()</span>
206
-
207
- <span class="method-click-advice">click to toggle source</span>
208
-
209
- </div>
210
-
211
-
212
- <div class="method-description">
213
-
214
-
215
-
216
-
217
-
218
-
219
- <div class="method-source-code" id="arguments-source">
220
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 166</span>
221
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">arguments</span>
222
- <span class="ruby-constant">ARGV</span>.<span class="ruby-identifier">join</span>(<span class="ruby-string">&#39; &#39;</span>)
223
- <span class="ruby-keyword">end</span></pre>
224
- </div>
225
-
226
- </div>
227
-
228
-
229
-
230
-
231
- </div>
232
-
233
-
234
- <div id="method-i-base64_image" class="method-detail ">
235
-
236
- <div class="method-heading">
237
- <span class="method-name">base64_image</span><span
238
- class="method-args">()</span>
239
-
240
- <span class="method-click-advice">click to toggle source</span>
241
-
242
- </div>
243
-
244
-
245
- <div class="method-description">
246
-
247
-
248
-
249
-
250
-
251
-
252
- <div class="method-source-code" id="base64_image-source">
253
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 208</span>
254
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">base64_image</span>
255
- <span class="ruby-identifier">file</span> = <span class="ruby-identifier">open_asset</span>(<span class="ruby-string">&#39;call_stack_printer.png&#39;</span>)
256
- <span class="ruby-constant">Base64</span>.<span class="ruby-identifier">encode64</span>(<span class="ruby-identifier">file</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp">/\n/</span>, <span class="ruby-string">&#39;&#39;</span>)
257
- <span class="ruby-keyword">end</span></pre>
258
- </div>
259
-
260
- </div>
261
-
262
-
263
-
264
-
265
- </div>
266
-
267
-
268
- <div id="method-i-color" class="method-detail ">
269
-
270
- <div class="method-heading">
271
- <span class="method-name">color</span><span
272
- class="method-args">(p)</span>
273
-
274
- <span class="method-click-advice">click to toggle source</span>
275
-
276
- </div>
277
-
278
-
279
- <div class="method-description">
280
-
281
-
282
-
283
-
284
-
285
-
286
- <div class="method-source-code" id="color-source">
287
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 149</span>
288
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">color</span>(<span class="ruby-identifier">p</span>)
289
- <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>
290
- <span class="ruby-keyword">when</span> <span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-value">5</span>
291
- <span class="ruby-string">&quot;01&quot;</span>
292
- <span class="ruby-keyword">when</span> <span class="ruby-value">5</span><span class="ruby-operator">..</span><span class="ruby-value">10</span>
293
- <span class="ruby-string">&quot;05&quot;</span>
294
- <span class="ruby-keyword">when</span> <span class="ruby-value">100</span>
295
- <span class="ruby-string">&quot;9&quot;</span>
296
- <span class="ruby-keyword">else</span>
297
- <span class="ruby-node">&quot;#{i/10}&quot;</span>
298
- <span class="ruby-keyword">end</span>
299
- <span class="ruby-keyword">end</span></pre>
300
- </div>
301
-
302
- </div>
303
-
304
-
305
-
306
-
307
- </div>
308
-
309
-
310
- <div id="method-i-dump" class="method-detail ">
311
-
312
- <div class="method-heading">
313
- <span class="method-name">dump</span><span
314
- class="method-args">(ci)</span>
315
-
316
- <span class="method-click-advice">click to toggle source</span>
317
-
318
- </div>
319
-
320
-
321
- <div class="method-description">
322
-
323
-
324
-
325
-
326
-
327
-
328
- <div class="method-source-code" id="dump-source">
329
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 145</span>
330
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">dump</span>(<span class="ruby-identifier">ci</span>)
331
- <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>
332
- <span class="ruby-keyword">end</span></pre>
333
- </div>
334
-
335
- </div>
336
-
337
-
338
-
339
-
340
- </div>
341
-
342
-
343
- <div id="method-i-expansion" class="method-detail ">
344
-
345
- <div class="method-heading">
346
- <span class="method-name">expansion</span><span
347
- class="method-args">()</span>
348
-
349
- <span class="method-click-advice">click to toggle source</span>
350
-
351
- </div>
352
-
353
-
354
- <div class="method-description">
355
-
356
-
357
-
358
-
359
-
360
-
361
- <div class="method-source-code" id="expansion-source">
362
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 178</span>
363
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">expansion</span>
364
- <span class="ruby-ivar">@options</span>[<span class="ruby-value">:expansion</span>] <span class="ruby-operator">||</span> <span class="ruby-value">10.0</span>
365
- <span class="ruby-keyword">end</span></pre>
366
- </div>
367
-
368
- </div>
369
-
370
-
371
-
372
-
373
- </div>
374
-
375
-
376
- <div id="method-i-graph_link" class="method-detail ">
377
-
378
- <div class="method-heading">
379
- <span class="method-name">graph_link</span><span
380
- class="method-args">(call_info)</span>
381
-
382
- <span class="method-click-advice">click to toggle source</span>
383
-
384
- </div>
385
-
386
-
387
- <div class="method-description">
388
-
389
-
390
-
391
-
392
-
393
-
394
- <div class="method-source-code" id="graph_link-source">
395
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 126</span>
396
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">graph_link</span>(<span class="ruby-identifier">call_info</span>)
397
- <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>}
398
- <span class="ruby-identifier">href</span> = <span class="ruby-node">&quot;#{@graph_html}##{method_href(call_info.target)}&quot;</span>
399
- <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>
400
- <span class="ruby-node">&quot;[#{call_info.called} calls, #{totals} total]&quot;</span>
401
- <span class="ruby-keyword">end</span></pre>
402
- </div>
403
-
404
- </div>
405
-
406
-
407
-
408
-
409
- </div>
410
-
411
-
412
- <div id="method-i-link" class="method-detail ">
413
-
414
- <div class="method-heading">
415
- <span class="method-name">link</span><span
416
- class="method-args">(call_info)</span>
417
-
418
- <span class="method-click-advice">click to toggle source</span>
419
-
420
- </div>
421
-
422
-
423
- <div class="method-description">
424
-
425
-
426
-
427
-
428
-
429
-
430
- <div class="method-source-code" id="link-source">
431
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 112</span>
432
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">link</span>(<span class="ruby-identifier">call_info</span>)
433
- <span class="ruby-identifier">method</span> = <span class="ruby-identifier">call_info</span>.<span class="ruby-identifier">target</span>
434
- <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>)
435
- <span class="ruby-keyword">if</span> <span class="ruby-identifier">file</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/\/ruby_runtime$/</span>
436
- <span class="ruby-identifier">h</span>(<span class="ruby-identifier">name</span>(<span class="ruby-identifier">call_info</span>))
437
- <span class="ruby-keyword">else</span>
438
- <span class="ruby-keyword">if</span> <span class="ruby-constant">RUBY_PLATFORM</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">/darwin/</span>
439
- <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>
440
- <span class="ruby-keyword">else</span>
441
- <span class="ruby-node">&quot;&lt;a href=\&quot;file://#{file}##{method.line}\&quot;&gt;#{h(name(call_info))}&lt;/a&gt;&quot;</span>
442
- <span class="ruby-keyword">end</span>
443
- <span class="ruby-keyword">end</span>
444
- <span class="ruby-keyword">end</span></pre>
445
- </div>
446
-
447
- </div>
448
-
449
-
450
-
451
-
452
- </div>
453
-
454
-
455
- <div id="method-i-method_href" class="method-detail ">
456
-
457
- <div class="method-heading">
458
- <span class="method-name">method_href</span><span
459
- class="method-args">(method)</span>
460
-
461
- <span class="method-click-advice">click to toggle source</span>
462
-
463
- </div>
464
-
465
-
466
- <div class="method-description">
467
-
468
-
469
-
470
-
471
-
472
-
473
- <div class="method-source-code" id="method_href-source">
474
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 133</span>
475
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">method_href</span>(<span class="ruby-identifier">method</span>)
476
- <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>)
477
- <span class="ruby-keyword">end</span></pre>
478
- </div>
479
-
480
- </div>
481
-
482
-
483
-
484
-
485
- </div>
486
-
487
-
488
- <div id="method-i-name" class="method-detail ">
489
-
490
- <div class="method-heading">
491
- <span class="method-name">name</span><span
492
- class="method-args">(call_info)</span>
493
-
494
- <span class="method-click-advice">click to toggle source</span>
495
-
496
- </div>
497
-
498
-
499
- <div class="method-description">
500
-
501
-
502
-
503
-
504
-
505
-
506
- <div class="method-source-code" id="name-source">
507
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 107</span>
508
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">name</span>(<span class="ruby-identifier">call_info</span>)
509
- <span class="ruby-identifier">method</span> = <span class="ruby-identifier">call_info</span>.<span class="ruby-identifier">target</span>
510
- <span class="ruby-identifier">method</span>.<span class="ruby-identifier">full_name</span>
511
- <span class="ruby-keyword">end</span></pre>
512
- </div>
513
-
514
- </div>
515
-
516
-
517
-
518
-
519
- </div>
520
-
521
-
522
- <div id="method-i-open_asset" class="method-detail ">
523
-
524
- <div class="method-heading">
525
- <span class="method-name">open_asset</span><span
526
- class="method-args">(file)</span>
527
-
528
- <span class="method-click-advice">click to toggle source</span>
529
-
530
- </div>
531
-
532
-
533
- <div class="method-description">
534
-
535
-
536
-
537
-
538
-
539
-
540
- <div class="method-source-code" id="open_asset-source">
541
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 198</span>
542
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">open_asset</span>(<span class="ruby-identifier">file</span>)
543
- <span class="ruby-identifier">path</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-string">&#39;../../assets&#39;</span>, <span class="ruby-keyword">__FILE__</span>), <span class="ruby-identifier">file</span>)
544
- <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">path</span>, <span class="ruby-string">&#39;rb&#39;</span>).<span class="ruby-identifier">read</span>
545
- <span class="ruby-keyword">end</span></pre>
546
- </div>
547
-
548
- </div>
549
-
550
-
551
-
552
-
553
- </div>
554
-
555
-
556
- <div id="method-i-print" class="method-detail ">
557
-
558
- <div class="method-heading">
559
- <span class="method-name">print</span><span
560
- class="method-args">(output = STDOUT, options = {})</span>
561
-
562
- <span class="method-click-advice">click to toggle source</span>
563
-
564
- </div>
565
-
566
-
567
- <div class="method-description">
568
-
569
- <p>Specify print options.</p>
570
-
571
- <p>options - Hash table</p>
572
-
573
- <pre>:min_percent - Number 0 to 100 that specifes the minimum
574
- %self (the methods self time divided by the
575
- overall total time) that a method must take
576
- for it to be printed out in the report.
577
- Default value is 0.
578
-
579
- :print_file - True or false. Specifies if a method&#39;s source
580
- file should be printed. Default value if false.
581
-
582
- :threshold - a float from 0 to 100 that sets the threshold of
583
- results displayed.
584
- Default value is 1.0
585
-
586
- :title - a String to overide the default &quot;ruby-prof call tree&quot;
587
- title of the report.
588
-
589
- :expansion - a float from 0 to 100 that sets the threshold of
590
- results that are expanded, if the percent_total
591
- exceeds it.
592
- Default value is 10.0
593
-
594
- :application - a String to overide the name of the application,
595
- as it appears on the report.</pre>
596
-
597
-
598
-
599
-
600
- <div class="method-source-code" id="print-source">
601
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 38</span>
602
- <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> = {})
603
- <span class="ruby-ivar">@output</span> = <span class="ruby-identifier">output</span>
604
- <span class="ruby-identifier">setup_options</span>(<span class="ruby-identifier">options</span>)
605
- <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>)
606
- <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>
607
- <span class="ruby-keyword">end</span>
608
-
609
- <span class="ruby-identifier">print_header</span>
610
-
611
- <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>
612
- <span class="ruby-identifier">val</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">thread</span>.<span class="ruby-identifier">total_time</span>
613
- <span class="ruby-keyword">end</span>
614
-
615
- <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>
616
- <span class="ruby-ivar">@current_thread_id</span> = <span class="ruby-identifier">thread</span>.<span class="ruby-identifier">fiber_id</span>
617
- <span class="ruby-ivar">@overall_time</span> = <span class="ruby-identifier">thread</span>.<span class="ruby-identifier">total_time</span>
618
- <span class="ruby-identifier">thread_info</span> = <span class="ruby-node">&quot;Thread: #{thread.id}&quot;</span>
619
- <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>
620
- <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>
621
- <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>
622
- <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>
623
- <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>
624
- <span class="ruby-comment"># $stderr.print m.dump</span>
625
- <span class="ruby-keyword">next</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">m</span>.<span class="ruby-identifier">root?</span>
626
- <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>
627
- <span class="ruby-keyword">next</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">ci</span>.<span class="ruby-identifier">root?</span>
628
- <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>
629
- <span class="ruby-keyword">end</span>
630
- <span class="ruby-keyword">end</span>
631
- <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">print</span> <span class="ruby-string">&quot;&lt;/ul&gt;&quot;</span>
632
- <span class="ruby-keyword">end</span>
633
-
634
- <span class="ruby-identifier">print_footer</span>
635
-
636
- <span class="ruby-keyword">end</span></pre>
637
- </div>
638
-
639
- </div>
640
-
641
-
642
-
643
-
644
- </div>
645
-
646
-
647
- <div id="method-i-print_commands" class="method-detail ">
648
-
649
- <div class="method-heading">
650
- <span class="method-name">print_commands</span><span
651
- class="method-args">()</span>
652
-
653
- <span class="method-click-advice">click to toggle source</span>
654
-
655
- </div>
656
-
657
-
658
- <div class="method-description">
659
-
660
-
661
-
662
-
663
-
664
-
665
- <div class="method-source-code" id="print_commands-source">
666
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 227</span>
667
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">print_commands</span>
668
- <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">puts</span> <span class="ruby-value">&lt;&lt;-&quot;end_commands&quot;
669
- &lt;div id=\&quot;commands\&quot;&gt;
670
- &lt;span style=\&quot;font-size: 11pt; font-weight: bold;\&quot;&gt;Threshold:&lt;/span&gt;
671
- &lt;input value=\&quot;#{h threshold}\&quot; size=\&quot;3\&quot; id=\&quot;threshold\&quot; type=\&quot;text\&quot;&gt;
672
- &lt;input value=\&quot;Apply\&quot; onclick=\&quot;setThreshold();\&quot; type=\&quot;submit\&quot;&gt;
673
- &lt;input value=\&quot;Expand All\&quot; onclick=\&quot;expandAll(event);\&quot; type=\&quot;submit\&quot;&gt;
674
- &lt;input value=\&quot;Collapse All\&quot; onclick=\&quot;collapseAll(event);\&quot; type=\&quot;submit\&quot;&gt;
675
- &lt;input value=\&quot;Show Help\&quot; onclick=\&quot;toggleHelp(this);\&quot; type=\&quot;submit\&quot;&gt;
676
- &lt;/div&gt;
677
- end_commands</span>
678
- <span class="ruby-keyword">end</span></pre>
679
- </div>
680
-
681
- </div>
682
-
683
-
684
-
685
-
686
- </div>
687
-
688
-
689
- <div id="method-i-print_css" class="method-detail ">
690
-
691
- <div class="method-heading">
692
- <span class="method-name">print_css</span><span
693
- class="method-args">()</span>
694
-
695
- <span class="method-click-advice">click to toggle source</span>
696
-
697
- </div>
698
-
699
-
700
- <div class="method-description">
701
-
702
-
703
-
704
-
705
-
706
-
707
- <div class="method-source-code" id="print_css-source">
708
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 203</span>
709
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">print_css</span>
710
- <span class="ruby-identifier">html</span> = <span class="ruby-identifier">open_asset</span>(<span class="ruby-string">&#39;call_stack_printer.css.html&#39;</span>)
711
- <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">puts</span> <span class="ruby-identifier">html</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-string">&#39;%s&#39;</span>, <span class="ruby-identifier">base64_image</span>)
712
- <span class="ruby-keyword">end</span></pre>
713
- </div>
714
-
715
- </div>
716
-
717
-
718
-
719
-
720
- </div>
721
-
722
-
723
- <div id="method-i-print_footer" class="method-detail ">
724
-
725
- <div class="method-heading">
726
- <span class="method-name">print_footer</span><span
727
- class="method-args">()</span>
728
-
729
- <span class="method-click-advice">click to toggle source</span>
730
-
731
- </div>
732
-
733
-
734
- <div class="method-description">
735
-
736
-
737
-
738
-
739
-
740
-
741
- <div class="method-source-code" id="print_footer-source">
742
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 194</span>
743
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">print_footer</span>
744
- <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>
745
- <span class="ruby-keyword">end</span></pre>
746
- </div>
747
-
748
- </div>
749
-
750
-
751
-
752
-
753
- </div>
754
-
755
-
756
- <div id="method-i-print_header" class="method-detail ">
757
-
758
- <div class="method-heading">
759
- <span class="method-name">print_header</span><span
760
- class="method-args">()</span>
761
-
762
- <span class="method-click-advice">click to toggle source</span>
763
-
764
- </div>
765
-
766
-
767
- <div class="method-description">
768
-
769
-
770
-
771
-
772
-
773
-
774
- <div class="method-source-code" id="print_header-source">
775
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 182</span>
776
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">print_header</span>
777
- <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>
778
- <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>
779
- <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>
780
- <span class="ruby-identifier">print_css</span>
781
- <span class="ruby-identifier">print_java_script</span>
782
- <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>
783
- <span class="ruby-identifier">print_title_bar</span>
784
- <span class="ruby-identifier">print_commands</span>
785
- <span class="ruby-identifier">print_help</span>
786
- <span class="ruby-keyword">end</span></pre>
787
- </div>
788
-
789
- </div>
790
-
791
-
792
-
793
-
794
- </div>
795
-
796
-
797
- <div id="method-i-print_help" class="method-detail ">
798
-
799
- <div class="method-heading">
800
- <span class="method-name">print_help</span><span
801
- class="method-args">()</span>
802
-
803
- <span class="method-click-advice">click to toggle source</span>
804
-
805
- </div>
806
-
807
-
808
- <div class="method-description">
809
-
810
-
811
-
812
-
813
-
814
-
815
- <div class="method-source-code" id="print_help-source">
816
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 240</span>
817
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">print_help</span>
818
- <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">puts</span> <span class="ruby-value">&lt;&lt;-&#39;end_help&#39;
819
- &lt;div style=&quot;display: none;&quot; id=&quot;help&quot;&gt;
820
- &amp;#8226; Enter a decimal value &lt;i&gt;d&lt;/i&gt; into the threshold field and click &quot;Apply&quot;
821
- to hide all nodes marked with time values lower than &lt;i&gt;d&lt;/i&gt;.&lt;br&gt;
822
- &amp;#8226; Click on &quot;Expand All&quot; for full tree expansion.&lt;br&gt;
823
- &amp;#8226; Click on &quot;Collapse All&quot; to show only top level nodes.&lt;br&gt;
824
- &amp;#8226; Use a, s, d, w as in Quake or Urban Terror to navigate the tree.&lt;br&gt;
825
- &amp;#8226; Use f and b to navigate the tree in preorder forward and backwards.&lt;br&gt;
826
- &amp;#8226; Use x to toggle visibility of a subtree.&lt;br&gt;
827
- &amp;#8226; Use * to expand/collapse a whole subtree.&lt;br&gt;
828
- &amp;#8226; Use h to navigate to thread root.&lt;br&gt;
829
- &amp;#8226; Use n and p to navigate between threads.&lt;br&gt;
830
- &amp;#8226; Click on background to move focus to a subtree.&lt;br&gt;
831
- &lt;/div&gt;
832
- end_help</span>
833
- <span class="ruby-keyword">end</span></pre>
834
- </div>
835
-
836
- </div>
837
-
838
-
839
-
840
-
841
- </div>
842
-
843
-
844
- <div id="method-i-print_java_script" class="method-detail ">
845
-
846
- <div class="method-heading">
847
- <span class="method-name">print_java_script</span><span
848
- class="method-args">()</span>
849
-
850
- <span class="method-click-advice">click to toggle source</span>
851
-
852
- </div>
853
-
854
-
855
- <div class="method-description">
856
-
857
-
858
-
859
-
860
-
861
-
862
- <div class="method-source-code" id="print_java_script-source">
863
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 213</span>
864
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">print_java_script</span>
865
- <span class="ruby-identifier">html</span> = <span class="ruby-identifier">open_asset</span>(<span class="ruby-string">&#39;call_stack_printer.js.html&#39;</span>)
866
- <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">puts</span> <span class="ruby-identifier">html</span>
867
- <span class="ruby-keyword">end</span></pre>
868
- </div>
869
-
870
- </div>
871
-
872
-
873
-
874
-
875
- </div>
876
-
877
-
878
- <div id="method-i-print_stack" class="method-detail ">
879
-
880
- <div class="method-heading">
881
- <span class="method-name">print_stack</span><span
882
- class="method-args">(call_info, parent_time)</span>
883
-
884
- <span class="method-click-advice">click to toggle source</span>
885
-
886
- </div>
887
-
888
-
889
- <div class="method-description">
890
-
891
-
892
-
893
-
894
-
895
-
896
- <div class="method-source-code" id="print_stack-source">
897
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 74</span>
898
- <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>)
899
- <span class="ruby-identifier">total_time</span> = <span class="ruby-identifier">call_info</span>.<span class="ruby-identifier">total_time</span>
900
- <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>
901
- <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>
902
- <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>
903
- <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>)
904
- <span class="ruby-identifier">kids</span> = <span class="ruby-identifier">call_info</span>.<span class="ruby-identifier">children</span>
905
- <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>
906
- <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>
907
- <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>
908
- <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>
909
- <span class="ruby-keyword">if</span> <span class="ruby-identifier">kids</span>.<span class="ruby-identifier">empty?</span>
910
- <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">print</span> <span class="ruby-node">&quot;&lt;a href=\&quot;#\&quot; class=\&quot;toggle empty\&quot; &gt;&lt;/a&gt;&quot;</span>
911
- <span class="ruby-keyword">else</span>
912
- <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>}
913
- <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>
914
- <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">print</span> <span class="ruby-node">&quot;&lt;a href=\&quot;#\&quot; class=\&quot;toggle #{image}\&quot; &gt;&lt;/a&gt;&quot;</span>
915
- <span class="ruby-keyword">end</span>
916
- <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">printf</span> <span class="ruby-string">&quot;&lt;span&gt; %4.2f%% (%4.2f%%) %s %s&lt;/span&gt;\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>)
917
- <span class="ruby-keyword">unless</span> <span class="ruby-identifier">kids</span>.<span class="ruby-identifier">empty?</span>
918
- <span class="ruby-keyword">if</span> <span class="ruby-identifier">expanded</span>
919
- <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">print</span> <span class="ruby-string">&quot;&lt;ul&gt;&quot;</span>
920
- <span class="ruby-keyword">else</span>
921
- <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>
922
- <span class="ruby-keyword">end</span>
923
- <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>
924
- <span class="ruby-identifier">print_stack</span> <span class="ruby-identifier">callinfo</span>, <span class="ruby-identifier">total_time</span>
925
- <span class="ruby-keyword">end</span>
926
- <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">print</span> <span class="ruby-string">&quot;&lt;/ul&gt;&quot;</span>
927
- <span class="ruby-keyword">end</span>
928
- <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">print</span> <span class="ruby-string">&quot;&lt;/li&gt;&quot;</span>
929
- <span class="ruby-keyword">end</span></pre>
930
- </div>
931
-
932
- </div>
933
-
934
-
935
-
936
-
937
- </div>
938
-
939
-
940
- <div id="method-i-print_title_bar" class="method-detail ">
941
-
942
- <div class="method-heading">
943
- <span class="method-name">print_title_bar</span><span
944
- class="method-args">()</span>
945
-
946
- <span class="method-click-advice">click to toggle source</span>
947
-
948
- </div>
949
-
950
-
951
- <div class="method-description">
952
-
953
-
954
-
955
-
956
-
957
-
958
- <div class="method-source-code" id="print_title_bar-source">
959
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 218</span>
960
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">print_title_bar</span>
961
- <span class="ruby-ivar">@output</span>.<span class="ruby-identifier">puts</span> <span class="ruby-value">&lt;&lt;-&quot;end_title_bar&quot;
962
- &lt;div id=&quot;titlebar&quot;&gt;
963
- Call tree for application &lt;b&gt;#{h application} #{h arguments}&lt;/b&gt;&lt;br/&gt;
964
- Generated on #{Time.now} with options #{h @options.inspect}&lt;br/&gt;
965
- &lt;/div&gt;
966
- end_title_bar</span>
967
- <span class="ruby-keyword">end</span></pre>
968
- </div>
969
-
970
- </div>
971
-
972
-
973
-
974
-
975
- </div>
976
-
977
-
978
- <div id="method-i-sum" class="method-detail ">
979
-
980
- <div class="method-heading">
981
- <span class="method-name">sum</span><span
982
- class="method-args">(a)</span>
983
-
984
- <span class="method-click-advice">click to toggle source</span>
985
-
986
- </div>
987
-
988
-
989
- <div class="method-description">
990
-
991
-
992
-
993
-
994
-
995
-
996
- <div class="method-source-code" id="sum-source">
997
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 141</span>
998
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">sum</span>(<span class="ruby-identifier">a</span>)
999
- <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>}
1000
- <span class="ruby-keyword">end</span></pre>
1001
- </div>
1002
-
1003
- </div>
1004
-
1005
-
1006
-
1007
-
1008
- </div>
1009
-
1010
-
1011
- <div id="method-i-threshold" class="method-detail ">
1012
-
1013
- <div class="method-heading">
1014
- <span class="method-name">threshold</span><span
1015
- class="method-args">()</span>
1016
-
1017
- <span class="method-click-advice">click to toggle source</span>
1018
-
1019
- </div>
1020
-
1021
-
1022
- <div class="method-description">
1023
-
1024
-
1025
-
1026
-
1027
-
1028
-
1029
- <div class="method-source-code" id="threshold-source">
1030
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 174</span>
1031
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">threshold</span>
1032
- <span class="ruby-ivar">@options</span>[<span class="ruby-value">:threshold</span>] <span class="ruby-operator">||</span> <span class="ruby-value">1.0</span>
1033
- <span class="ruby-keyword">end</span></pre>
1034
- </div>
1035
-
1036
- </div>
1037
-
1038
-
1039
-
1040
-
1041
- </div>
1042
-
1043
-
1044
- <div id="method-i-title" class="method-detail ">
1045
-
1046
- <div class="method-heading">
1047
- <span class="method-name">title</span><span
1048
- class="method-args">()</span>
1049
-
1050
- <span class="method-click-advice">click to toggle source</span>
1051
-
1052
- </div>
1053
-
1054
-
1055
- <div class="method-description">
1056
-
1057
-
1058
-
1059
-
1060
-
1061
-
1062
- <div class="method-source-code" id="title-source">
1063
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 170</span>
1064
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">title</span>
1065
- <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>
1066
- <span class="ruby-keyword">end</span></pre>
1067
- </div>
1068
-
1069
- </div>
1070
-
1071
-
1072
-
1073
-
1074
- </div>
1075
-
1076
-
1077
- <div id="method-i-total_time" class="method-detail ">
1078
-
1079
- <div class="method-heading">
1080
- <span class="method-name">total_time</span><span
1081
- class="method-args">(call_infos)</span>
1082
-
1083
- <span class="method-click-advice">click to toggle source</span>
1084
-
1085
- </div>
1086
-
1087
-
1088
- <div class="method-description">
1089
-
1090
-
1091
-
1092
-
1093
-
1094
-
1095
- <div class="method-source-code" id="total_time-source">
1096
- <pre><span class="ruby-comment"># File lib/ruby-prof/printers/call_stack_printer.rb, line 137</span>
1097
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">total_time</span>(<span class="ruby-identifier">call_infos</span>)
1098
- <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>})
1099
- <span class="ruby-keyword">end</span></pre>
1100
- </div>
1101
-
1102
- </div>
1103
-
1104
-
1105
-
1106
-
1107
- </div>
1108
-
1109
-
1110
- </section>
1111
-
1112
- </section>
1113
- </main>
1114
-
1115
-
1116
- <footer id="validator-badges" role="contentinfo">
1117
- <p><a href="http://validator.w3.org/check/referer">Validate</a>
1118
- <p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.0.
1119
- <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
1120
- </footer>
1121
-