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