ruby-prof 0.13.1 → 0.14.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 +4 -4
- data/CHANGES +14 -0
- data/README.rdoc +1 -1
- data/Rakefile +2 -3
- data/bin/ruby-prof +4 -4
- data/bin/ruby-prof-check-trace +45 -0
- data/doc/LICENSE.html +49 -88
- data/doc/README_rdoc.html +92 -106
- data/doc/Rack.html +47 -116
- data/doc/Rack/RubyProf.html +119 -174
- data/doc/RubyProf.html +184 -216
- data/doc/RubyProf/AbstractPrinter.html +131 -162
- data/doc/RubyProf/AggregateCallInfo.html +136 -166
- data/doc/RubyProf/CallInfo.html +113 -154
- data/doc/RubyProf/CallInfoPrinter.html +56 -123
- data/doc/RubyProf/CallInfoVisitor.html +87 -216
- data/doc/RubyProf/CallStackPrinter.html +222 -215
- data/doc/RubyProf/CallTreePrinter.html +91 -142
- data/doc/RubyProf/Cmd.html +115 -157
- data/doc/RubyProf/DotPrinter.html +88 -140
- data/doc/RubyProf/FlatPrinter.html +66 -129
- data/doc/RubyProf/FlatPrinterWithLineNumbers.html +69 -132
- data/doc/RubyProf/GraphHtmlPrinter.html +115 -166
- data/doc/RubyProf/GraphPrinter.html +58 -125
- data/doc/RubyProf/MethodInfo.html +147 -172
- data/doc/RubyProf/MultiPrinter.html +104 -150
- data/doc/RubyProf/Profile.html +125 -179
- data/doc/RubyProf/ProfileTask.html +117 -157
- data/doc/RubyProf/Test.html +115 -154
- data/doc/RubyProf/Thread.html +87 -147
- data/doc/created.rid +13 -14
- data/doc/examples/flat_txt.html +51 -90
- data/doc/examples/graph_html.html +852 -0
- data/doc/examples/graph_txt.html +64 -92
- data/doc/fonts.css +167 -0
- 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/delete.png +0 -0
- data/doc/images/tag_blue.png +0 -0
- data/doc/index.html +75 -65
- data/doc/js/darkfish.js +0 -15
- data/doc/js/search.js +20 -5
- data/doc/js/search_index.js +1 -1
- data/doc/rdoc.css +255 -218
- data/doc/table_of_contents.html +751 -353
- data/ext/ruby_prof/extconf.rb +20 -22
- data/ext/ruby_prof/rp_measure_allocations.c +9 -5
- data/ext/ruby_prof/rp_measure_gc_runs.c +8 -0
- data/ext/ruby_prof/rp_measure_gc_time.c +5 -2
- data/ext/ruby_prof/rp_measure_wall_time.c +1 -0
- data/ext/ruby_prof/rp_method.c +0 -9
- data/ext/ruby_prof/rp_method.h +1 -6
- data/ext/ruby_prof/ruby_prof.c +32 -112
- data/ext/ruby_prof/ruby_prof.h +9 -10
- data/lib/ruby-prof.rb +2 -1
- data/lib/ruby-prof/aggregate_call_info.rb +4 -6
- data/lib/ruby-prof/call_info_visitor.rb +42 -44
- data/lib/ruby-prof/printers/graph_html_printer.rb +0 -8
- data/lib/ruby-prof/profile.rb +4 -4
- data/lib/ruby-prof/rack.rb +47 -47
- data/lib/ruby-prof/task.rb +0 -0
- data/lib/ruby-prof/thread.rb +22 -22
- data/lib/ruby-prof/version.rb +3 -0
- data/ruby-prof.gemspec +7 -11
- data/test/call_info_test.rb +78 -78
- data/test/call_info_visitor_test.rb +31 -31
- data/test/fiber_test.rb +2 -2
- data/test/measure_gc_runs_test.rb +1 -1
- data/test/measure_process_time_test.rb +7 -6
- data/test/printers_test.rb +4 -8
- data/test/recursive_test.rb +5 -9
- data/test/test_helper.rb +1 -1
- data/test/unique_call_path_test.rb +7 -29
- data/test/yarv_test.rb +55 -0
- metadata +63 -55
- data/ext/ruby_prof/version.h +0 -7
- data/lib/ruby-prof/test.rb +0 -150
- data/test/exec_test.rb +0 -14
- data/test/test_suite.rb +0 -37
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 58c4eddbefb502b7fc6aed63c60bd88dff0aab16
|
4
|
+
data.tar.gz: 47f65276f52c83ab7b9cd52ef5d8ac9371eac8fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a172ee75e538707c82fc6981ebdd1ec7c5d4c65a9e815b5d1dc63da24f42110b3526de030d44dc531771abb006feee0de34766ee3f6b7d80c577dd2ab4cb543
|
7
|
+
data.tar.gz: 56b30d0dd96628fac0ccc19308a0a44db2d5045e21edf09e361fe2fb0a0a891c134c0e33800ce2f55869d97ca9172527af1bfbad2a989f804d8117e26ef102aa
|
data/CHANGES
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
0.14.0 (2012-01-02)
|
2
|
+
======================
|
3
|
+
* support ruby 2.1.0
|
4
|
+
* dropped support for 1.8.x, 1.9.1 and 1.9.2
|
5
|
+
|
6
|
+
0.13.1 (2013-12-14)
|
7
|
+
======================
|
8
|
+
* speed up for displaying large call stacks (Benjamin Quoming)
|
9
|
+
|
10
|
+
0.13 (2013-03-10)
|
11
|
+
======================
|
12
|
+
* support fibers on 1.9.x+
|
13
|
+
* improved display for very wide call stacks (Sammy Larbi)
|
14
|
+
|
1
15
|
0.12.2 (2013-02-13)
|
2
16
|
======================
|
3
17
|
* Fixed segfault when using falcon or railsexpress patches for 1.9.3
|
data/README.rdoc
CHANGED
@@ -16,7 +16,7 @@ ruby-prof is a fast code profiler for Ruby. Its features include:
|
|
16
16
|
|
17
17
|
== Requirements
|
18
18
|
|
19
|
-
ruby-prof requires Ruby 1.
|
19
|
+
ruby-prof requires Ruby 1.9.3 or higher.
|
20
20
|
|
21
21
|
If you are running Linux or Unix you'll need a C compiler so the extension
|
22
22
|
can be compiled when it is installed.
|
data/Rakefile
CHANGED
@@ -15,7 +15,7 @@ rescue LoadError
|
|
15
15
|
end
|
16
16
|
|
17
17
|
# To release a version of ruby-prof:
|
18
|
-
# * Update version.
|
18
|
+
# * Update lib/ruby-prof/version.rb
|
19
19
|
# * Update CHANGES
|
20
20
|
# * git commit to commit files
|
21
21
|
# * rake clobber to remove extra files
|
@@ -85,7 +85,6 @@ RDoc::Task.new("rdoc") do |rdoc|
|
|
85
85
|
'examples/graph.html',
|
86
86
|
'lib/**/*.rb',
|
87
87
|
'ext/ruby_prof/ruby_prof.c',
|
88
|
-
'ext/ruby_prof/version.h',
|
89
88
|
'ext/ruby_prof/measure_*.h',
|
90
89
|
'README.rdoc',
|
91
90
|
'LICENSE')
|
@@ -104,7 +103,7 @@ end
|
|
104
103
|
desc 'Run the ruby-prof test suite'
|
105
104
|
Rake::TestTask.new do |t|
|
106
105
|
t.libs += %w(lib ext test)
|
107
|
-
t.test_files = Dir['test
|
106
|
+
t.test_files = Dir['test/**_test.rb']
|
108
107
|
t.verbose = true
|
109
108
|
t.warning = true
|
110
109
|
end
|
data/bin/ruby-prof
CHANGED
@@ -149,7 +149,7 @@ module RubyProf
|
|
149
149
|
options.replace_prog_name = true
|
150
150
|
end
|
151
151
|
|
152
|
-
if defined?(
|
152
|
+
if defined?(RubyVM)
|
153
153
|
opts.on("--specialized-instruction", "Turn on specified instruction.") do
|
154
154
|
options.specialized_instruction = true
|
155
155
|
end
|
@@ -273,8 +273,8 @@ module RubyProf
|
|
273
273
|
end
|
274
274
|
|
275
275
|
# Set VM compile option
|
276
|
-
if defined?(
|
277
|
-
|
276
|
+
if defined?(RubyVM)
|
277
|
+
RubyVM::InstructionSequence.compile_option = {
|
278
278
|
:trace_instruction => true,
|
279
279
|
:specialized_instruction => options.specialized_instruction
|
280
280
|
}
|
@@ -326,4 +326,4 @@ at_exit {
|
|
326
326
|
}
|
327
327
|
|
328
328
|
# Now profile some code
|
329
|
-
cmd.run
|
329
|
+
cmd.run
|
@@ -0,0 +1,45 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
stacks = Hash.new{|h,k| h[k] = Hash.new{|h,k| h[k] = []}}
|
4
|
+
i = 0
|
5
|
+
File.open(ARGV[0]).each_line do |l|
|
6
|
+
i += 1
|
7
|
+
unless l =~ /^(\d+):(\d+): *\d+ms *([^ ]+) *(.*): *(\d+) *(.+)$/
|
8
|
+
next if l =~/^ *$/
|
9
|
+
puts "line doesn't match: #{l}"
|
10
|
+
next
|
11
|
+
end
|
12
|
+
details = $1.to_i, $2.to_i, $3, $4, $5.to_i, $6
|
13
|
+
thread, fiber, event, file, line, method = *details
|
14
|
+
# puts method
|
15
|
+
stack = stacks[thread][fiber]
|
16
|
+
case event
|
17
|
+
when 'call', 'c-call'
|
18
|
+
stack << method
|
19
|
+
when 'return', 'c-return'
|
20
|
+
last_method = stack.pop
|
21
|
+
if last_method != method
|
22
|
+
puts "LINE #{i}: return event without call: #{method}"
|
23
|
+
puts "STACK: #{stack.inspect}"
|
24
|
+
if stack.find(method)
|
25
|
+
puts "fixing stack"
|
26
|
+
while (popped = stack.pop) && (popped != method)
|
27
|
+
puts "popped #{popped}"
|
28
|
+
end
|
29
|
+
else
|
30
|
+
raise "stack unfixable"
|
31
|
+
end
|
32
|
+
# stack << last_method
|
33
|
+
end
|
34
|
+
when 'line'
|
35
|
+
last_method = stack[-1]
|
36
|
+
if last_method != method
|
37
|
+
unless stack.find(method)
|
38
|
+
raise "LINE #{i}: line event without call: #{method}"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
else
|
42
|
+
puts "unkown event"
|
43
|
+
end
|
44
|
+
end
|
45
|
+
puts stacks.inspect
|
data/doc/LICENSE.html
CHANGED
@@ -2,121 +2,83 @@
|
|
2
2
|
|
3
3
|
<html>
|
4
4
|
<head>
|
5
|
-
<meta
|
5
|
+
<meta charset="UTF-8">
|
6
6
|
|
7
7
|
<title>LICENSE - ruby-prof</title>
|
8
8
|
|
9
|
-
<link
|
9
|
+
<link href="./fonts.css" rel="stylesheet">
|
10
|
+
<link href="./rdoc.css" rel="stylesheet">
|
10
11
|
|
11
12
|
<script type="text/javascript">
|
12
13
|
var rdoc_rel_prefix = "./";
|
13
14
|
</script>
|
14
15
|
|
15
|
-
<script
|
16
|
-
<script
|
17
|
-
<script
|
18
|
-
<script
|
19
|
-
<script
|
20
|
-
<script
|
16
|
+
<script src="./js/jquery.js"></script>
|
17
|
+
<script src="./js/navigation.js"></script>
|
18
|
+
<script src="./js/search_index.js"></script>
|
19
|
+
<script src="./js/search.js"></script>
|
20
|
+
<script src="./js/searcher.js"></script>
|
21
|
+
<script src="./js/darkfish.js"></script>
|
21
22
|
|
22
23
|
|
23
|
-
<body class="file">
|
24
|
-
<nav
|
25
|
-
<
|
26
|
-
|
27
|
-
|
24
|
+
<body id="top" role="document" class="file">
|
25
|
+
<nav role="navigation">
|
26
|
+
<div id="project-navigation">
|
27
|
+
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
28
|
+
<h2>
|
29
|
+
<a href="./index.html" rel="home">Home</a>
|
30
|
+
</h2>
|
31
|
+
|
32
|
+
<div id="table-of-contents-navigation">
|
33
|
+
<a href="./table_of_contents.html#pages">Pages</a>
|
28
34
|
<a href="./table_of_contents.html#classes">Classes</a>
|
29
35
|
<a href="./table_of_contents.html#methods">Methods</a>
|
30
|
-
</
|
31
|
-
</
|
32
|
-
|
36
|
+
</div>
|
37
|
+
</div>
|
33
38
|
|
34
|
-
|
39
|
+
<div id="search-section" role="search" class="project-section initially-hidden">
|
35
40
|
<form action="#" method="get" accept-charset="utf-8">
|
36
|
-
<
|
37
|
-
<input
|
41
|
+
<div id="search-field-wrapper">
|
42
|
+
<input id="search-field" role="combobox" aria-label="Search"
|
43
|
+
aria-autocomplete="list" aria-controls="search-results"
|
44
|
+
type="text" name="search" placeholder="Search" spellcheck="false"
|
38
45
|
title="Type to search, Up and Down to navigate, Enter to load">
|
39
|
-
</
|
40
|
-
</form>
|
41
|
-
|
42
|
-
<ul id="search-results" class="initially-hidden"></ul>
|
43
|
-
</nav>
|
46
|
+
</div>
|
44
47
|
|
48
|
+
<ul id="search-results" aria-label="Search Results"
|
49
|
+
aria-busy="false" aria-expanded="false"
|
50
|
+
aria-atomic="false" class="initially-hidden"></ul>
|
51
|
+
</form>
|
52
|
+
</div>
|
45
53
|
|
46
|
-
|
47
|
-
<nav id="fileindex-section" class="section project-section">
|
48
|
-
<h3 class="section-header">Pages</h3>
|
54
|
+
</div>
|
49
55
|
|
50
|
-
<ul>
|
51
|
-
|
52
|
-
<li class="file"><a href="./LICENSE.html">LICENSE</a>
|
53
|
-
|
54
|
-
<li class="file"><a href="./README_rdoc.html">README</a>
|
55
|
-
|
56
|
-
<li class="file"><a href="./examples/flat_txt.html">flat</a>
|
57
|
-
|
58
|
-
<li class="file"><a href="./examples/graph_txt.html">graph</a>
|
59
56
|
|
60
|
-
</ul>
|
61
|
-
</nav>
|
62
57
|
|
63
|
-
|
64
|
-
|
58
|
+
<div id="project-metadata">
|
59
|
+
<div id="fileindex-section" class="nav-section">
|
60
|
+
<h3>Pages</h3>
|
65
61
|
|
66
62
|
<ul class="link-list">
|
67
63
|
|
68
|
-
<li><a href="./
|
69
|
-
|
70
|
-
<li><a href="./RubyProf/AbstractPrinter.html">RubyProf::AbstractPrinter</a>
|
71
|
-
|
72
|
-
<li><a href="./RubyProf/AggregateCallInfo.html">RubyProf::AggregateCallInfo</a>
|
64
|
+
<li><a href="./LICENSE.html">LICENSE</a>
|
73
65
|
|
74
|
-
<li><a href="./
|
66
|
+
<li><a href="./README_rdoc.html">README</a>
|
75
67
|
|
76
|
-
<li><a href="./
|
68
|
+
<li><a href="./examples/flat_txt.html">flat</a>
|
77
69
|
|
78
|
-
<li><a href="./
|
70
|
+
<li><a href="./examples/graph_html.html">graph.html</a>
|
79
71
|
|
80
|
-
<li><a href="./
|
81
|
-
|
82
|
-
<li><a href="./RubyProf/CallTreePrinter.html">RubyProf::CallTreePrinter</a>
|
83
|
-
|
84
|
-
<li><a href="./RubyProf/Cmd.html">RubyProf::Cmd</a>
|
85
|
-
|
86
|
-
<li><a href="./RubyProf/DotPrinter.html">RubyProf::DotPrinter</a>
|
87
|
-
|
88
|
-
<li><a href="./RubyProf/FlatPrinter.html">RubyProf::FlatPrinter</a>
|
89
|
-
|
90
|
-
<li><a href="./RubyProf/FlatPrinterWithLineNumbers.html">RubyProf::FlatPrinterWithLineNumbers</a>
|
91
|
-
|
92
|
-
<li><a href="./RubyProf/GraphHtmlPrinter.html">RubyProf::GraphHtmlPrinter</a>
|
93
|
-
|
94
|
-
<li><a href="./RubyProf/GraphPrinter.html">RubyProf::GraphPrinter</a>
|
95
|
-
|
96
|
-
<li><a href="./RubyProf/MethodInfo.html">RubyProf::MethodInfo</a>
|
97
|
-
|
98
|
-
<li><a href="./RubyProf/MultiPrinter.html">RubyProf::MultiPrinter</a>
|
99
|
-
|
100
|
-
<li><a href="./RubyProf/Profile.html">RubyProf::Profile</a>
|
101
|
-
|
102
|
-
<li><a href="./RubyProf/ProfileTask.html">RubyProf::ProfileTask</a>
|
103
|
-
|
104
|
-
<li><a href="./RubyProf/Test.html">RubyProf::Test</a>
|
105
|
-
|
106
|
-
<li><a href="./RubyProf/Thread.html">RubyProf::Thread</a>
|
107
|
-
|
108
|
-
<li><a href="./Rack.html">Rack</a>
|
109
|
-
|
110
|
-
<li><a href="./Rack/RubyProf.html">Rack::RubyProf</a>
|
72
|
+
<li><a href="./examples/graph_txt.html">graph</a>
|
111
73
|
|
112
74
|
</ul>
|
113
|
-
</
|
75
|
+
</div>
|
114
76
|
|
115
77
|
</div>
|
116
78
|
</nav>
|
117
79
|
|
118
|
-
<
|
119
|
-
|
80
|
+
<main role="main" aria-label="Page LICENSE">
|
81
|
+
|
120
82
|
<p>Copyright (C) 2005 - 20011 Shugo Maeda <shugo@ruby-lang.org> and
|
121
83
|
Charlie Savage <cfis@savagexi.com> All rights reserved.</p>
|
122
84
|
|
@@ -142,14 +104,13 @@ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
142
104
|
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
143
105
|
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
144
106
|
DAMAGE.</p>
|
145
|
-
|
146
|
-
</div>
|
107
|
+
</main>
|
147
108
|
|
148
109
|
|
149
110
|
|
150
|
-
<footer id="validator-badges">
|
151
|
-
<p><a href="http://validator.w3.org/check/referer">
|
152
|
-
<p>Generated by <a href="
|
153
|
-
<p>
|
111
|
+
<footer id="validator-badges" role="contentinfo">
|
112
|
+
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
113
|
+
<p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> 4.1.0.
|
114
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
154
115
|
</footer>
|
155
116
|
|
data/doc/README_rdoc.html
CHANGED
@@ -2,128 +2,115 @@
|
|
2
2
|
|
3
3
|
<html>
|
4
4
|
<head>
|
5
|
-
<meta
|
5
|
+
<meta charset="UTF-8">
|
6
6
|
|
7
7
|
<title>README - ruby-prof</title>
|
8
8
|
|
9
|
-
<link
|
9
|
+
<link href="./fonts.css" rel="stylesheet">
|
10
|
+
<link href="./rdoc.css" rel="stylesheet">
|
10
11
|
|
11
12
|
<script type="text/javascript">
|
12
13
|
var rdoc_rel_prefix = "./";
|
13
14
|
</script>
|
14
15
|
|
15
|
-
<script
|
16
|
-
<script
|
17
|
-
<script
|
18
|
-
<script
|
19
|
-
<script
|
20
|
-
<script
|
16
|
+
<script src="./js/jquery.js"></script>
|
17
|
+
<script src="./js/navigation.js"></script>
|
18
|
+
<script src="./js/search_index.js"></script>
|
19
|
+
<script src="./js/search.js"></script>
|
20
|
+
<script src="./js/searcher.js"></script>
|
21
|
+
<script src="./js/darkfish.js"></script>
|
21
22
|
|
22
23
|
|
23
|
-
<body class="file">
|
24
|
-
<nav
|
25
|
-
<
|
26
|
-
|
27
|
-
|
24
|
+
<body id="top" role="document" class="file">
|
25
|
+
<nav role="navigation">
|
26
|
+
<div id="project-navigation">
|
27
|
+
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
28
|
+
<h2>
|
29
|
+
<a href="./index.html" rel="home">Home</a>
|
30
|
+
</h2>
|
31
|
+
|
32
|
+
<div id="table-of-contents-navigation">
|
33
|
+
<a href="./table_of_contents.html#pages">Pages</a>
|
28
34
|
<a href="./table_of_contents.html#classes">Classes</a>
|
29
35
|
<a href="./table_of_contents.html#methods">Methods</a>
|
30
|
-
</
|
31
|
-
</
|
32
|
-
|
36
|
+
</div>
|
37
|
+
</div>
|
33
38
|
|
34
|
-
|
39
|
+
<div id="search-section" role="search" class="project-section initially-hidden">
|
35
40
|
<form action="#" method="get" accept-charset="utf-8">
|
36
|
-
<
|
37
|
-
<input
|
41
|
+
<div id="search-field-wrapper">
|
42
|
+
<input id="search-field" role="combobox" aria-label="Search"
|
43
|
+
aria-autocomplete="list" aria-controls="search-results"
|
44
|
+
type="text" name="search" placeholder="Search" spellcheck="false"
|
38
45
|
title="Type to search, Up and Down to navigate, Enter to load">
|
39
|
-
</
|
40
|
-
</form>
|
41
|
-
|
42
|
-
<ul id="search-results" class="initially-hidden"></ul>
|
43
|
-
</nav>
|
46
|
+
</div>
|
44
47
|
|
48
|
+
<ul id="search-results" aria-label="Search Results"
|
49
|
+
aria-busy="false" aria-expanded="false"
|
50
|
+
aria-atomic="false" class="initially-hidden"></ul>
|
51
|
+
</form>
|
52
|
+
</div>
|
45
53
|
|
46
|
-
|
47
|
-
<nav id="fileindex-section" class="section project-section">
|
48
|
-
<h3 class="section-header">Pages</h3>
|
54
|
+
</div>
|
49
55
|
|
50
|
-
<ul>
|
51
|
-
|
52
|
-
<li class="file"><a href="./LICENSE.html">LICENSE</a>
|
53
|
-
|
54
|
-
<li class="file"><a href="./README_rdoc.html">README</a>
|
55
|
-
|
56
|
-
<li class="file"><a href="./examples/flat_txt.html">flat</a>
|
57
|
-
|
58
|
-
<li class="file"><a href="./examples/graph_txt.html">graph</a>
|
59
56
|
|
57
|
+
<div class="nav-section">
|
58
|
+
<h3>Table of Contents</h3>
|
59
|
+
|
60
|
+
<ul class="link-list" role="directory">
|
61
|
+
<li><a href="#label-ruby-prof">ruby-prof</a>
|
62
|
+
<li><a href="#label-Overview">Overview</a>
|
63
|
+
<li><a href="#label-Requirements">Requirements</a>
|
64
|
+
<li><a href="#label-Install">Install</a>
|
65
|
+
<li><a href="#label-Usage">Usage</a>
|
66
|
+
<li><a href="#label-ruby-prof+executable">ruby-prof executable</a>
|
67
|
+
<li><a href="#label-ruby-prof+API">ruby-prof API</a>
|
68
|
+
<li><a href="#label-Method+and+Thread+Elimination">Method and Thread Elimination</a>
|
69
|
+
<li><a href="#label-Benchmarking+full+load+time+including+rubygems+startup+cost+%3D%3D">Benchmarking full load time including rubygems startup cost ==</a>
|
70
|
+
<li><a href="#label-Profiling+Tests">Profiling Tests</a>
|
71
|
+
<li><a href="#label-Profiling+Rails">Profiling Rails</a>
|
72
|
+
<li><a href="#label-Reports">Reports</a>
|
73
|
+
<li><a href="#label-Printers">Printers</a>
|
74
|
+
<li><a href="#label-Measurements">Measurements</a>
|
75
|
+
<li><a href="#label-Multi-threaded+Applications">Multi-threaded Applications</a>
|
76
|
+
<li><a href="#label-Performance">Performance</a>
|
77
|
+
<li><a href="#label-License">License</a>
|
78
|
+
<li><a href="#label-Development">Development</a>
|
60
79
|
</ul>
|
61
|
-
</
|
80
|
+
</div>
|
81
|
+
|
62
82
|
|
63
|
-
|
64
|
-
|
83
|
+
<div id="project-metadata">
|
84
|
+
<div id="fileindex-section" class="nav-section">
|
85
|
+
<h3>Pages</h3>
|
65
86
|
|
66
87
|
<ul class="link-list">
|
67
88
|
|
68
|
-
<li><a href="./
|
69
|
-
|
70
|
-
<li><a href="./RubyProf/AbstractPrinter.html">RubyProf::AbstractPrinter</a>
|
71
|
-
|
72
|
-
<li><a href="./RubyProf/AggregateCallInfo.html">RubyProf::AggregateCallInfo</a>
|
89
|
+
<li><a href="./LICENSE.html">LICENSE</a>
|
73
90
|
|
74
|
-
<li><a href="./
|
91
|
+
<li><a href="./README_rdoc.html">README</a>
|
75
92
|
|
76
|
-
<li><a href="./
|
93
|
+
<li><a href="./examples/flat_txt.html">flat</a>
|
77
94
|
|
78
|
-
<li><a href="./
|
95
|
+
<li><a href="./examples/graph_html.html">graph.html</a>
|
79
96
|
|
80
|
-
<li><a href="./
|
81
|
-
|
82
|
-
<li><a href="./RubyProf/CallTreePrinter.html">RubyProf::CallTreePrinter</a>
|
83
|
-
|
84
|
-
<li><a href="./RubyProf/Cmd.html">RubyProf::Cmd</a>
|
85
|
-
|
86
|
-
<li><a href="./RubyProf/DotPrinter.html">RubyProf::DotPrinter</a>
|
87
|
-
|
88
|
-
<li><a href="./RubyProf/FlatPrinter.html">RubyProf::FlatPrinter</a>
|
89
|
-
|
90
|
-
<li><a href="./RubyProf/FlatPrinterWithLineNumbers.html">RubyProf::FlatPrinterWithLineNumbers</a>
|
91
|
-
|
92
|
-
<li><a href="./RubyProf/GraphHtmlPrinter.html">RubyProf::GraphHtmlPrinter</a>
|
93
|
-
|
94
|
-
<li><a href="./RubyProf/GraphPrinter.html">RubyProf::GraphPrinter</a>
|
95
|
-
|
96
|
-
<li><a href="./RubyProf/MethodInfo.html">RubyProf::MethodInfo</a>
|
97
|
-
|
98
|
-
<li><a href="./RubyProf/MultiPrinter.html">RubyProf::MultiPrinter</a>
|
99
|
-
|
100
|
-
<li><a href="./RubyProf/Profile.html">RubyProf::Profile</a>
|
101
|
-
|
102
|
-
<li><a href="./RubyProf/ProfileTask.html">RubyProf::ProfileTask</a>
|
103
|
-
|
104
|
-
<li><a href="./RubyProf/Test.html">RubyProf::Test</a>
|
105
|
-
|
106
|
-
<li><a href="./RubyProf/Thread.html">RubyProf::Thread</a>
|
107
|
-
|
108
|
-
<li><a href="./Rack.html">Rack</a>
|
109
|
-
|
110
|
-
<li><a href="./Rack/RubyProf.html">Rack::RubyProf</a>
|
97
|
+
<li><a href="./examples/graph_txt.html">graph</a>
|
111
98
|
|
112
99
|
</ul>
|
113
|
-
</
|
100
|
+
</div>
|
114
101
|
|
115
102
|
</div>
|
116
103
|
</nav>
|
117
104
|
|
118
|
-
<
|
119
|
-
|
120
|
-
<h1 id="label-ruby-prof">ruby-prof
|
105
|
+
<main role="main" aria-label="Page README.rdoc">
|
106
|
+
|
107
|
+
<h1 id="label-ruby-prof">ruby-prof<span><a href="#label-ruby-prof">¶</a> <a href="#documentation">↑</a></span></h1>
|
121
108
|
|
122
109
|
<p><a href="https://travis-ci.org/ruby-prof/ruby-prof"><img
|
123
110
|
src="https://travis-ci.org/ruby-prof/ruby-prof.png?branch=master"
|
124
111
|
alt="Build Status" /></a></p>
|
125
112
|
|
126
|
-
<h2 id="label-Overview">Overview
|
113
|
+
<h2 id="label-Overview">Overview<span><a href="#label-Overview">¶</a> <a href="#documentation">↑</a></span></h2>
|
127
114
|
|
128
115
|
<p>ruby-prof is a fast code profiler for Ruby. Its features include:</p>
|
129
116
|
<ul><li>
|
@@ -151,9 +138,9 @@ href="README_rdoc.html">README</a>.</p>
|
|
151
138
|
<p>Threads - supports profiling multiple threads simultaneously</p>
|
152
139
|
</li></ul>
|
153
140
|
|
154
|
-
<h2 id="label-Requirements">Requirements
|
141
|
+
<h2 id="label-Requirements">Requirements<span><a href="#label-Requirements">¶</a> <a href="#documentation">↑</a></span></h2>
|
155
142
|
|
156
|
-
<p>ruby-prof requires Ruby 1.
|
143
|
+
<p>ruby-prof requires Ruby 1.9.3 or higher.</p>
|
157
144
|
|
158
145
|
<p>If you are running Linux or Unix you'll need a C compiler so the
|
159
146
|
extension can be compiled when it is installed.</p>
|
@@ -162,7 +149,7 @@ extension can be compiled when it is installed.</p>
|
|
162
149
|
specific RubyGem which includes an already built extension (see Install
|
163
150
|
section).</p>
|
164
151
|
|
165
|
-
<h2 id="label-Install">Install
|
152
|
+
<h2 id="label-Install">Install<span><a href="#label-Install">¶</a> <a href="#documentation">↑</a></span></h2>
|
166
153
|
|
167
154
|
<p>The easiest way to install ruby-prof is by using Ruby Gems. To install:</p>
|
168
155
|
|
@@ -171,17 +158,17 @@ section).</p>
|
|
171
158
|
<p>If you're on windows then a prebuilt binary gem is available. You may
|
172
159
|
of course compile it yourself via use of devkit on MinGW.</p>
|
173
160
|
|
174
|
-
<h2 id="label-Usage">Usage
|
161
|
+
<h2 id="label-Usage">Usage<span><a href="#label-Usage">¶</a> <a href="#documentation">↑</a></span></h2>
|
175
162
|
|
176
163
|
<p>There are two ways of running ruby-prof, via the command line or via its
|
177
164
|
API.</p>
|
178
165
|
|
179
|
-
<h3 id="label-ruby-prof+executable">ruby-prof executable
|
166
|
+
<h3 id="label-ruby-prof+executable">ruby-prof executable<span><a href="#label-ruby-prof+executable">¶</a> <a href="#documentation">↑</a></span></h3>
|
180
167
|
|
181
168
|
<p>The first is to use ruby-prof to run the Ruby program you want to profile.
|
182
169
|
For more information refer to the documentation of the ruby-prof command.</p>
|
183
170
|
|
184
|
-
<h3 id="label-ruby-prof+API">ruby-prof API
|
171
|
+
<h3 id="label-ruby-prof+API">ruby-prof API<span><a href="#label-ruby-prof+API">¶</a> <a href="#documentation">↑</a></span></h3>
|
185
172
|
|
186
173
|
<p>The second way is to use the ruby-prof API to profile particular segments
|
187
174
|
of code.</p>
|
@@ -246,7 +233,7 @@ yet started. In addition, resume can also take a block:</p>
|
|
246
233
|
<p>With this usage, resume will automatically call pause at the end of the
|
247
234
|
block.</p>
|
248
235
|
|
249
|
-
<h2 id="label-Method+and+Thread+Elimination">Method and Thread Elimination
|
236
|
+
<h2 id="label-Method+and+Thread+Elimination">Method and Thread Elimination<span><a href="#label-Method+and+Thread+Elimination">¶</a> <a href="#documentation">↑</a></span></h2>
|
250
237
|
|
251
238
|
<p>ruby-prof supports eliminating specific methods and threads from profiling
|
252
239
|
results. This is useful for reducing connectivity in the call graph, making
|
@@ -281,7 +268,7 @@ RubyProf.start</pre>
|
|
281
268
|
<p>Note that the excluded threads must be specified <strong>before</strong>
|
282
269
|
profiling.</p>
|
283
270
|
|
284
|
-
<h2 id="label-Benchmarking+full+load+time+including+rubygems+startup+cost+%3D%3D">Benchmarking full load time including rubygems startup cost
|
271
|
+
<h2 id="label-Benchmarking+full+load+time+including+rubygems+startup+cost+%3D%3D">Benchmarking full load time including rubygems startup cost ==<span><a href="#label-Benchmarking+full+load+time+including+rubygems+startup+cost+%3D%3D">¶</a> <a href="#documentation">↑</a></span></h2>
|
285
272
|
|
286
273
|
<p>If you want to get a more accurate measurement of what takes all of a
|
287
274
|
gem's bin/xxx command to load, you may want to also measure
|
@@ -302,7 +289,7 @@ g:192binsome_installed_gem_command</p>
|
|
302
289
|
<p>$ ruby g:/192/lib/ruby/gems/1.9.1/gems/ruby-prof-0.10.2/bin/ruby-prof
|
303
290
|
./some_file_that_does_a_require_rubygems_at_the_beginning.rb</p>
|
304
291
|
|
305
|
-
<h2 id="label-Profiling+Tests">Profiling Tests
|
292
|
+
<h2 id="label-Profiling+Tests">Profiling Tests<span><a href="#label-Profiling+Tests">¶</a> <a href="#documentation">↑</a></span></h2>
|
306
293
|
|
307
294
|
<p>ruby-prof supports profiling tests cases written using Ruby's built-in
|
308
295
|
unit test framework (ie, test derived from Test::Unit::TestCase). To
|
@@ -322,7 +309,7 @@ profiling options, modify your test class's PROFILE_OPTIONS hash table.
|
|
322
309
|
To globally change test profiling options, modify
|
323
310
|
RubyProf::Test::PROFILE_OPTIONS.</p>
|
324
311
|
|
325
|
-
<h2 id="label-Profiling+Rails">Profiling Rails
|
312
|
+
<h2 id="label-Profiling+Rails">Profiling Rails<span><a href="#label-Profiling+Rails">¶</a> <a href="#documentation">↑</a></span></h2>
|
326
313
|
|
327
314
|
<p>To profile a Rails application it is vital to run it using production like
|
328
315
|
settings (cache classes, cache view lookups, etc.). Otherwise, Rail's
|
@@ -360,7 +347,7 @@ be generated for each request. Note that each request will overwrite the
|
|
360
347
|
profiling reports created by the previous request!</p>
|
361
348
|
</li></ol>
|
362
349
|
|
363
|
-
<h2 id="label-Reports">Reports
|
350
|
+
<h2 id="label-Reports">Reports<span><a href="#label-Reports">¶</a> <a href="#documentation">↑</a></span></h2>
|
364
351
|
|
365
352
|
<p>ruby-prof can generate a number of different reports:</p>
|
366
353
|
<ul><li>
|
@@ -416,7 +403,7 @@ href="http://github.com/ruby-prof/ruby-prof/tree/master/examples/multi.stack.htm
|
|
416
403
|
|
417
404
|
<p>There is also a graphviz .dot visualiser.</p>
|
418
405
|
|
419
|
-
<h2 id="label-Printers">Printers
|
406
|
+
<h2 id="label-Printers">Printers<span><a href="#label-Printers">¶</a> <a href="#documentation">↑</a></span></h2>
|
420
407
|
|
421
408
|
<p>Reports are created by printers. Supported printers include:</p>
|
422
409
|
<ul><li>
|
@@ -473,7 +460,7 @@ directory path and a basename for the files it produces.</p>
|
|
473
460
|
<span class="ruby-identifier">printer</span>.<span class="ruby-identifier">print</span>(:<span class="ruby-identifier">path</span> =<span class="ruby-operator">></span> <span class="ruby-string">"."</span>, :<span class="ruby-identifier">profile</span> =<span class="ruby-operator">></span> <span class="ruby-string">"profile"</span>)
|
474
461
|
</pre>
|
475
462
|
|
476
|
-
<h2 id="label-Measurements">Measurements
|
463
|
+
<h2 id="label-Measurements">Measurements<span><a href="#label-Measurements">¶</a> <a href="#documentation">↑</a></span></h2>
|
477
464
|
|
478
465
|
<p>Depending on the mode and platform, ruby-prof can measure various aspects
|
479
466
|
of a Ruby program. Supported measurements include:</p>
|
@@ -604,7 +591,7 @@ variable:</p>
|
|
604
591
|
|
605
592
|
<pre>RubyProf.cpu_frequency = <value></pre>
|
606
593
|
|
607
|
-
<h2 id="label-Multi-threaded+Applications">Multi-threaded Applications
|
594
|
+
<h2 id="label-Multi-threaded+Applications">Multi-threaded Applications<span><a href="#label-Multi-threaded+Applications">¶</a> <a href="#documentation">↑</a></span></h2>
|
608
595
|
|
609
596
|
<p>Unfortunately, Ruby does not provide an internal api for detecting thread
|
610
597
|
context switches in 1.8. As a result, the timings ruby-prof reports for
|
@@ -615,7 +602,7 @@ the 2 seconds will be assigned to the foreground thread and not the newly
|
|
615
602
|
created background thread. These errors can largely be avoided if the
|
616
603
|
background thread performs any operation before going to sleep.</p>
|
617
604
|
|
618
|
-
<h2 id="label-Performance">Performance
|
605
|
+
<h2 id="label-Performance">Performance<span><a href="#label-Performance">¶</a> <a href="#documentation">↑</a></span></h2>
|
619
606
|
|
620
607
|
<p>Significant effort has been put into reducing ruby-prof's overhead as
|
621
608
|
much as possible. Our tests show that the overhead associated with
|
@@ -623,11 +610,11 @@ profiling code varies considerably with the code being profiled. Most
|
|
623
610
|
programs will run approximately twice as slow while highly recursive
|
624
611
|
programs (like the fibonacci series test) will run three times slower.</p>
|
625
612
|
|
626
|
-
<h2 id="label-License">License
|
613
|
+
<h2 id="label-License">License<span><a href="#label-License">¶</a> <a href="#documentation">↑</a></span></h2>
|
627
614
|
|
628
615
|
<p>See <a href="LICENSE.html">LICENSE</a> for license information.</p>
|
629
616
|
|
630
|
-
<h2 id="label-Development">Development
|
617
|
+
<h2 id="label-Development">Development<span><a href="#label-Development">¶</a> <a href="#documentation">↑</a></span></h2>
|
631
618
|
|
632
619
|
<p>Code is located at <a
|
633
620
|
href="https://github.com/ruby-prof/ruby-prof">github.com/ruby-prof/ruby-prof</a></p>
|
@@ -635,14 +622,13 @@ href="https://github.com/ruby-prof/ruby-prof">github.com/ruby-prof/ruby-prof</a>
|
|
635
622
|
<p>Google group/mailing list: <a
|
636
623
|
href="http://groups.google.com/group/ruby-optimization">groups.google.com/group/ruby-optimization</a>
|
637
624
|
or start a github issue.</p>
|
638
|
-
|
639
|
-
</div>
|
625
|
+
</main>
|
640
626
|
|
641
627
|
|
642
628
|
|
643
|
-
<footer id="validator-badges">
|
644
|
-
<p><a href="http://validator.w3.org/check/referer">
|
645
|
-
<p>Generated by <a href="
|
646
|
-
<p>
|
629
|
+
<footer id="validator-badges" role="contentinfo">
|
630
|
+
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
631
|
+
<p>Generated by <a href="http://rdoc.rubyforge.org">RDoc</a> 4.1.0.
|
632
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
647
633
|
</footer>
|
648
634
|
|