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