ruby-prof 0.13.1 → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/CHANGES +579 -371
- data/LICENSE +24 -23
- data/README.rdoc +5 -433
- data/Rakefile +98 -110
- data/bin/ruby-prof +328 -329
- data/bin/ruby-prof-check-trace +45 -0
- data/ext/ruby_prof/extconf.rb +16 -59
- data/ext/ruby_prof/rp_aggregate_call_tree.c +59 -0
- data/ext/ruby_prof/rp_aggregate_call_tree.h +13 -0
- data/ext/ruby_prof/rp_allocation.c +287 -0
- data/ext/ruby_prof/rp_allocation.h +31 -0
- data/ext/ruby_prof/rp_call_tree.c +369 -0
- data/ext/ruby_prof/rp_call_tree.h +43 -0
- data/ext/ruby_prof/rp_call_trees.c +288 -0
- data/ext/ruby_prof/rp_call_trees.h +28 -0
- data/ext/ruby_prof/rp_measure_allocations.c +50 -65
- data/ext/ruby_prof/rp_measure_memory.c +42 -73
- data/ext/ruby_prof/rp_measure_process_time.c +65 -71
- data/ext/ruby_prof/rp_measure_wall_time.c +64 -42
- data/ext/ruby_prof/rp_measurement.c +237 -0
- data/ext/ruby_prof/rp_measurement.h +50 -0
- data/ext/ruby_prof/rp_method.c +491 -420
- data/ext/ruby_prof/rp_method.h +62 -57
- data/ext/ruby_prof/rp_profile.c +908 -0
- data/ext/ruby_prof/rp_profile.h +35 -0
- data/ext/ruby_prof/rp_stack.c +212 -128
- data/ext/ruby_prof/rp_stack.h +53 -51
- data/ext/ruby_prof/rp_thread.c +362 -268
- data/ext/ruby_prof/rp_thread.h +39 -27
- data/ext/ruby_prof/ruby_prof.c +52 -695
- data/ext/ruby_prof/ruby_prof.h +26 -55
- data/ext/ruby_prof/vc/ruby_prof.sln +28 -21
- data/ext/ruby_prof/vc/{ruby_prof_20.vcxproj → ruby_prof.vcxproj} +56 -8
- data/lib/ruby-prof.rb +52 -67
- data/lib/ruby-prof/assets/call_stack_printer.html.erb +710 -0
- data/lib/ruby-prof/assets/call_stack_printer.png +0 -0
- data/lib/ruby-prof/assets/graph_printer.html.erb +355 -0
- data/lib/ruby-prof/call_tree.rb +57 -0
- data/lib/ruby-prof/call_tree_visitor.rb +36 -0
- data/lib/ruby-prof/compatibility.rb +99 -169
- data/lib/ruby-prof/exclude_common_methods.rb +198 -0
- data/lib/ruby-prof/measurement.rb +17 -0
- data/lib/ruby-prof/method_info.rb +78 -131
- data/lib/ruby-prof/printers/abstract_printer.rb +137 -85
- data/lib/ruby-prof/printers/call_info_printer.rb +53 -41
- data/lib/ruby-prof/printers/call_stack_printer.rb +180 -773
- data/lib/ruby-prof/printers/call_tree_printer.rb +151 -92
- data/lib/ruby-prof/printers/dot_printer.rb +132 -132
- data/lib/ruby-prof/printers/flat_printer.rb +53 -69
- data/lib/ruby-prof/printers/graph_html_printer.rb +63 -255
- data/lib/ruby-prof/printers/graph_printer.rb +113 -116
- data/lib/ruby-prof/printers/multi_printer.rb +127 -56
- data/lib/ruby-prof/profile.rb +37 -77
- data/lib/ruby-prof/rack.rb +62 -15
- data/lib/ruby-prof/task.rb +147 -147
- data/lib/ruby-prof/thread.rb +10 -12
- data/lib/ruby-prof/version.rb +3 -0
- data/lib/unprof.rb +10 -10
- data/ruby-prof.gemspec +65 -61
- data/test/abstract_printer_test.rb +26 -0
- data/test/alias_test.rb +126 -0
- data/test/basic_test.rb +43 -128
- data/test/call_tree_visitor_test.rb +32 -0
- data/test/call_trees_test.rb +66 -0
- data/test/duplicate_names_test.rb +32 -32
- data/test/dynamic_method_test.rb +53 -74
- data/test/enumerable_test.rb +21 -16
- data/test/exceptions_test.rb +24 -16
- data/test/exclude_methods_test.rb +151 -0
- data/test/exclude_threads_test.rb +53 -54
- data/test/fiber_test.rb +129 -65
- data/test/gc_test.rb +90 -0
- data/test/inverse_call_tree_test.rb +175 -0
- data/test/line_number_test.rb +158 -71
- data/test/marshal_test.rb +113 -0
- data/test/measure_allocations.rb +30 -0
- data/test/measure_allocations_test.rb +375 -25
- data/test/measure_allocations_trace_test.rb +375 -0
- data/test/measure_memory_trace_test.rb +1101 -0
- data/test/measure_process_time_test.rb +785 -62
- data/test/measure_times.rb +56 -0
- data/test/measure_wall_time_test.rb +434 -254
- data/test/multi_printer_test.rb +71 -82
- data/test/no_method_class_test.rb +15 -15
- data/test/pause_resume_test.rb +175 -166
- data/test/prime.rb +54 -54
- data/test/prime_script.rb +6 -0
- data/test/printer_call_stack_test.rb +27 -0
- data/test/printer_call_tree_test.rb +30 -0
- data/test/printer_flat_test.rb +99 -0
- data/test/printer_graph_html_test.rb +59 -0
- data/test/printer_graph_test.rb +40 -0
- data/test/printers_test.rb +141 -257
- data/test/printing_recursive_graph_test.rb +81 -0
- data/test/profile_test.rb +16 -0
- data/test/rack_test.rb +93 -0
- data/test/recursive_test.rb +206 -215
- data/test/singleton_test.rb +38 -38
- data/test/stack_printer_test.rb +64 -78
- data/test/start_stop_test.rb +109 -112
- data/test/test_helper.rb +13 -115
- data/test/thread_test.rb +144 -178
- data/test/unique_call_path_test.rb +120 -224
- data/test/yarv_test.rb +56 -0
- metadata +77 -133
- data/doc/LICENSE.html +0 -155
- data/doc/README_rdoc.html +0 -648
- data/doc/Rack.html +0 -167
- data/doc/Rack/RubyProf.html +0 -319
- data/doc/RubyProf.html +0 -1000
- data/doc/RubyProf/AbstractPrinter.html +0 -580
- data/doc/RubyProf/AggregateCallInfo.html +0 -570
- data/doc/RubyProf/CallInfo.html +0 -512
- data/doc/RubyProf/CallInfoPrinter.html +0 -190
- data/doc/RubyProf/CallInfoVisitor.html +0 -332
- data/doc/RubyProf/CallStackPrinter.html +0 -1600
- data/doc/RubyProf/CallTreePrinter.html +0 -413
- data/doc/RubyProf/Cmd.html +0 -669
- data/doc/RubyProf/DotPrinter.html +0 -312
- data/doc/RubyProf/FlatPrinter.html +0 -229
- data/doc/RubyProf/FlatPrinterWithLineNumbers.html +0 -267
- data/doc/RubyProf/GraphHtmlPrinter.html +0 -630
- data/doc/RubyProf/GraphPrinter.html +0 -209
- data/doc/RubyProf/MethodInfo.html +0 -713
- data/doc/RubyProf/MultiPrinter.html +0 -407
- data/doc/RubyProf/Profile.html +0 -821
- data/doc/RubyProf/ProfileTask.html +0 -532
- data/doc/RubyProf/Test.html +0 -578
- data/doc/RubyProf/Thread.html +0 -262
- data/doc/created.rid +0 -32
- data/doc/examples/flat_txt.html +0 -191
- data/doc/examples/graph_txt.html +0 -305
- data/doc/images/add.png +0 -0
- data/doc/images/brick.png +0 -0
- data/doc/images/brick_link.png +0 -0
- data/doc/images/bug.png +0 -0
- data/doc/images/bullet_black.png +0 -0
- data/doc/images/bullet_toggle_minus.png +0 -0
- data/doc/images/bullet_toggle_plus.png +0 -0
- data/doc/images/date.png +0 -0
- data/doc/images/delete.png +0 -0
- data/doc/images/find.png +0 -0
- data/doc/images/loadingAnimation.gif +0 -0
- data/doc/images/macFFBgHack.png +0 -0
- data/doc/images/package.png +0 -0
- data/doc/images/page_green.png +0 -0
- data/doc/images/page_white_text.png +0 -0
- data/doc/images/page_white_width.png +0 -0
- data/doc/images/plugin.png +0 -0
- data/doc/images/ruby.png +0 -0
- data/doc/images/tag_blue.png +0 -0
- data/doc/images/tag_green.png +0 -0
- data/doc/images/transparent.png +0 -0
- data/doc/images/wrench.png +0 -0
- data/doc/images/wrench_orange.png +0 -0
- data/doc/images/zoom.png +0 -0
- data/doc/index.html +0 -647
- data/doc/js/darkfish.js +0 -155
- data/doc/js/jquery.js +0 -18
- data/doc/js/navigation.js +0 -142
- data/doc/js/search.js +0 -94
- data/doc/js/search_index.js +0 -1
- data/doc/js/searcher.js +0 -228
- data/doc/rdoc.css +0 -543
- data/doc/table_of_contents.html +0 -462
- data/examples/empty.png +0 -0
- data/examples/flat.txt +0 -55
- data/examples/graph.dot +0 -106
- data/examples/graph.html +0 -823
- data/examples/graph.png +0 -0
- data/examples/graph.txt +0 -170
- data/examples/minus.png +0 -0
- data/examples/multi.flat.txt +0 -23
- data/examples/multi.graph.html +0 -906
- data/examples/multi.grind.dat +0 -194
- data/examples/multi.stack.html +0 -573
- data/examples/plus.png +0 -0
- data/examples/stack.html +0 -573
- data/ext/ruby_prof/rp_call_info.c +0 -407
- data/ext/ruby_prof/rp_call_info.h +0 -48
- data/ext/ruby_prof/rp_measure.c +0 -48
- data/ext/ruby_prof/rp_measure.h +0 -45
- data/ext/ruby_prof/rp_measure_cpu_time.c +0 -112
- data/ext/ruby_prof/rp_measure_gc_runs.c +0 -65
- data/ext/ruby_prof/rp_measure_gc_time.c +0 -57
- data/ext/ruby_prof/vc/ruby_prof_18.vcxproj +0 -108
- data/ext/ruby_prof/vc/ruby_prof_19.vcxproj +0 -110
- data/ext/ruby_prof/version.h +0 -7
- data/lib/ruby-prof/aggregate_call_info.rb +0 -72
- data/lib/ruby-prof/call_info.rb +0 -89
- data/lib/ruby-prof/call_info_visitor.rb +0 -44
- data/lib/ruby-prof/images/empty.png +0 -0
- data/lib/ruby-prof/images/minus.png +0 -0
- data/lib/ruby-prof/images/plus.png +0 -0
- data/lib/ruby-prof/printers/flat_printer_with_line_numbers.rb +0 -57
- data/lib/ruby-prof/test.rb +0 -150
- data/test/aggregate_test.rb +0 -136
- data/test/call_info_test.rb +0 -78
- data/test/call_info_visitor_test.rb +0 -31
- data/test/exec_test.rb +0 -14
- data/test/measure_cpu_time_test.rb +0 -220
- data/test/measure_gc_runs_test.rb +0 -32
- data/test/measure_gc_time_test.rb +0 -36
- data/test/measure_memory_test.rb +0 -31
- data/test/method_elimination_test.rb +0 -84
- data/test/module_test.rb +0 -45
- data/test/stack_test.rb +0 -138
- data/test/test_suite.rb +0 -37
@@ -1,267 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
|
3
|
-
<html>
|
4
|
-
<head>
|
5
|
-
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
|
6
|
-
|
7
|
-
<title>class RubyProf::FlatPrinterWithLineNumbers - ruby-prof</title>
|
8
|
-
|
9
|
-
<link type="text/css" media="screen" href="../rdoc.css" rel="stylesheet">
|
10
|
-
|
11
|
-
<script type="text/javascript">
|
12
|
-
var rdoc_rel_prefix = "../";
|
13
|
-
</script>
|
14
|
-
|
15
|
-
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
16
|
-
<script type="text/javascript" charset="utf-8" src="../js/navigation.js"></script>
|
17
|
-
<script type="text/javascript" charset="utf-8" src="../js/search_index.js"></script>
|
18
|
-
<script type="text/javascript" charset="utf-8" src="../js/search.js"></script>
|
19
|
-
<script type="text/javascript" charset="utf-8" src="../js/searcher.js"></script>
|
20
|
-
<script type="text/javascript" charset="utf-8" src="../js/darkfish.js"></script>
|
21
|
-
|
22
|
-
|
23
|
-
<body id="top" class="class">
|
24
|
-
<nav id="metadata">
|
25
|
-
<nav id="home-section" class="section">
|
26
|
-
<h3 class="section-header">
|
27
|
-
<a href="../index.html">Home</a>
|
28
|
-
<a href="../table_of_contents.html#classes">Classes</a>
|
29
|
-
<a href="../table_of_contents.html#methods">Methods</a>
|
30
|
-
</h3>
|
31
|
-
</nav>
|
32
|
-
|
33
|
-
|
34
|
-
<nav id="search-section" class="section project-section" class="initially-hidden">
|
35
|
-
<form action="#" method="get" accept-charset="utf-8">
|
36
|
-
<h3 class="section-header">
|
37
|
-
<input type="text" name="search" placeholder="Search" id="search-field"
|
38
|
-
title="Type to search, Up and Down to navigate, Enter to load">
|
39
|
-
</h3>
|
40
|
-
</form>
|
41
|
-
|
42
|
-
<ul id="search-results" class="initially-hidden"></ul>
|
43
|
-
</nav>
|
44
|
-
|
45
|
-
|
46
|
-
<div id="file-metadata">
|
47
|
-
<nav id="file-list-section" class="section">
|
48
|
-
<h3 class="section-header">Defined In</h3>
|
49
|
-
<ul>
|
50
|
-
<li>lib/ruby-prof/printers/flat_printer_with_line_numbers.rb
|
51
|
-
</ul>
|
52
|
-
</nav>
|
53
|
-
|
54
|
-
|
55
|
-
</div>
|
56
|
-
|
57
|
-
<div id="class-metadata">
|
58
|
-
|
59
|
-
<nav id="parent-class-section" class="section">
|
60
|
-
<h3 class="section-header">Parent</h3>
|
61
|
-
|
62
|
-
<p class="link"><a href="FlatPrinter.html">RubyProf::FlatPrinter</a>
|
63
|
-
|
64
|
-
</nav>
|
65
|
-
|
66
|
-
|
67
|
-
<!-- Method Quickref -->
|
68
|
-
<nav id="method-list-section" class="section">
|
69
|
-
<h3 class="section-header">Methods</h3>
|
70
|
-
|
71
|
-
<ul class="link-list">
|
72
|
-
|
73
|
-
<li><a href="#method-i-print_methods">#print_methods</a>
|
74
|
-
|
75
|
-
</ul>
|
76
|
-
</nav>
|
77
|
-
|
78
|
-
</div>
|
79
|
-
|
80
|
-
<div id="project-metadata">
|
81
|
-
<nav id="fileindex-section" class="section project-section">
|
82
|
-
<h3 class="section-header">Pages</h3>
|
83
|
-
|
84
|
-
<ul>
|
85
|
-
|
86
|
-
<li class="file"><a href="../LICENSE.html">LICENSE</a>
|
87
|
-
|
88
|
-
<li class="file"><a href="../README_rdoc.html">README</a>
|
89
|
-
|
90
|
-
<li class="file"><a href="../examples/flat_txt.html">flat</a>
|
91
|
-
|
92
|
-
<li class="file"><a href="../examples/graph_txt.html">graph</a>
|
93
|
-
|
94
|
-
</ul>
|
95
|
-
</nav>
|
96
|
-
|
97
|
-
<nav id="classindex-section" class="section project-section">
|
98
|
-
<h3 class="section-header">Class and Module Index</h3>
|
99
|
-
|
100
|
-
<ul class="link-list">
|
101
|
-
|
102
|
-
<li><a href="../RubyProf.html">RubyProf</a>
|
103
|
-
|
104
|
-
<li><a href="../RubyProf/AbstractPrinter.html">RubyProf::AbstractPrinter</a>
|
105
|
-
|
106
|
-
<li><a href="../RubyProf/AggregateCallInfo.html">RubyProf::AggregateCallInfo</a>
|
107
|
-
|
108
|
-
<li><a href="../RubyProf/CallInfo.html">RubyProf::CallInfo</a>
|
109
|
-
|
110
|
-
<li><a href="../RubyProf/CallInfoPrinter.html">RubyProf::CallInfoPrinter</a>
|
111
|
-
|
112
|
-
<li><a href="../RubyProf/CallInfoVisitor.html">RubyProf::CallInfoVisitor</a>
|
113
|
-
|
114
|
-
<li><a href="../RubyProf/CallStackPrinter.html">RubyProf::CallStackPrinter</a>
|
115
|
-
|
116
|
-
<li><a href="../RubyProf/CallTreePrinter.html">RubyProf::CallTreePrinter</a>
|
117
|
-
|
118
|
-
<li><a href="../RubyProf/Cmd.html">RubyProf::Cmd</a>
|
119
|
-
|
120
|
-
<li><a href="../RubyProf/DotPrinter.html">RubyProf::DotPrinter</a>
|
121
|
-
|
122
|
-
<li><a href="../RubyProf/FlatPrinter.html">RubyProf::FlatPrinter</a>
|
123
|
-
|
124
|
-
<li><a href="../RubyProf/FlatPrinterWithLineNumbers.html">RubyProf::FlatPrinterWithLineNumbers</a>
|
125
|
-
|
126
|
-
<li><a href="../RubyProf/GraphHtmlPrinter.html">RubyProf::GraphHtmlPrinter</a>
|
127
|
-
|
128
|
-
<li><a href="../RubyProf/GraphPrinter.html">RubyProf::GraphPrinter</a>
|
129
|
-
|
130
|
-
<li><a href="../RubyProf/MethodInfo.html">RubyProf::MethodInfo</a>
|
131
|
-
|
132
|
-
<li><a href="../RubyProf/MultiPrinter.html">RubyProf::MultiPrinter</a>
|
133
|
-
|
134
|
-
<li><a href="../RubyProf/Profile.html">RubyProf::Profile</a>
|
135
|
-
|
136
|
-
<li><a href="../RubyProf/ProfileTask.html">RubyProf::ProfileTask</a>
|
137
|
-
|
138
|
-
<li><a href="../RubyProf/Test.html">RubyProf::Test</a>
|
139
|
-
|
140
|
-
<li><a href="../RubyProf/Thread.html">RubyProf::Thread</a>
|
141
|
-
|
142
|
-
<li><a href="../Rack.html">Rack</a>
|
143
|
-
|
144
|
-
<li><a href="../Rack/RubyProf.html">Rack::RubyProf</a>
|
145
|
-
|
146
|
-
</ul>
|
147
|
-
</nav>
|
148
|
-
|
149
|
-
</div>
|
150
|
-
</nav>
|
151
|
-
|
152
|
-
<div id="documentation">
|
153
|
-
<h1 class="class">class RubyProf::FlatPrinterWithLineNumbers</h1>
|
154
|
-
|
155
|
-
<div id="description" class="description">
|
156
|
-
|
157
|
-
<p>Generates <a href="../files/examples/flat_txt.html">flat</a> profile
|
158
|
-
reports as text. To use the flat printer with line numbers:</p>
|
159
|
-
|
160
|
-
<pre>result = RubyProf.profile do
|
161
|
-
[code to profile]
|
162
|
-
end
|
163
|
-
|
164
|
-
printer = RubyProf::FlatPrinterWithLineNumbers.new(result)
|
165
|
-
printer.print(STDOUT, {})</pre>
|
166
|
-
|
167
|
-
</div><!-- description -->
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
<section id="5Buntitled-5D" class="documentation-section">
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
<!-- Methods -->
|
182
|
-
|
183
|
-
<section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
|
184
|
-
<h3 class="section-header">Public Instance Methods</h3>
|
185
|
-
|
186
|
-
|
187
|
-
<div id="method-i-print_methods" class="method-detail ">
|
188
|
-
|
189
|
-
<div class="method-heading">
|
190
|
-
<span class="method-name">print_methods</span><span
|
191
|
-
class="method-args">(thread)</span>
|
192
|
-
<span class="method-click-advice">click to toggle source</span>
|
193
|
-
</div>
|
194
|
-
|
195
|
-
|
196
|
-
<div class="method-description">
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
<div class="method-source-code" id="print_methods-source">
|
203
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/printers/flat_printer_with_line_numbers.rb, line 14</span>
|
204
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">print_methods</span>(<span class="ruby-identifier">thread</span>)
|
205
|
-
<span class="ruby-identifier">total_time</span> = <span class="ruby-identifier">thread</span>.<span class="ruby-identifier">total_time</span>
|
206
|
-
|
207
|
-
<span class="ruby-identifier">methods</span> = <span class="ruby-identifier">thread</span>.<span class="ruby-identifier">methods</span>.<span class="ruby-identifier">sort_by</span>(&<span class="ruby-identifier">sort_method</span>).<span class="ruby-identifier">reverse</span>
|
208
|
-
<span class="ruby-identifier">sum</span> = <span class="ruby-value">0</span>
|
209
|
-
<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">method</span><span class="ruby-operator">|</span>
|
210
|
-
<span class="ruby-identifier">self_percent</span> = (<span class="ruby-identifier">method</span>.<span class="ruby-identifier">self_time</span> <span class="ruby-operator">/</span> <span class="ruby-identifier">total_time</span>) * <span class="ruby-value">100</span>
|
211
|
-
<span class="ruby-keyword">next</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">self_percent</span> <span class="ruby-operator"><</span> <span class="ruby-identifier">min_percent</span>
|
212
|
-
|
213
|
-
<span class="ruby-identifier">sum</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">method</span>.<span class="ruby-identifier">self_time</span>
|
214
|
-
<span class="ruby-comment">#self_time_called = method.called > 0 ? method.self_time/method.called : 0</span>
|
215
|
-
<span class="ruby-comment">#total_time_called = method.called > 0? method.total_time/method.called : 0</span>
|
216
|
-
|
217
|
-
<span class="ruby-ivar">@output</span> <span class="ruby-operator"><<</span> <span class="ruby-string">"%6.2f %9.3f %9.3f %9.3f %9.3f %8d %s%s \n"</span> <span class="ruby-operator">%</span> [
|
218
|
-
<span class="ruby-identifier">method</span>.<span class="ruby-identifier">self_time</span> <span class="ruby-operator">/</span> <span class="ruby-identifier">total_time</span> * <span class="ruby-value">100</span>, <span class="ruby-comment"># %self</span>
|
219
|
-
<span class="ruby-identifier">method</span>.<span class="ruby-identifier">total_time</span>, <span class="ruby-comment"># total</span>
|
220
|
-
<span class="ruby-identifier">method</span>.<span class="ruby-identifier">self_time</span>, <span class="ruby-comment"># self</span>
|
221
|
-
<span class="ruby-identifier">method</span>.<span class="ruby-identifier">wait_time</span>, <span class="ruby-comment"># wait</span>
|
222
|
-
<span class="ruby-identifier">method</span>.<span class="ruby-identifier">children_time</span>, <span class="ruby-comment"># children</span>
|
223
|
-
<span class="ruby-identifier">method</span>.<span class="ruby-identifier">called</span>, <span class="ruby-comment"># calls</span>
|
224
|
-
<span class="ruby-identifier">method</span>.<span class="ruby-identifier">recursive?</span> <span class="ruby-operator">?</span> <span class="ruby-string">"*"</span> <span class="ruby-operator">:</span> <span class="ruby-string">" "</span>, <span class="ruby-comment"># cycle</span>
|
225
|
-
<span class="ruby-identifier">method_name</span>(<span class="ruby-identifier">method</span>) <span class="ruby-comment"># name</span>
|
226
|
-
]
|
227
|
-
<span class="ruby-keyword">if</span> <span class="ruby-identifier">method</span>.<span class="ruby-identifier">source_file</span> <span class="ruby-operator">!=</span> <span class="ruby-string">'ruby_runtime'</span>
|
228
|
-
<span class="ruby-ivar">@output</span> <span class="ruby-operator"><<</span> <span class="ruby-string">" %s:%s"</span> <span class="ruby-operator">%</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>), <span class="ruby-identifier">method</span>.<span class="ruby-identifier">line</span>]
|
229
|
-
<span class="ruby-keyword">end</span>
|
230
|
-
<span class="ruby-ivar">@output</span> <span class="ruby-operator"><<</span> <span class="ruby-string">"\n\tcalled from: "</span>
|
231
|
-
|
232
|
-
<span class="ruby-comment"># make sure they're unique</span>
|
233
|
-
<span class="ruby-identifier">method</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>
|
234
|
-
<span class="ruby-keyword">if</span> <span class="ruby-identifier">ci</span>.<span class="ruby-identifier">parent</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">ci</span>.<span class="ruby-identifier">parent</span>.<span class="ruby-identifier">target</span>.<span class="ruby-identifier">source_file</span> <span class="ruby-operator">!=</span> <span class="ruby-string">'ruby_runtime'</span>
|
235
|
-
[<span class="ruby-identifier">method_name</span>(<span class="ruby-identifier">ci</span>.<span class="ruby-identifier">parent</span>.<span class="ruby-identifier">target</span>), <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-identifier">ci</span>.<span class="ruby-identifier">parent</span>.<span class="ruby-identifier">target</span>.<span class="ruby-identifier">source_file</span>), <span class="ruby-identifier">ci</span>.<span class="ruby-identifier">parent</span>.<span class="ruby-identifier">target</span>.<span class="ruby-identifier">line</span>]
|
236
|
-
<span class="ruby-keyword">else</span>
|
237
|
-
<span class="ruby-keyword">nil</span>
|
238
|
-
<span class="ruby-keyword">end</span>
|
239
|
-
}.<span class="ruby-identifier">compact</span>.<span class="ruby-identifier">uniq</span>.<span class="ruby-identifier">each</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">args</span><span class="ruby-operator">|</span>
|
240
|
-
<span class="ruby-ivar">@output</span> <span class="ruby-operator"><<</span> <span class="ruby-string">" %s (%s:%s) "</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">args</span>
|
241
|
-
}
|
242
|
-
<span class="ruby-ivar">@output</span> <span class="ruby-operator"><<</span> <span class="ruby-string">"\n\n"</span>
|
243
|
-
<span class="ruby-keyword">end</span>
|
244
|
-
<span class="ruby-keyword">end</span></pre>
|
245
|
-
</div><!-- print_methods-source -->
|
246
|
-
|
247
|
-
</div>
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
</div><!-- print_methods-method -->
|
253
|
-
|
254
|
-
|
255
|
-
</section><!-- public-instance-method-details -->
|
256
|
-
|
257
|
-
</section><!-- 5Buntitled-5D -->
|
258
|
-
|
259
|
-
</div><!-- documentation -->
|
260
|
-
|
261
|
-
|
262
|
-
<footer id="validator-badges">
|
263
|
-
<p><a href="http://validator.w3.org/check/referer">[Validate]</a>
|
264
|
-
<p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.1.
|
265
|
-
<p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
|
266
|
-
</footer>
|
267
|
-
|
@@ -1,630 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
|
3
|
-
<html>
|
4
|
-
<head>
|
5
|
-
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
|
6
|
-
|
7
|
-
<title>class RubyProf::GraphHtmlPrinter - ruby-prof</title>
|
8
|
-
|
9
|
-
<link type="text/css" media="screen" href="../rdoc.css" rel="stylesheet">
|
10
|
-
|
11
|
-
<script type="text/javascript">
|
12
|
-
var rdoc_rel_prefix = "../";
|
13
|
-
</script>
|
14
|
-
|
15
|
-
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
16
|
-
<script type="text/javascript" charset="utf-8" src="../js/navigation.js"></script>
|
17
|
-
<script type="text/javascript" charset="utf-8" src="../js/search_index.js"></script>
|
18
|
-
<script type="text/javascript" charset="utf-8" src="../js/search.js"></script>
|
19
|
-
<script type="text/javascript" charset="utf-8" src="../js/searcher.js"></script>
|
20
|
-
<script type="text/javascript" charset="utf-8" src="../js/darkfish.js"></script>
|
21
|
-
|
22
|
-
|
23
|
-
<body id="top" class="class">
|
24
|
-
<nav id="metadata">
|
25
|
-
<nav id="home-section" class="section">
|
26
|
-
<h3 class="section-header">
|
27
|
-
<a href="../index.html">Home</a>
|
28
|
-
<a href="../table_of_contents.html#classes">Classes</a>
|
29
|
-
<a href="../table_of_contents.html#methods">Methods</a>
|
30
|
-
</h3>
|
31
|
-
</nav>
|
32
|
-
|
33
|
-
|
34
|
-
<nav id="search-section" class="section project-section" class="initially-hidden">
|
35
|
-
<form action="#" method="get" accept-charset="utf-8">
|
36
|
-
<h3 class="section-header">
|
37
|
-
<input type="text" name="search" placeholder="Search" id="search-field"
|
38
|
-
title="Type to search, Up and Down to navigate, Enter to load">
|
39
|
-
</h3>
|
40
|
-
</form>
|
41
|
-
|
42
|
-
<ul id="search-results" class="initially-hidden"></ul>
|
43
|
-
</nav>
|
44
|
-
|
45
|
-
|
46
|
-
<div id="file-metadata">
|
47
|
-
<nav id="file-list-section" class="section">
|
48
|
-
<h3 class="section-header">Defined In</h3>
|
49
|
-
<ul>
|
50
|
-
<li>lib/ruby-prof/printers/graph_html_printer.rb
|
51
|
-
</ul>
|
52
|
-
</nav>
|
53
|
-
|
54
|
-
|
55
|
-
</div>
|
56
|
-
|
57
|
-
<div id="class-metadata">
|
58
|
-
|
59
|
-
<nav id="parent-class-section" class="section">
|
60
|
-
<h3 class="section-header">Parent</h3>
|
61
|
-
|
62
|
-
<p class="link"><a href="AbstractPrinter.html">RubyProf::AbstractPrinter</a>
|
63
|
-
|
64
|
-
</nav>
|
65
|
-
|
66
|
-
<!-- Included Modules -->
|
67
|
-
<nav id="includes-section" class="section">
|
68
|
-
<h3 class="section-header">Included Modules</h3>
|
69
|
-
|
70
|
-
<ul class="link-list">
|
71
|
-
|
72
|
-
|
73
|
-
<li><span class="include">ERB::Util</span>
|
74
|
-
|
75
|
-
|
76
|
-
</ul>
|
77
|
-
</nav>
|
78
|
-
|
79
|
-
<!-- Method Quickref -->
|
80
|
-
<nav id="method-list-section" class="section">
|
81
|
-
<h3 class="section-header">Methods</h3>
|
82
|
-
|
83
|
-
<ul class="link-list">
|
84
|
-
|
85
|
-
<li><a href="#method-i-create_link">#create_link</a>
|
86
|
-
|
87
|
-
<li><a href="#method-i-file_link">#file_link</a>
|
88
|
-
|
89
|
-
<li><a href="#method-i-method_href">#method_href</a>
|
90
|
-
|
91
|
-
<li><a href="#method-i-print">#print</a>
|
92
|
-
|
93
|
-
<li><a href="#method-i-setup_options">#setup_options</a>
|
94
|
-
|
95
|
-
<li><a href="#method-i-template">#template</a>
|
96
|
-
|
97
|
-
</ul>
|
98
|
-
</nav>
|
99
|
-
|
100
|
-
</div>
|
101
|
-
|
102
|
-
<div id="project-metadata">
|
103
|
-
<nav id="fileindex-section" class="section project-section">
|
104
|
-
<h3 class="section-header">Pages</h3>
|
105
|
-
|
106
|
-
<ul>
|
107
|
-
|
108
|
-
<li class="file"><a href="../LICENSE.html">LICENSE</a>
|
109
|
-
|
110
|
-
<li class="file"><a href="../README_rdoc.html">README</a>
|
111
|
-
|
112
|
-
<li class="file"><a href="../examples/flat_txt.html">flat</a>
|
113
|
-
|
114
|
-
<li class="file"><a href="../examples/graph_txt.html">graph</a>
|
115
|
-
|
116
|
-
</ul>
|
117
|
-
</nav>
|
118
|
-
|
119
|
-
<nav id="classindex-section" class="section project-section">
|
120
|
-
<h3 class="section-header">Class and Module Index</h3>
|
121
|
-
|
122
|
-
<ul class="link-list">
|
123
|
-
|
124
|
-
<li><a href="../RubyProf.html">RubyProf</a>
|
125
|
-
|
126
|
-
<li><a href="../RubyProf/AbstractPrinter.html">RubyProf::AbstractPrinter</a>
|
127
|
-
|
128
|
-
<li><a href="../RubyProf/AggregateCallInfo.html">RubyProf::AggregateCallInfo</a>
|
129
|
-
|
130
|
-
<li><a href="../RubyProf/CallInfo.html">RubyProf::CallInfo</a>
|
131
|
-
|
132
|
-
<li><a href="../RubyProf/CallInfoPrinter.html">RubyProf::CallInfoPrinter</a>
|
133
|
-
|
134
|
-
<li><a href="../RubyProf/CallInfoVisitor.html">RubyProf::CallInfoVisitor</a>
|
135
|
-
|
136
|
-
<li><a href="../RubyProf/CallStackPrinter.html">RubyProf::CallStackPrinter</a>
|
137
|
-
|
138
|
-
<li><a href="../RubyProf/CallTreePrinter.html">RubyProf::CallTreePrinter</a>
|
139
|
-
|
140
|
-
<li><a href="../RubyProf/Cmd.html">RubyProf::Cmd</a>
|
141
|
-
|
142
|
-
<li><a href="../RubyProf/DotPrinter.html">RubyProf::DotPrinter</a>
|
143
|
-
|
144
|
-
<li><a href="../RubyProf/FlatPrinter.html">RubyProf::FlatPrinter</a>
|
145
|
-
|
146
|
-
<li><a href="../RubyProf/FlatPrinterWithLineNumbers.html">RubyProf::FlatPrinterWithLineNumbers</a>
|
147
|
-
|
148
|
-
<li><a href="../RubyProf/GraphHtmlPrinter.html">RubyProf::GraphHtmlPrinter</a>
|
149
|
-
|
150
|
-
<li><a href="../RubyProf/GraphPrinter.html">RubyProf::GraphPrinter</a>
|
151
|
-
|
152
|
-
<li><a href="../RubyProf/MethodInfo.html">RubyProf::MethodInfo</a>
|
153
|
-
|
154
|
-
<li><a href="../RubyProf/MultiPrinter.html">RubyProf::MultiPrinter</a>
|
155
|
-
|
156
|
-
<li><a href="../RubyProf/Profile.html">RubyProf::Profile</a>
|
157
|
-
|
158
|
-
<li><a href="../RubyProf/ProfileTask.html">RubyProf::ProfileTask</a>
|
159
|
-
|
160
|
-
<li><a href="../RubyProf/Test.html">RubyProf::Test</a>
|
161
|
-
|
162
|
-
<li><a href="../RubyProf/Thread.html">RubyProf::Thread</a>
|
163
|
-
|
164
|
-
<li><a href="../Rack.html">Rack</a>
|
165
|
-
|
166
|
-
<li><a href="../Rack/RubyProf.html">Rack::RubyProf</a>
|
167
|
-
|
168
|
-
</ul>
|
169
|
-
</nav>
|
170
|
-
|
171
|
-
</div>
|
172
|
-
</nav>
|
173
|
-
|
174
|
-
<div id="documentation">
|
175
|
-
<h1 class="class">class RubyProf::GraphHtmlPrinter</h1>
|
176
|
-
|
177
|
-
<div id="description" class="description">
|
178
|
-
|
179
|
-
<p>Generates <a href="../files/examples/graph_html.html">graph</a> profile
|
180
|
-
reports as html. To use the graph html printer:</p>
|
181
|
-
|
182
|
-
<pre class="ruby"><span class="ruby-identifier">result</span> = <span class="ruby-constant">RubyProf</span>.<span class="ruby-identifier">profile</span> <span class="ruby-keyword">do</span>
|
183
|
-
[<span class="ruby-identifier">code</span> <span class="ruby-identifier">to</span> <span class="ruby-identifier">profile</span>]
|
184
|
-
<span class="ruby-keyword">end</span>
|
185
|
-
|
186
|
-
<span class="ruby-identifier">printer</span> = <span class="ruby-constant">RubyProf</span><span class="ruby-operator">::</span><span class="ruby-constant">GraphHtmlPrinter</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">result</span>)
|
187
|
-
<span class="ruby-identifier">printer</span>.<span class="ruby-identifier">print</span>(<span class="ruby-constant">STDOUT</span>, :<span class="ruby-identifier">min_percent=</span><span class="ruby-operator">></span><span class="ruby-value">0</span>)
|
188
|
-
</pre>
|
189
|
-
|
190
|
-
<p>The Graph printer takes the following options in its print methods:</p>
|
191
|
-
|
192
|
-
<pre>:filename - specify a file to use that contains the ERB
|
193
|
-
template to use, instead of the built-in self.template
|
194
|
-
|
195
|
-
:template - specify an ERB template to use, instead of the
|
196
|
-
built-in self.template</pre>
|
197
|
-
|
198
|
-
</div><!-- description -->
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
<section id="5Buntitled-5D" class="documentation-section">
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
<!-- Constants -->
|
210
|
-
<section id="constants-list" class="section">
|
211
|
-
<h3 class="section-header">Constants</h3>
|
212
|
-
<dl>
|
213
|
-
|
214
|
-
<dt id="CALL_WIDTH">CALL_WIDTH
|
215
|
-
|
216
|
-
<dd class="description">
|
217
|
-
|
218
|
-
|
219
|
-
<dt id="PERCENTAGE_WIDTH">PERCENTAGE_WIDTH
|
220
|
-
|
221
|
-
<dd class="description">
|
222
|
-
|
223
|
-
|
224
|
-
<dt id="TIME_WIDTH">TIME_WIDTH
|
225
|
-
|
226
|
-
<dd class="description">
|
227
|
-
|
228
|
-
|
229
|
-
</dl>
|
230
|
-
</section>
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
<!-- Methods -->
|
236
|
-
|
237
|
-
<section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
|
238
|
-
<h3 class="section-header">Public Instance Methods</h3>
|
239
|
-
|
240
|
-
|
241
|
-
<div id="method-i-create_link" class="method-detail ">
|
242
|
-
|
243
|
-
<div class="method-heading">
|
244
|
-
<span class="method-name">create_link</span><span
|
245
|
-
class="method-args">(thread, overall_time, method)</span>
|
246
|
-
<span class="method-click-advice">click to toggle source</span>
|
247
|
-
</div>
|
248
|
-
|
249
|
-
|
250
|
-
<div class="method-description">
|
251
|
-
|
252
|
-
<p>Creates a link to a method. Note that we do not create links to methods
|
253
|
-
which are under the min_perecent specified by the user, since they will not
|
254
|
-
be printed out.</p>
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
<div class="method-source-code" id="create_link-source">
|
259
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/printers/graph_html_printer.rb, line 49</span>
|
260
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">create_link</span>(<span class="ruby-identifier">thread</span>, <span class="ruby-identifier">overall_time</span>, <span class="ruby-identifier">method</span>)
|
261
|
-
<span class="ruby-identifier">total_percent</span> = (<span class="ruby-identifier">method</span>.<span class="ruby-identifier">total_time</span><span class="ruby-operator">/</span><span class="ruby-identifier">overall_time</span>) * <span class="ruby-value">100</span>
|
262
|
-
<span class="ruby-keyword">if</span> <span class="ruby-identifier">total_percent</span> <span class="ruby-operator"><</span> <span class="ruby-identifier">min_percent</span>
|
263
|
-
<span class="ruby-comment"># Just return name</span>
|
264
|
-
<span class="ruby-identifier">h</span> <span class="ruby-identifier">method</span>.<span class="ruby-identifier">full_name</span>
|
265
|
-
<span class="ruby-keyword">else</span>
|
266
|
-
<span class="ruby-identifier">href</span> = <span class="ruby-string">'#'</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">method_href</span>(<span class="ruby-identifier">thread</span>, <span class="ruby-identifier">method</span>)
|
267
|
-
<span class="ruby-node">"<a href=\"#{href}\">#{h method.full_name}</a>"</span>
|
268
|
-
<span class="ruby-keyword">end</span>
|
269
|
-
<span class="ruby-keyword">end</span></pre>
|
270
|
-
</div><!-- create_link-source -->
|
271
|
-
|
272
|
-
</div>
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
</div><!-- create_link-method -->
|
278
|
-
|
279
|
-
|
280
|
-
<div id="method-i-file_link" class="method-detail ">
|
281
|
-
|
282
|
-
<div class="method-heading">
|
283
|
-
<span class="method-name">file_link</span><span
|
284
|
-
class="method-args">(path, linenum)</span>
|
285
|
-
<span class="method-click-advice">click to toggle source</span>
|
286
|
-
</div>
|
287
|
-
|
288
|
-
|
289
|
-
<div class="method-description">
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
<div class="method-source-code" id="file_link-source">
|
296
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/printers/graph_html_printer.rb, line 64</span>
|
297
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">file_link</span>(<span class="ruby-identifier">path</span>, <span class="ruby-identifier">linenum</span>)
|
298
|
-
<span class="ruby-identifier">srcfile</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-identifier">path</span>)
|
299
|
-
<span class="ruby-keyword">if</span> <span class="ruby-identifier">srcfile</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">%r\/ruby_runtime$/</span>
|
300
|
-
<span class="ruby-string">""</span>
|
301
|
-
<span class="ruby-keyword">else</span>
|
302
|
-
<span class="ruby-keyword">if</span> <span class="ruby-constant">RUBY_PLATFORM</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp">%rdarwin/</span>
|
303
|
-
<span class="ruby-node">"<a href=\"txmt://open?url=file://#{h srcfile}&line=#{linenum}\" title=\"#{h srcfile}:#{linenum}\">#{linenum}</a>"</span>
|
304
|
-
<span class="ruby-keyword">else</span>
|
305
|
-
<span class="ruby-node">"<a href=\"file://#{h srcfile}##{linenum}\" title=\"#{h srcfile}:#{linenum}\">#{linenum}</a>"</span>
|
306
|
-
<span class="ruby-keyword">end</span>
|
307
|
-
<span class="ruby-keyword">end</span>
|
308
|
-
<span class="ruby-keyword">end</span></pre>
|
309
|
-
</div><!-- file_link-source -->
|
310
|
-
|
311
|
-
</div>
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
</div><!-- file_link-method -->
|
317
|
-
|
318
|
-
|
319
|
-
<div id="method-i-method_href" class="method-detail ">
|
320
|
-
|
321
|
-
<div class="method-heading">
|
322
|
-
<span class="method-name">method_href</span><span
|
323
|
-
class="method-args">(thread, method)</span>
|
324
|
-
<span class="method-click-advice">click to toggle source</span>
|
325
|
-
</div>
|
326
|
-
|
327
|
-
|
328
|
-
<div class="method-description">
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
<div class="method-source-code" id="method_href-source">
|
335
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/printers/graph_html_printer.rb, line 60</span>
|
336
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">method_href</span>(<span class="ruby-identifier">thread</span>, <span class="ruby-identifier">method</span>)
|
337
|
-
<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">%r[><#\.\?=:]/</span>,<span class="ruby-string">"_"</span>) <span class="ruby-operator">+</span> <span class="ruby-string">"_"</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">thread</span>.<span class="ruby-identifier">fiber_id</span>.<span class="ruby-identifier">to_s</span>)
|
338
|
-
<span class="ruby-keyword">end</span></pre>
|
339
|
-
</div><!-- method_href-source -->
|
340
|
-
|
341
|
-
</div>
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
</div><!-- method_href-method -->
|
347
|
-
|
348
|
-
|
349
|
-
<div id="method-i-print" class="method-detail ">
|
350
|
-
|
351
|
-
<div class="method-heading">
|
352
|
-
<span class="method-name">print</span><span
|
353
|
-
class="method-args">(output = STDOUT, options = {})</span>
|
354
|
-
<span class="method-click-advice">click to toggle source</span>
|
355
|
-
</div>
|
356
|
-
|
357
|
-
|
358
|
-
<div class="method-description">
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
<div class="method-source-code" id="print-source">
|
365
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/printers/graph_html_printer.rb, line 39</span>
|
366
|
-
<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> = {})
|
367
|
-
<span class="ruby-ivar">@output</span> = <span class="ruby-identifier">output</span>
|
368
|
-
<span class="ruby-identifier">setup_options</span>(<span class="ruby-identifier">options</span>)
|
369
|
-
<span class="ruby-ivar">@output</span> <span class="ruby-operator"><<</span> <span class="ruby-ivar">@erb</span>.<span class="ruby-identifier">result</span>(<span class="ruby-identifier">binding</span>)
|
370
|
-
<span class="ruby-keyword">end</span></pre>
|
371
|
-
</div><!-- print-source -->
|
372
|
-
|
373
|
-
</div>
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
</div><!-- print-method -->
|
379
|
-
|
380
|
-
|
381
|
-
<div id="method-i-setup_options" class="method-detail ">
|
382
|
-
|
383
|
-
<div class="method-heading">
|
384
|
-
<span class="method-name">setup_options</span><span
|
385
|
-
class="method-args">(options)</span>
|
386
|
-
<span class="method-click-advice">click to toggle source</span>
|
387
|
-
</div>
|
388
|
-
|
389
|
-
|
390
|
-
<div class="method-description">
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
<div class="method-source-code" id="setup_options-source">
|
397
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/printers/graph_html_printer.rb, line 30</span>
|
398
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">setup_options</span>(<span class="ruby-identifier">options</span>)
|
399
|
-
<span class="ruby-keyword">super</span>(<span class="ruby-identifier">options</span>)
|
400
|
-
|
401
|
-
<span class="ruby-identifier">filename</span> = <span class="ruby-identifier">options</span>[<span class="ruby-value">:filename</span>]
|
402
|
-
<span class="ruby-identifier">template</span> = <span class="ruby-identifier">filename</span> <span class="ruby-operator">?</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">filename</span>).<span class="ruby-identifier">untaint</span> <span class="ruby-operator">:</span> (<span class="ruby-identifier">options</span>[<span class="ruby-value">:template</span>] <span class="ruby-operator">||</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">template</span>)
|
403
|
-
<span class="ruby-ivar">@erb</span> = <span class="ruby-constant">ERB</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">template</span>, <span class="ruby-keyword">nil</span>, <span class="ruby-keyword">nil</span>)
|
404
|
-
<span class="ruby-ivar">@erb</span>.<span class="ruby-identifier">filename</span> = <span class="ruby-identifier">filename</span>
|
405
|
-
<span class="ruby-keyword">end</span></pre>
|
406
|
-
</div><!-- setup_options-source -->
|
407
|
-
|
408
|
-
</div>
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
</div><!-- setup_options-method -->
|
414
|
-
|
415
|
-
|
416
|
-
<div id="method-i-template" class="method-detail ">
|
417
|
-
|
418
|
-
<div class="method-heading">
|
419
|
-
<span class="method-name">template</span><span
|
420
|
-
class="method-args">()</span>
|
421
|
-
<span class="method-click-advice">click to toggle source</span>
|
422
|
-
</div>
|
423
|
-
|
424
|
-
|
425
|
-
<div class="method-description">
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
<div class="method-source-code" id="template-source">
|
432
|
-
<pre><span class="ruby-comment"># File lib/ruby-prof/printers/graph_html_printer.rb, line 77</span>
|
433
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">template</span>
|
434
|
-
<span class="ruby-string">'
|
435
|
-
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
436
|
-
<html>
|
437
|
-
<head>
|
438
|
-
<style media="all" type="text/css">
|
439
|
-
table {
|
440
|
-
border-collapse: collapse;
|
441
|
-
border: 1px solid #CCC;
|
442
|
-
font-family: Verdana, Arial, Helvetica, sans-serif;
|
443
|
-
font-size: 9pt;
|
444
|
-
line-height: normal;
|
445
|
-
width: 100%;
|
446
|
-
}
|
447
|
-
|
448
|
-
th {
|
449
|
-
text-align: center;
|
450
|
-
border-top: 1px solid #FB7A31;
|
451
|
-
border-bottom: 1px solid #FB7A31;
|
452
|
-
background: #FFC;
|
453
|
-
padding: 0.3em;
|
454
|
-
border-left: 1px solid silver;
|
455
|
-
}
|
456
|
-
|
457
|
-
tr.break td {
|
458
|
-
border: 0;
|
459
|
-
border-top: 1px solid #FB7A31;
|
460
|
-
padding: 0;
|
461
|
-
margin: 0;
|
462
|
-
}
|
463
|
-
|
464
|
-
tr.method td {
|
465
|
-
font-weight: bold;
|
466
|
-
}
|
467
|
-
|
468
|
-
td {
|
469
|
-
padding: 0.3em;
|
470
|
-
}
|
471
|
-
|
472
|
-
td:first-child {
|
473
|
-
width: 190px;
|
474
|
-
}
|
475
|
-
|
476
|
-
td {
|
477
|
-
border-left: 1px solid #CCC;
|
478
|
-
text-align: center;
|
479
|
-
}
|
480
|
-
|
481
|
-
.method_name {
|
482
|
-
text-align: left;
|
483
|
-
}
|
484
|
-
|
485
|
-
tfoot td {
|
486
|
-
text-align: left;
|
487
|
-
}
|
488
|
-
</style>
|
489
|
-
</head>
|
490
|
-
<body>
|
491
|
-
<h1>Profile Report</h1>
|
492
|
-
<!-- Threads Table -->
|
493
|
-
<table>
|
494
|
-
<tr>
|
495
|
-
<th>Thread ID</th>
|
496
|
-
<% if RUBY_VERSION >= "1.9" %>
|
497
|
-
<th>Fiber ID</th>
|
498
|
-
<% end %>
|
499
|
-
<th>Total Time</th>
|
500
|
-
</tr>
|
501
|
-
<% for thread in @result.threads %>
|
502
|
-
<tr>
|
503
|
-
<% if RUBY_VERSION >= "1.9" %>
|
504
|
-
<td><%= thread.id %></td>
|
505
|
-
<% end %>
|
506
|
-
<td><a href="#<%= thread.fiber_id %>"><%= thread.fiber_id %></a></td>
|
507
|
-
<td><%= thread.total_time %></td>
|
508
|
-
</tr>
|
509
|
-
<% end %>
|
510
|
-
</table>
|
511
|
-
|
512
|
-
<!-- Methods Tables -->
|
513
|
-
<% for thread in @result.threads
|
514
|
-
methods = thread.methods
|
515
|
-
total_time = thread.total_time %>
|
516
|
-
<% if RUBY_VERSION >= "1.9" %>
|
517
|
-
<h2><a name="<%= thread.fiber_id %>">Thread <%= thread.id %>, Fiber: <%= thread.fiber_id %></a></h2>
|
518
|
-
<% else %>
|
519
|
-
<h2><a name="<%= thread.fiber_id %>">Thread <%= thread.fiber_id %></a></h2>
|
520
|
-
<% end %>
|
521
|
-
<table>
|
522
|
-
<thead>
|
523
|
-
<tr>
|
524
|
-
<th><%= sprintf("%#{PERCENTAGE_WIDTH}s", "%Total") %></th>
|
525
|
-
<th><%= sprintf("%#{PERCENTAGE_WIDTH}s", "%Self") %></th>
|
526
|
-
<th><%= sprintf("%#{TIME_WIDTH}s", "Total") %></th>
|
527
|
-
<th><%= sprintf("%#{TIME_WIDTH}s", "Self") %></th>
|
528
|
-
<th><%= sprintf("%#{TIME_WIDTH}s", "Wait") %></th>
|
529
|
-
<th><%= sprintf("%#{TIME_WIDTH+2}s", "Child") %></th>
|
530
|
-
<th><%= sprintf("%#{CALL_WIDTH}s", "Calls") %></th>
|
531
|
-
<th class="method_name">Name</th>
|
532
|
-
<th>Line</th>
|
533
|
-
</tr>
|
534
|
-
</thead>
|
535
|
-
|
536
|
-
<tbody>
|
537
|
-
<% min_time = @options[:min_time] || (@options[:nonzero] ? 0.005 : nil)
|
538
|
-
methods.sort_by(&sort_method).reverse_each do |method|
|
539
|
-
total_percentage = (method.total_time/total_time) * 100
|
540
|
-
next if total_percentage < min_percent
|
541
|
-
next if min_time && method.total_time < min_time
|
542
|
-
self_percentage = (method.self_time/total_time) * 100 %>
|
543
|
-
|
544
|
-
<!-- Parents -->
|
545
|
-
<% for caller in method.aggregate_parents.sort_by(&:total_time)
|
546
|
-
next unless caller.parent
|
547
|
-
next if min_time && caller.total_time < min_time %>
|
548
|
-
<tr>
|
549
|
-
<td>&nbsp;</td>
|
550
|
-
<td>&nbsp;</td>
|
551
|
-
<td><%= sprintf("%#{TIME_WIDTH}.2f", caller.total_time) %></td>
|
552
|
-
<td><%= sprintf("%#{TIME_WIDTH}.2f", caller.self_time) %></td>
|
553
|
-
<td><%= sprintf("%#{TIME_WIDTH}.2f", caller.wait_time) %></td>
|
554
|
-
<td><%= sprintf("%#{TIME_WIDTH}.2f", caller.children_time) %></td>
|
555
|
-
<% called = "#{caller.called}/#{method.called}" %>
|
556
|
-
<td><%= sprintf("%#{CALL_WIDTH}s", called) %></td>
|
557
|
-
<td class="method_name"><%= create_link(thread, total_time, caller.parent.target) %></td>
|
558
|
-
<td><%= file_link(caller.parent.target.source_file, caller.line) %></td>
|
559
|
-
</tr>
|
560
|
-
<% end %>
|
561
|
-
|
562
|
-
<tr class="method">
|
563
|
-
<td><%= sprintf("%#{PERCENTAGE_WIDTH-1}.2f\%", total_percentage) %></td>
|
564
|
-
<td><%= sprintf("%#{PERCENTAGE_WIDTH-1}.2f\%", self_percentage) %></td>
|
565
|
-
<td><%= sprintf("%#{TIME_WIDTH}.2f", method.total_time) %></td>
|
566
|
-
<td><%= sprintf("%#{TIME_WIDTH}.2f", method.self_time) %></td>
|
567
|
-
<td><%= sprintf("%#{TIME_WIDTH}.2f", method.wait_time) %></td>
|
568
|
-
<td><%= sprintf("%#{TIME_WIDTH}.2f", method.children_time) %></td>
|
569
|
-
<td><%= sprintf("%#{CALL_WIDTH}i", method.called) %></td>
|
570
|
-
<td class="method_name">
|
571
|
-
<a name="<%= method_href(thread, method) %>">
|
572
|
-
<%= method.recursive? ? "*" : " "%><%= h method.full_name %>
|
573
|
-
</a>
|
574
|
-
</td>
|
575
|
-
<td><%= file_link(method.source_file, method.line) %></td>
|
576
|
-
</tr>
|
577
|
-
|
578
|
-
<!-- Children -->
|
579
|
-
<% for callee in method.aggregate_children.sort_by(&:total_time).reverse %>
|
580
|
-
<% next if min_time && callee.total_time < min_time %>
|
581
|
-
<tr>
|
582
|
-
<td>&nbsp;</td>
|
583
|
-
<td>&nbsp;</td>
|
584
|
-
<td><%= sprintf("%#{TIME_WIDTH}.2f", callee.total_time) %></td>
|
585
|
-
<td><%= sprintf("%#{TIME_WIDTH}.2f", callee.self_time) %></td>
|
586
|
-
<td><%= sprintf("%#{TIME_WIDTH}.2f", callee.wait_time) %></td>
|
587
|
-
<td><%= sprintf("%#{TIME_WIDTH}.2f", callee.children_time) %></td>
|
588
|
-
<% called = "#{callee.called}/#{callee.target.called}" %>
|
589
|
-
<td><%= sprintf("%#{CALL_WIDTH}s", called) %></td>
|
590
|
-
<td class="method_name"><%= create_link(thread, total_time, callee.target) %></td>
|
591
|
-
<td><%= file_link(method.source_file, callee.line) %></td>
|
592
|
-
</tr>
|
593
|
-
<% end %>
|
594
|
-
<!-- Create divider row -->
|
595
|
-
<tr class="break"><td colspan="9"></td></tr>
|
596
|
-
<% end %>
|
597
|
-
</tbody>
|
598
|
-
<tfoot>
|
599
|
-
<tr>
|
600
|
-
<td colspan="9">* indicates recursively called methods</td>
|
601
|
-
</tr>
|
602
|
-
</tfoot>
|
603
|
-
</table>
|
604
|
-
<% end %>
|
605
|
-
</body>
|
606
|
-
</html>'</span>
|
607
|
-
<span class="ruby-keyword">end</span></pre>
|
608
|
-
</div><!-- template-source -->
|
609
|
-
|
610
|
-
</div>
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
</div><!-- template-method -->
|
616
|
-
|
617
|
-
|
618
|
-
</section><!-- public-instance-method-details -->
|
619
|
-
|
620
|
-
</section><!-- 5Buntitled-5D -->
|
621
|
-
|
622
|
-
</div><!-- documentation -->
|
623
|
-
|
624
|
-
|
625
|
-
<footer id="validator-badges">
|
626
|
-
<p><a href="http://validator.w3.org/check/referer">[Validate]</a>
|
627
|
-
<p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.12.1.
|
628
|
-
<p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
|
629
|
-
</footer>
|
630
|
-
|