acunote-ruby-prof 0.9.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +240 -0
- data/LICENSE +23 -0
- data/README.rdoc +439 -0
- data/Rakefile +148 -0
- data/bin/ruby-prof +236 -0
- data/examples/empty.png +0 -0
- data/examples/flat.txt +55 -0
- data/examples/graph.dot +106 -0
- data/examples/graph.html +823 -0
- data/examples/graph.png +0 -0
- data/examples/graph.txt +170 -0
- data/examples/minus.png +0 -0
- data/examples/multi.flat.txt +23 -0
- data/examples/multi.graph.html +906 -0
- data/examples/multi.grind.dat +194 -0
- data/examples/multi.stack.html +573 -0
- data/examples/plus.png +0 -0
- data/examples/stack.html +573 -0
- data/ext/ruby_prof/extconf.rb +43 -0
- data/ext/ruby_prof/measure_allocations.h +58 -0
- data/ext/ruby_prof/measure_cpu_time.h +152 -0
- data/ext/ruby_prof/measure_gc_runs.h +76 -0
- data/ext/ruby_prof/measure_gc_time.h +57 -0
- data/ext/ruby_prof/measure_memory.h +101 -0
- data/ext/ruby_prof/measure_process_time.h +52 -0
- data/ext/ruby_prof/measure_wall_time.h +53 -0
- data/ext/ruby_prof/mingw/Rakefile +23 -0
- data/ext/ruby_prof/mingw/build.rake +38 -0
- data/ext/ruby_prof/ruby_prof.c +1834 -0
- data/ext/ruby_prof/ruby_prof.h +190 -0
- data/ext/ruby_prof/version.h +4 -0
- data/lib/ruby-prof.rb +62 -0
- data/lib/ruby-prof/abstract_printer.rb +41 -0
- data/lib/ruby-prof/aggregate_call_info.rb +68 -0
- data/lib/ruby-prof/call_info.rb +112 -0
- data/lib/ruby-prof/call_stack_printer.rb +751 -0
- data/lib/ruby-prof/call_tree_printer.rb +133 -0
- data/lib/ruby-prof/dot_printer.rb +153 -0
- data/lib/ruby-prof/empty.png +0 -0
- data/lib/ruby-prof/flat_printer.rb +78 -0
- data/lib/ruby-prof/flat_printer_with_line_numbers.rb +72 -0
- data/lib/ruby-prof/graph_html_printer.rb +278 -0
- data/lib/ruby-prof/graph_printer.rb +245 -0
- data/lib/ruby-prof/method_info.rb +131 -0
- data/lib/ruby-prof/minus.png +0 -0
- data/lib/ruby-prof/multi_printer.rb +54 -0
- data/lib/ruby-prof/plus.png +0 -0
- data/lib/ruby-prof/rack.rb +30 -0
- data/lib/ruby-prof/result.rb +70 -0
- data/lib/ruby-prof/symbol_to_proc.rb +8 -0
- data/lib/ruby-prof/task.rb +146 -0
- data/lib/ruby-prof/test.rb +148 -0
- data/lib/unprof.rb +8 -0
- data/rails/environment/profile.rb +24 -0
- data/rails/example/example_test.rb +9 -0
- data/rails/profile_test_helper.rb +21 -0
- data/test/aggregate_test.rb +136 -0
- data/test/basic_test.rb +290 -0
- data/test/current_failures_windows +8 -0
- data/test/do_nothing.rb +0 -0
- data/test/duplicate_names_test.rb +32 -0
- data/test/enumerable_test.rb +16 -0
- data/test/exceptions_test.rb +15 -0
- data/test/exclude_threads_test.rb +54 -0
- data/test/exec_test.rb +14 -0
- data/test/line_number_test.rb +73 -0
- data/test/measurement_test.rb +122 -0
- data/test/method_elimination_test.rb +74 -0
- data/test/module_test.rb +44 -0
- data/test/multi_printer_test.rb +81 -0
- data/test/no_method_class_test.rb +13 -0
- data/test/prime.rb +55 -0
- data/test/prime_test.rb +13 -0
- data/test/printers_test.rb +164 -0
- data/test/recursive_test.rb +236 -0
- data/test/ruby-prof-bin +20 -0
- data/test/singleton_test.rb +38 -0
- data/test/stack_printer_test.rb +74 -0
- data/test/stack_test.rb +138 -0
- data/test/start_stop_test.rb +112 -0
- data/test/test_suite.rb +32 -0
- data/test/thread_test.rb +173 -0
- data/test/unique_call_path_test.rb +225 -0
- metadata +185 -0
@@ -0,0 +1,194 @@
|
|
1
|
+
events: wall_time
|
2
|
+
|
3
|
+
fl=/Users/skaes/src/ruby-prof/test/prime.rb
|
4
|
+
fn=Object#make_random_array
|
5
|
+
7 7
|
6
|
+
cfl=/Users/skaes/src/ruby-prof/ruby_runtime
|
7
|
+
cfn=Array#each_index
|
8
|
+
calls=1 9
|
9
|
+
9 7463
|
10
|
+
cfl=/Users/skaes/src/ruby-prof/ruby_runtime
|
11
|
+
cfn=Class#new
|
12
|
+
calls=1 8
|
13
|
+
8 54
|
14
|
+
cfl=/Users/skaes/src/ruby-prof/ruby_runtime
|
15
|
+
cfn=Array#each_index
|
16
|
+
calls=1 9
|
17
|
+
9 7256
|
18
|
+
cfl=/Users/skaes/src/ruby-prof/ruby_runtime
|
19
|
+
cfn=Class#new
|
20
|
+
calls=1 8
|
21
|
+
8 52
|
22
|
+
|
23
|
+
fl=/Users/skaes/src/ruby-prof/ruby_runtime
|
24
|
+
fn=Fixnum#%
|
25
|
+
0 199945
|
26
|
+
|
27
|
+
fl=/Users/skaes/src/ruby-prof/ruby_runtime
|
28
|
+
fn=Class#new
|
29
|
+
0 6
|
30
|
+
cfl=/Users/skaes/src/ruby-prof/ruby_runtime
|
31
|
+
cfn=<Class::Array>#allocate
|
32
|
+
calls=1 8
|
33
|
+
8 1
|
34
|
+
cfl=/Users/skaes/src/ruby-prof/ruby_runtime
|
35
|
+
cfn=Array#initialize
|
36
|
+
calls=1 8
|
37
|
+
8 48
|
38
|
+
cfl=/Users/skaes/src/ruby-prof/ruby_runtime
|
39
|
+
cfn=<Class::Array>#allocate
|
40
|
+
calls=1 8
|
41
|
+
8 1
|
42
|
+
cfl=/Users/skaes/src/ruby-prof/ruby_runtime
|
43
|
+
cfn=Array#initialize
|
44
|
+
calls=1 8
|
45
|
+
8 50
|
46
|
+
|
47
|
+
fl=/Users/skaes/src/ruby-prof/ruby_runtime
|
48
|
+
fn=Kernel#rand
|
49
|
+
0 3238
|
50
|
+
|
51
|
+
fl=/Users/skaes/src/ruby-prof/ruby_runtime
|
52
|
+
fn=Fixnum#-
|
53
|
+
0 2361
|
54
|
+
|
55
|
+
fl=/Users/skaes/src/ruby-prof/test/printers_test.rb
|
56
|
+
fn=PrintersTest#setup
|
57
|
+
16 5
|
58
|
+
cfl=/Users/skaes/src/ruby-prof/test/prime.rb
|
59
|
+
cfn=Object#run_primes
|
60
|
+
calls=1 16
|
61
|
+
16 702856
|
62
|
+
cfl=/Users/skaes/src/ruby-prof/test/printers_test.rb
|
63
|
+
cfn=PrintersTest#go
|
64
|
+
calls=1 17
|
65
|
+
17 709509
|
66
|
+
|
67
|
+
fl=/Users/skaes/src/ruby-prof/ruby_runtime
|
68
|
+
fn=Array#initialize
|
69
|
+
0 98
|
70
|
+
|
71
|
+
fl=/Users/skaes/src/ruby-prof/ruby_runtime
|
72
|
+
fn=Array#each_index
|
73
|
+
0 8789
|
74
|
+
cfl=/Users/skaes/src/ruby-prof/ruby_runtime
|
75
|
+
cfn=Array#[]=
|
76
|
+
calls=10000 10
|
77
|
+
10 1364
|
78
|
+
cfl=/Users/skaes/src/ruby-prof/ruby_runtime
|
79
|
+
cfn=Kernel#rand
|
80
|
+
calls=10000 10
|
81
|
+
10 1602
|
82
|
+
cfl=/Users/skaes/src/ruby-prof/ruby_runtime
|
83
|
+
cfn=Array#[]=
|
84
|
+
calls=10000 10
|
85
|
+
10 1328
|
86
|
+
cfl=/Users/skaes/src/ruby-prof/ruby_runtime
|
87
|
+
cfn=Kernel#rand
|
88
|
+
calls=10000 10
|
89
|
+
10 1636
|
90
|
+
|
91
|
+
fl=/Users/skaes/src/ruby-prof/test/prime.rb
|
92
|
+
fn=Object#is_prime
|
93
|
+
16 13805
|
94
|
+
cfl=/Users/skaes/src/ruby-prof/ruby_runtime
|
95
|
+
cfn=Integer#upto
|
96
|
+
calls=10000 18
|
97
|
+
18 683251
|
98
|
+
cfl=/Users/skaes/src/ruby-prof/ruby_runtime
|
99
|
+
cfn=Fixnum#-
|
100
|
+
calls=10000 18
|
101
|
+
18 1157
|
102
|
+
cfl=/Users/skaes/src/ruby-prof/ruby_runtime
|
103
|
+
cfn=Integer#upto
|
104
|
+
calls=10000 18
|
105
|
+
18 689970
|
106
|
+
cfl=/Users/skaes/src/ruby-prof/ruby_runtime
|
107
|
+
cfn=Fixnum#-
|
108
|
+
calls=10000 18
|
109
|
+
18 1204
|
110
|
+
|
111
|
+
fl=/Users/skaes/src/ruby-prof/test/printers_test.rb
|
112
|
+
fn=PrintersTest#go
|
113
|
+
9 5
|
114
|
+
cfl=/Users/skaes/src/ruby-prof/test/prime.rb
|
115
|
+
cfn=Object#run_primes
|
116
|
+
calls=1 10
|
117
|
+
10 709504
|
118
|
+
|
119
|
+
fl=/Users/skaes/src/ruby-prof/test/prime.rb
|
120
|
+
fn=Object#find_primes
|
121
|
+
24 3
|
122
|
+
cfl=/Users/skaes/src/ruby-prof/ruby_runtime
|
123
|
+
cfn=Array#select
|
124
|
+
calls=1 25
|
125
|
+
25 695331
|
126
|
+
cfl=/Users/skaes/src/ruby-prof/ruby_runtime
|
127
|
+
cfn=Array#select
|
128
|
+
calls=1 25
|
129
|
+
25 702187
|
130
|
+
|
131
|
+
fl=/Users/skaes/src/ruby-prof/ruby_runtime
|
132
|
+
fn=Array#select
|
133
|
+
0 8131
|
134
|
+
cfl=/Users/skaes/src/ruby-prof/test/prime.rb
|
135
|
+
cfn=Object#is_prime
|
136
|
+
calls=10000 26
|
137
|
+
26 691245
|
138
|
+
cfl=/Users/skaes/src/ruby-prof/test/prime.rb
|
139
|
+
cfn=Object#is_prime
|
140
|
+
calls=10000 26
|
141
|
+
26 698142
|
142
|
+
|
143
|
+
fl=/Users/skaes/src/ruby-prof/ruby_runtime
|
144
|
+
fn=Integer#upto
|
145
|
+
0 1004845
|
146
|
+
cfl=/Users/skaes/src/ruby-prof/ruby_runtime
|
147
|
+
cfn=Fixnum#==
|
148
|
+
calls=766408 19
|
149
|
+
19 83149
|
150
|
+
cfl=/Users/skaes/src/ruby-prof/ruby_runtime
|
151
|
+
cfn=Fixnum#%
|
152
|
+
calls=766408 19
|
153
|
+
19 99302
|
154
|
+
cfl=/Users/skaes/src/ruby-prof/ruby_runtime
|
155
|
+
cfn=Fixnum#==
|
156
|
+
calls=778318 19
|
157
|
+
19 85282
|
158
|
+
cfl=/Users/skaes/src/ruby-prof/ruby_runtime
|
159
|
+
cfn=Fixnum#%
|
160
|
+
calls=778318 19
|
161
|
+
19 100643
|
162
|
+
|
163
|
+
fl=/Users/skaes/src/ruby-prof/ruby_runtime
|
164
|
+
fn=<Class::Array>#allocate
|
165
|
+
0 2
|
166
|
+
|
167
|
+
fl=/Users/skaes/src/ruby-prof/ruby_runtime
|
168
|
+
fn=Fixnum#==
|
169
|
+
0 168431
|
170
|
+
|
171
|
+
fl=/Users/skaes/src/ruby-prof/test/prime.rb
|
172
|
+
fn=Object#run_primes
|
173
|
+
46 7
|
174
|
+
cfl=/Users/skaes/src/ruby-prof/test/prime.rb
|
175
|
+
cfn=Object#find_primes
|
176
|
+
calls=1 51
|
177
|
+
51 695333
|
178
|
+
cfl=/Users/skaes/src/ruby-prof/test/prime.rb
|
179
|
+
cfn=Object#make_random_array
|
180
|
+
calls=1 48
|
181
|
+
48 7519
|
182
|
+
cfl=/Users/skaes/src/ruby-prof/test/prime.rb
|
183
|
+
cfn=Object#find_primes
|
184
|
+
calls=1 51
|
185
|
+
51 702188
|
186
|
+
cfl=/Users/skaes/src/ruby-prof/test/prime.rb
|
187
|
+
cfn=Object#make_random_array
|
188
|
+
calls=1 48
|
189
|
+
48 7313
|
190
|
+
|
191
|
+
fl=/Users/skaes/src/ruby-prof/ruby_runtime
|
192
|
+
fn=Array#[]=
|
193
|
+
0 2692
|
194
|
+
|
@@ -0,0 +1,573 @@
|
|
1
|
+
<html><head>
|
2
|
+
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
3
|
+
<title>ruby-prof call tree</title>
|
4
|
+
<style type="text/css">
|
5
|
+
<!--
|
6
|
+
body {
|
7
|
+
font-size:70%;
|
8
|
+
padding:0px;
|
9
|
+
margin:5px;
|
10
|
+
margin-right:0px;
|
11
|
+
margin-left:0px;
|
12
|
+
background: #ffffff;
|
13
|
+
}
|
14
|
+
ul {
|
15
|
+
margin-left:0px;
|
16
|
+
margin-top:0px;
|
17
|
+
margin-bottom:0px;
|
18
|
+
padding-left:0px;
|
19
|
+
list-style-type:none;
|
20
|
+
}
|
21
|
+
li {
|
22
|
+
margin-left:11px;
|
23
|
+
padding:0px;
|
24
|
+
white-space:nowrap;
|
25
|
+
border-top:1px solid #cccccc;
|
26
|
+
border-left:1px solid #cccccc;
|
27
|
+
border-bottom:none;
|
28
|
+
}
|
29
|
+
.thread {
|
30
|
+
margin-left:11px;
|
31
|
+
background:#708090;
|
32
|
+
padding-top:3px;
|
33
|
+
padding-left:12px;
|
34
|
+
padding-bottom:2px;
|
35
|
+
border-left:1px solid #CCCCCC;
|
36
|
+
border-top:1px solid #CCCCCC;
|
37
|
+
font-weight:bold;
|
38
|
+
}
|
39
|
+
.hidden {
|
40
|
+
display:none;
|
41
|
+
width:0px;
|
42
|
+
height:0px;
|
43
|
+
margin:0px;
|
44
|
+
padding:0px;
|
45
|
+
border-style:none;
|
46
|
+
}
|
47
|
+
.color01 { background:#adbdeb }
|
48
|
+
.color05 { background:#9daddb }
|
49
|
+
.color0 { background:#8d9dcb }
|
50
|
+
.color1 { background:#89bccb }
|
51
|
+
.color2 { background:#56e3e7 }
|
52
|
+
.color3 { background:#32cd70 }
|
53
|
+
.color4 { background:#a3d53c }
|
54
|
+
.color5 { background:#c4cb34 }
|
55
|
+
.color6 { background:#dcb66d }
|
56
|
+
.color7 { background:#cda59e }
|
57
|
+
.color8 { background:#be9d9c }
|
58
|
+
.color9 { background:#cf947a }
|
59
|
+
#commands {
|
60
|
+
font-size:10pt;
|
61
|
+
padding:10px;
|
62
|
+
margin-left:11px;
|
63
|
+
margin-bottom:0px;
|
64
|
+
margin-top:0px;
|
65
|
+
background:#708090;
|
66
|
+
border-top:1px solid #cccccc;
|
67
|
+
border-left:1px solid #cccccc;
|
68
|
+
border-bottom:none;
|
69
|
+
}
|
70
|
+
#titlebar {
|
71
|
+
font-size:10pt;
|
72
|
+
padding:10px;
|
73
|
+
margin-left:11px;
|
74
|
+
margin-bottom:0px;
|
75
|
+
margin-top:10px;
|
76
|
+
background:#8090a0;
|
77
|
+
border-top:1px solid #cccccc;
|
78
|
+
border-left:1px solid #cccccc;
|
79
|
+
border-bottom:none;
|
80
|
+
}
|
81
|
+
#help {
|
82
|
+
font-size:10pt;
|
83
|
+
padding:10px;
|
84
|
+
margin-left:11px;
|
85
|
+
margin-bottom:0px;
|
86
|
+
margin-top:0px;
|
87
|
+
background:#8090a0;
|
88
|
+
display:none;
|
89
|
+
border-top:1px solid #cccccc;
|
90
|
+
border-left:1px solid #cccccc;
|
91
|
+
border-bottom:none;
|
92
|
+
}
|
93
|
+
#sentinel {
|
94
|
+
height: 400px;
|
95
|
+
margin-left:11px;
|
96
|
+
background:#8090a0;
|
97
|
+
border-top:1px solid #cccccc;
|
98
|
+
border-left:1px solid #cccccc;
|
99
|
+
border-bottom:none;
|
100
|
+
}
|
101
|
+
input { margin-left:10px; }
|
102
|
+
-->
|
103
|
+
</style>
|
104
|
+
<script type="text/javascript">
|
105
|
+
/*
|
106
|
+
Copyright (C) 2005,2009 Stefan Kaes
|
107
|
+
skaes@railsexpress.de
|
108
|
+
*/
|
109
|
+
|
110
|
+
function rootNode() {
|
111
|
+
return currentThread;
|
112
|
+
}
|
113
|
+
|
114
|
+
function hideUL(node) {
|
115
|
+
var lis = node.childNodes
|
116
|
+
var l = lis.length;
|
117
|
+
for (var i=0; i < l ; i++ ) {
|
118
|
+
hideLI(lis[i]);
|
119
|
+
}
|
120
|
+
}
|
121
|
+
|
122
|
+
function showUL(node) {
|
123
|
+
var lis = node.childNodes;
|
124
|
+
var l = lis.length;
|
125
|
+
for (var i=0; i < l ; i++ ) {
|
126
|
+
showLI(lis[i]);
|
127
|
+
}
|
128
|
+
}
|
129
|
+
|
130
|
+
function findUlChild(li){
|
131
|
+
var ul = li.childNodes[2];
|
132
|
+
while (ul && ul.nodeName != "UL") {
|
133
|
+
ul = ul.nextSibling;
|
134
|
+
}
|
135
|
+
return ul;
|
136
|
+
}
|
137
|
+
|
138
|
+
function isLeafNode(li) {
|
139
|
+
var img = li.firstChild;
|
140
|
+
return (img.src.indexOf('empty.png') > -1);
|
141
|
+
}
|
142
|
+
|
143
|
+
function hideLI(li) {
|
144
|
+
if (isLeafNode(li))
|
145
|
+
return;
|
146
|
+
|
147
|
+
var img = li.firstChild;
|
148
|
+
img.src = 'plus.png';
|
149
|
+
|
150
|
+
var ul = findUlChild(li);
|
151
|
+
if (ul) {
|
152
|
+
ul.style.display = 'none';
|
153
|
+
hideUL(ul);
|
154
|
+
}
|
155
|
+
}
|
156
|
+
|
157
|
+
function showLI(li) {
|
158
|
+
if (isLeafNode(li))
|
159
|
+
return;
|
160
|
+
|
161
|
+
var img = li.firstChild;
|
162
|
+
img.src = 'minus.png';
|
163
|
+
|
164
|
+
var ul = findUlChild(li);
|
165
|
+
if (ul) {
|
166
|
+
ul.style.display = 'block';
|
167
|
+
showUL(ul);
|
168
|
+
}
|
169
|
+
}
|
170
|
+
|
171
|
+
function toggleLI(li) {
|
172
|
+
var img = li.firstChild;
|
173
|
+
if (img.src.indexOf("minus.png")>-1)
|
174
|
+
hideLI(li);
|
175
|
+
else {
|
176
|
+
if (img.src.indexOf("plus.png")>-1)
|
177
|
+
showLI(li);
|
178
|
+
}
|
179
|
+
}
|
180
|
+
|
181
|
+
function aboveThreshold(text, threshold) {
|
182
|
+
var match = text.match(/\d+[.,]\d+/);
|
183
|
+
return (match && parseFloat(match[0].replace(/,/, '.'))>=threshold);
|
184
|
+
}
|
185
|
+
|
186
|
+
function setThresholdLI(li, threshold) {
|
187
|
+
var img = li.firstChild;
|
188
|
+
var text = img.nextSibling;
|
189
|
+
var ul = findUlChild(li);
|
190
|
+
|
191
|
+
var visible = aboveThreshold(text.nodeValue, threshold) ? 1 : 0;
|
192
|
+
|
193
|
+
var count = 0;
|
194
|
+
if (ul) {
|
195
|
+
count = setThresholdUL(ul, threshold);
|
196
|
+
}
|
197
|
+
if (count>0) {
|
198
|
+
img.src = 'minus.png';
|
199
|
+
}
|
200
|
+
else {
|
201
|
+
img.src = 'empty.png';
|
202
|
+
}
|
203
|
+
if (visible) {
|
204
|
+
li.style.display = 'block'
|
205
|
+
}
|
206
|
+
else {
|
207
|
+
li.style.display = 'none'
|
208
|
+
}
|
209
|
+
return visible;
|
210
|
+
}
|
211
|
+
|
212
|
+
function setThresholdUL(node, threshold) {
|
213
|
+
var lis = node.childNodes;
|
214
|
+
var l = lis.length;
|
215
|
+
|
216
|
+
var count = 0;
|
217
|
+
for ( var i = 0; i < l ; i++ ) {
|
218
|
+
count = count + setThresholdLI(lis[i], threshold);
|
219
|
+
}
|
220
|
+
|
221
|
+
var visible = (count > 0) ? 1 : 0;
|
222
|
+
if (visible) {
|
223
|
+
node.style.display = 'block';
|
224
|
+
}
|
225
|
+
else {
|
226
|
+
node.style.display = 'none';
|
227
|
+
}
|
228
|
+
return visible;
|
229
|
+
}
|
230
|
+
|
231
|
+
function toggleChildren(img, event) {
|
232
|
+
event.cancelBubble=true;
|
233
|
+
|
234
|
+
if (img.src.indexOf('empty.png') > -1)
|
235
|
+
return;
|
236
|
+
|
237
|
+
var minus = (img.src.indexOf('minus.png') > -1);
|
238
|
+
|
239
|
+
if (minus) {
|
240
|
+
img.src = 'plus.png';
|
241
|
+
}
|
242
|
+
else
|
243
|
+
img.src = 'minus.png';
|
244
|
+
|
245
|
+
var li = img.parentNode;
|
246
|
+
var ul = findUlChild(li);
|
247
|
+
if (ul) {
|
248
|
+
if (minus)
|
249
|
+
ul.style.display = 'none';
|
250
|
+
else
|
251
|
+
ul.style.display = 'block';
|
252
|
+
}
|
253
|
+
if (minus)
|
254
|
+
moveSelectionIfNecessary(li);
|
255
|
+
}
|
256
|
+
|
257
|
+
function showChildren(li) {
|
258
|
+
var img = li.firstChild;
|
259
|
+
if (img.src.indexOf('empty.png') > -1)
|
260
|
+
return;
|
261
|
+
img.src = 'minus.png';
|
262
|
+
|
263
|
+
var ul = findUlChild(li);
|
264
|
+
if (ul) {
|
265
|
+
ul.style.display = 'block';
|
266
|
+
}
|
267
|
+
}
|
268
|
+
|
269
|
+
function setThreshold() {
|
270
|
+
var tv = document.getElementById("threshold").value;
|
271
|
+
if (tv.match(/[0-9]+([.,][0-9]+)?/)) {
|
272
|
+
var f = parseFloat(tv.replace(/,/, '.'));
|
273
|
+
var threads = document.getElementsByName("thread");
|
274
|
+
var l = threads.length;
|
275
|
+
for ( var i = 0; i < l ; i++ ) {
|
276
|
+
setThresholdUL(threads[i], f);
|
277
|
+
}
|
278
|
+
var p = selectedNode;
|
279
|
+
while (p && p.style.display=='none')
|
280
|
+
p=p.parentNode.parentNode;
|
281
|
+
if (p && p.nodeName=="LI")
|
282
|
+
selectNode(p);
|
283
|
+
}
|
284
|
+
else {
|
285
|
+
alert("Please specify a decimal number as threshold value!");
|
286
|
+
}
|
287
|
+
}
|
288
|
+
|
289
|
+
function collapseAll(event) {
|
290
|
+
event.cancelBubble=true;
|
291
|
+
var threads = document.getElementsByName("thread");
|
292
|
+
var l = threads.length;
|
293
|
+
for ( var i = 0; i < l ; i++ ) {
|
294
|
+
hideUL(threads[i]);
|
295
|
+
}
|
296
|
+
selectNode(rootNode(), null);
|
297
|
+
}
|
298
|
+
|
299
|
+
function expandAll(event) {
|
300
|
+
event.cancelBubble=true;
|
301
|
+
var threads = document.getElementsByName("thread");
|
302
|
+
var l = threads.length;
|
303
|
+
for ( var i = 0; i < l ; i++ ) {
|
304
|
+
showUL(threads[i]);
|
305
|
+
}
|
306
|
+
}
|
307
|
+
|
308
|
+
function toggleHelp(node) {
|
309
|
+
var help = document.getElementById("help");
|
310
|
+
if (node.value == "Show Help") {
|
311
|
+
node.value = "Hide Help";
|
312
|
+
help.style.display = 'block';
|
313
|
+
}
|
314
|
+
else {
|
315
|
+
node.value = "Show Help";
|
316
|
+
help.style.display = 'none';
|
317
|
+
}
|
318
|
+
}
|
319
|
+
|
320
|
+
var selectedNode = null;
|
321
|
+
var selectedColor = null;
|
322
|
+
var selectedThread = null;
|
323
|
+
|
324
|
+
function descendentOf(a,b){
|
325
|
+
while (a!=b && b!=null)
|
326
|
+
b=b.parentNode;
|
327
|
+
return (a==b);
|
328
|
+
}
|
329
|
+
|
330
|
+
function moveSelectionIfNecessary(node){
|
331
|
+
if (descendentOf(node, selectedNode))
|
332
|
+
selectNode(node, null);
|
333
|
+
}
|
334
|
+
|
335
|
+
function selectNode(node, event) {
|
336
|
+
if (event) {
|
337
|
+
event.cancelBubble = true;
|
338
|
+
thread = findThread(node);
|
339
|
+
selectThread(thread);
|
340
|
+
}
|
341
|
+
if (selectedNode) {
|
342
|
+
selectedNode.style.background = selectedColor;
|
343
|
+
}
|
344
|
+
selectedNode = node;
|
345
|
+
selectedColor = node.style.background;
|
346
|
+
selectedNode.style.background = "red";
|
347
|
+
selectedNode.scrollIntoView();
|
348
|
+
window.scrollBy(0,-400);
|
349
|
+
}
|
350
|
+
|
351
|
+
function moveUp(){
|
352
|
+
var p = selectedNode.previousSibling;
|
353
|
+
while (p && p.style.display == 'none')
|
354
|
+
p = p.previousSibling;
|
355
|
+
if (p && p.nodeName == "LI") {
|
356
|
+
selectNode(p, null);
|
357
|
+
}
|
358
|
+
}
|
359
|
+
|
360
|
+
function moveDown(){
|
361
|
+
var p = selectedNode.nextSibling;
|
362
|
+
while (p && p.style.display == 'none')
|
363
|
+
p = p.nextSibling;
|
364
|
+
if (p && p.nodeName == "LI") {
|
365
|
+
selectNode(p, null);
|
366
|
+
}
|
367
|
+
}
|
368
|
+
|
369
|
+
function moveLeft(){
|
370
|
+
var p = selectedNode.parentNode.parentNode;
|
371
|
+
if (p && p.nodeName=="LI") {
|
372
|
+
selectNode(p, null);
|
373
|
+
}
|
374
|
+
}
|
375
|
+
|
376
|
+
function moveRight(){
|
377
|
+
if (!isLeafNode(selectedNode)) {
|
378
|
+
showChildren(selectedNode);
|
379
|
+
var ul = findUlChild(selectedNode);
|
380
|
+
if (ul) {
|
381
|
+
selectNode(ul.firstChild, null);
|
382
|
+
}
|
383
|
+
}
|
384
|
+
}
|
385
|
+
|
386
|
+
function moveForward(){
|
387
|
+
if (isLeafNode(selectedNode)) {
|
388
|
+
var p = selectedNode;
|
389
|
+
while ((p.nextSibling == null || p.nextSibling.style.display=='none') && p.nodeName=="LI") {
|
390
|
+
p = p.parentNode.parentNode;
|
391
|
+
}
|
392
|
+
if (p.nodeName=="LI")
|
393
|
+
selectNode(p.nextSibling, null);
|
394
|
+
}
|
395
|
+
else {
|
396
|
+
moveRight();
|
397
|
+
}
|
398
|
+
}
|
399
|
+
|
400
|
+
function isExpandedNode(li){
|
401
|
+
var img = li.firstChild;
|
402
|
+
return(img.src.indexOf('minus.png')>-1);
|
403
|
+
}
|
404
|
+
|
405
|
+
function moveBackward(){
|
406
|
+
var p = selectedNode;
|
407
|
+
var q = p.previousSibling;
|
408
|
+
while (q != null && q.style.display=='none')
|
409
|
+
q = q.previousSibling;
|
410
|
+
if (q == null) {
|
411
|
+
p = p.parentNode.parentNode;
|
412
|
+
} else {
|
413
|
+
while (!isLeafNode(q) && isExpandedNode(q)) {
|
414
|
+
q = findUlChild(q).lastChild;
|
415
|
+
while (q.style.display=='none')
|
416
|
+
q = q.previousSibling;
|
417
|
+
}
|
418
|
+
p = q;
|
419
|
+
}
|
420
|
+
if (p.nodeName=="LI")
|
421
|
+
selectNode(p, null);
|
422
|
+
}
|
423
|
+
|
424
|
+
function moveHome() {
|
425
|
+
selectNode(currentThread);
|
426
|
+
}
|
427
|
+
|
428
|
+
var currentThreadIndex = null;
|
429
|
+
|
430
|
+
function findThread(node){
|
431
|
+
while (node && node.parentNode.nodeName!="BODY") {
|
432
|
+
node = node.parentNode;
|
433
|
+
}
|
434
|
+
return node.firstChild;
|
435
|
+
}
|
436
|
+
|
437
|
+
function selectThread(node){
|
438
|
+
var threads = document.getElementsByName("thread");
|
439
|
+
currentThread = node;
|
440
|
+
for (var i=0; i<threads.length; i++) {
|
441
|
+
if (threads[i]==currentThread.parentNode)
|
442
|
+
currentThreadIndex = i;
|
443
|
+
}
|
444
|
+
}
|
445
|
+
|
446
|
+
function nextThread(){
|
447
|
+
var threads = document.getElementsByName("thread");
|
448
|
+
if (currentThreadIndex==threads.length-1)
|
449
|
+
currentThreadIndex = 0;
|
450
|
+
else
|
451
|
+
currentThreadIndex += 1
|
452
|
+
currentThread = threads[currentThreadIndex].firstChild;
|
453
|
+
selectNode(currentThread, null);
|
454
|
+
}
|
455
|
+
|
456
|
+
function previousThread(){
|
457
|
+
var threads = document.getElementsByName("thread");
|
458
|
+
if (currentThreadIndex==0)
|
459
|
+
currentThreadIndex = threads.length-1;
|
460
|
+
else
|
461
|
+
currentThreadIndex -= 1
|
462
|
+
currentThread = threads[currentThreadIndex].firstChild;
|
463
|
+
selectNode(currentThread, null);
|
464
|
+
}
|
465
|
+
|
466
|
+
function switchThread(node, event){
|
467
|
+
event.cancelBubble = true;
|
468
|
+
selectThread(node.nextSibling.firstChild);
|
469
|
+
selectNode(currentThread, null);
|
470
|
+
}
|
471
|
+
|
472
|
+
function handleKeyEvent(event){
|
473
|
+
var code = event.charCode ? event.charCode : event.keyCode;
|
474
|
+
var str = String.fromCharCode(code);
|
475
|
+
switch (str) {
|
476
|
+
case "a": moveLeft(); break;
|
477
|
+
case "s": moveDown(); break;
|
478
|
+
case "d": moveRight(); break;
|
479
|
+
case "w": moveUp(); break;
|
480
|
+
case "f": moveForward(); break;
|
481
|
+
case "b": moveBackward(); break;
|
482
|
+
case "x": toggleChildren(selectedNode.firstChild, event); break;
|
483
|
+
case "*": toggleLI(selectedNode); break;
|
484
|
+
case "n": nextThread(); break;
|
485
|
+
case "h": moveHome(); break;
|
486
|
+
case "p": previousThread(); break;
|
487
|
+
}
|
488
|
+
}
|
489
|
+
document.onkeypress=function(event){ handleKeyEvent(event) };
|
490
|
+
|
491
|
+
window.onload=function(){
|
492
|
+
var images = document.getElementsByTagName("img");
|
493
|
+
for (var i=0; i<images.length; i++) {
|
494
|
+
var img = images[i];
|
495
|
+
if (img.className == "toggle") {
|
496
|
+
img.onclick = function(event){ toggleChildren(this, event); };
|
497
|
+
}
|
498
|
+
}
|
499
|
+
var divs = document.getElementsByTagName("div");
|
500
|
+
for (i=0; i<divs.length; i++) {
|
501
|
+
var div = divs[i];
|
502
|
+
if (div.className == "thread")
|
503
|
+
div.onclick = function(event){ switchThread(this, event) };
|
504
|
+
}
|
505
|
+
var lis = document.getElementsByTagName("li");
|
506
|
+
for (var i=0; i<lis.length; i++) {
|
507
|
+
lis[i].onclick = function(event){ selectNode(this, event); };
|
508
|
+
}
|
509
|
+
var threads = document.getElementsByName("thread");
|
510
|
+
currentThreadIndex = 0;
|
511
|
+
currentThread = threads[0].firstChild;
|
512
|
+
selectNode(currentThread, null);
|
513
|
+
}
|
514
|
+
</script>
|
515
|
+
</head><body>
|
516
|
+
<div id="titlebar">
|
517
|
+
Call tree for application <b>primes </b><br/>
|
518
|
+
Generated on Sat Jul 24 08:05:17 +0200 2010 with options {:application=>"primes"}<br/>
|
519
|
+
</div>
|
520
|
+
<div id="commands">
|
521
|
+
<span style="font-size: 11pt; font-weight: bold;">Threshold:</span>
|
522
|
+
<input value="1.0" size="3" id="threshold" type="text">
|
523
|
+
<input value="Apply" onclick="setThreshold();" type="submit">
|
524
|
+
<input value="Expand All" onclick="expandAll(event);" type="submit">
|
525
|
+
<input value="Collapse All" onclick="collapseAll(event);" type="submit">
|
526
|
+
<input value="Show Help" onclick="toggleHelp(this);" type="submit">
|
527
|
+
</div>
|
528
|
+
<div style="display: none;" id="help">
|
529
|
+
<img src="empty.png"> Enter a decimal value <i>d</i> into the threshold field and click "Apply"
|
530
|
+
to hide all nodes marked with time values lower than <i>d</i>.<br>
|
531
|
+
<img src="empty.png"> Click on "Expand All" for full tree expansion.<br>
|
532
|
+
<img src="empty.png"> Click on "Collapse All" to show only top level nodes.<br>
|
533
|
+
<img src="empty.png"> Use a, s, d, w as in Quake or Urban Terror to navigate the tree.<br>
|
534
|
+
<img src="empty.png"> Use f and b to navigate the tree in preorder forward and backwards.<br>
|
535
|
+
<img src="empty.png"> Use x to toggle visibility of a subtree.<br>
|
536
|
+
<img src="empty.png"> Use * to expand/collapse a whole subtree.<br>
|
537
|
+
<img src="empty.png"> Use h to navigate to thread root.<br>
|
538
|
+
<img src="empty.png"> Use n and p to navigate between threads.<br>
|
539
|
+
<img src="empty.png"> Click on background to move focus to a subtree.<br>
|
540
|
+
</div>
|
541
|
+
<div class="thread">Thread: 2148387240 (100.00% ~ 1.41237)</div><ul name="thread"><li class="color9" style="display:block"><img class="toggle" src="minus.png"> 100.00% (100.00%) <a href="txmt://open?url=file:///Users/skaes/src/ruby-prof/test/printers_test.rb&line=16">PrintersTest#setup</a> [1 calls, <a href='multi.graph.html#PrintersTest_setup_2148387240'>1</a> total]
|
542
|
+
<ul><li class="color5" style="display:block"><img class="toggle" src="minus.png"> 50.24% (50.24%) <a href="txmt://open?url=file:///Users/skaes/src/ruby-prof/test/printers_test.rb&line=9">PrintersTest#go</a> [1 calls, <a href='multi.graph.html#PrintersTest_go_2148387240'>1</a> total]
|
543
|
+
<ul><li class="color5" style="display:block"><img class="toggle" src="minus.png"> 50.23% (100.00%) <a href="txmt://open?url=file:///Users/skaes/src/ruby-prof/test/prime.rb&line=46">Object#run_primes</a> [1 calls, <a href='multi.graph.html#Object_run_primes_2148387240'>2</a> total]
|
544
|
+
<ul><li class="color4" style="display:block"><img class="toggle" src="minus.png"> 49.72% (98.97%) <a href="txmt://open?url=file:///Users/skaes/src/ruby-prof/test/prime.rb&line=24">Object#find_primes</a> [1 calls, <a href='multi.graph.html#Object_find_primes_2148387240'>2</a> total]
|
545
|
+
<ul><li class="color4" style="display:block"><img class="toggle" src="minus.png"> 49.72% (100.00%) Array#select [1 calls, <a href='multi.graph.html#Array_select_2148387240'>2</a> total]
|
546
|
+
<ul><li class="color4" style="display:block"><img class="toggle" src="minus.png"> 49.43% (99.42%) <a href="txmt://open?url=file:///Users/skaes/src/ruby-prof/test/prime.rb&line=16">Object#is_prime</a> [10000 calls, <a href='multi.graph.html#Object_is_prime_2148387240'>20000</a> total]
|
547
|
+
<ul><li class="color4" style="display:block"><img class="toggle" src="minus.png"> 48.85% (98.83%) Integer#upto [10000 calls, <a href='multi.graph.html#Integer_upto_2148387240'>20000</a> total]
|
548
|
+
<ul><li class="color05" style="display:block"><img src="empty.png"> 7.13% (14.59%) Fixnum#% [778318 calls, <a href='multi.graph.html#Fixnum_%_2148387240'>1544726</a> total]
|
549
|
+
</li><li class="color05" style="display:block"><img src="empty.png"> 6.04% (12.36%) Fixnum#== [778318 calls, <a href='multi.graph.html#Fixnum____2148387240'>1544726</a> total]
|
550
|
+
</li></ul></li><li class="color01" style="display:none"><img src="empty.png"> 0.09% (0.17%) Fixnum#- [10000 calls, <a href='multi.graph.html#Fixnum_-_2148387240'>20000</a> total]
|
551
|
+
</li></ul></li></ul></li></ul></li><li class="color01" style="display:none"><img class="toggle" src="empty.png"> 0.52% (1.03%) <a href="txmt://open?url=file:///Users/skaes/src/ruby-prof/test/prime.rb&line=7">Object#make_random_array</a> [1 calls, <a href='multi.graph.html#Object_make_random_array_2148387240'>2</a> total]
|
552
|
+
<ul style="display:none"><li class="color01" style="display:none"><img class="toggle" src="empty.png"> 0.51% (99.22%) Array#each_index [1 calls, <a href='multi.graph.html#Array_each_index_2148387240'>2</a> total]
|
553
|
+
<ul style="display:none"><li class="color01" style="display:none"><img src="empty.png"> 0.12% (22.55%) Kernel#rand [10000 calls, <a href='multi.graph.html#Kernel_rand_2148387240'>20000</a> total]
|
554
|
+
</li><li class="color01" style="display:none"><img src="empty.png"> 0.09% (18.30%) Array#[]= [10000 calls, <a href='multi.graph.html#Array_[]__2148387240'>20000</a> total]
|
555
|
+
</li></ul></li><li class="color01" style="display:none"><img class="toggle" src="empty.png"> 0.00% (0.71%) Class#new [1 calls, <a href='multi.graph.html#Class_new_2148387240'>2</a> total]
|
556
|
+
<ul style="display:none"><li class="color01" style="display:none"><img src="empty.png"> 0.00% (96.15%) Array#initialize [1 calls, <a href='multi.graph.html#Array_initialize_2148387240'>2</a> total]
|
557
|
+
</li><li class="color01" style="display:none"><img src="empty.png"> 0.00% (1.92%) <Class::Array>#allocate [1 calls, <a href='multi.graph.html#_Class__Array__allocate_2148387240'>2</a> total]
|
558
|
+
</li></ul></li></ul></li></ul></li></ul></li><li class="color4" style="display:block"><img class="toggle" src="minus.png"> 49.76% (49.76%) <a href="txmt://open?url=file:///Users/skaes/src/ruby-prof/test/prime.rb&line=46">Object#run_primes</a> [1 calls, <a href='multi.graph.html#Object_run_primes_2148387240'>2</a> total]
|
559
|
+
<ul><li class="color4" style="display:block"><img class="toggle" src="minus.png"> 49.23% (98.93%) <a href="txmt://open?url=file:///Users/skaes/src/ruby-prof/test/prime.rb&line=24">Object#find_primes</a> [1 calls, <a href='multi.graph.html#Object_find_primes_2148387240'>2</a> total]
|
560
|
+
<ul><li class="color4" style="display:block"><img class="toggle" src="minus.png"> 49.23% (100.00%) Array#select [1 calls, <a href='multi.graph.html#Array_select_2148387240'>2</a> total]
|
561
|
+
<ul><li class="color4" style="display:block"><img class="toggle" src="minus.png"> 48.94% (99.41%) <a href="txmt://open?url=file:///Users/skaes/src/ruby-prof/test/prime.rb&line=16">Object#is_prime</a> [10000 calls, <a href='multi.graph.html#Object_is_prime_2148387240'>20000</a> total]
|
562
|
+
<ul><li class="color4" style="display:block"><img class="toggle" src="minus.png"> 48.38% (98.84%) Integer#upto [10000 calls, <a href='multi.graph.html#Integer_upto_2148387240'>20000</a> total]
|
563
|
+
<ul><li class="color05" style="display:block"><img src="empty.png"> 7.03% (14.53%) Fixnum#% [766408 calls, <a href='multi.graph.html#Fixnum_%_2148387240'>1544726</a> total]
|
564
|
+
</li><li class="color01" style="display:block"><img src="empty.png"> 5.89% (12.17%) Fixnum#== [766408 calls, <a href='multi.graph.html#Fixnum____2148387240'>1544726</a> total]
|
565
|
+
</li></ul></li><li class="color01" style="display:none"><img src="empty.png"> 0.08% (0.17%) Fixnum#- [10000 calls, <a href='multi.graph.html#Fixnum_-_2148387240'>20000</a> total]
|
566
|
+
</li></ul></li></ul></li></ul></li><li class="color01" style="display:none"><img class="toggle" src="empty.png"> 0.53% (1.07%) <a href="txmt://open?url=file:///Users/skaes/src/ruby-prof/test/prime.rb&line=7">Object#make_random_array</a> [1 calls, <a href='multi.graph.html#Object_make_random_array_2148387240'>2</a> total]
|
567
|
+
<ul style="display:none"><li class="color01" style="display:none"><img class="toggle" src="empty.png"> 0.53% (99.26%) Array#each_index [1 calls, <a href='multi.graph.html#Array_each_index_2148387240'>2</a> total]
|
568
|
+
<ul style="display:none"><li class="color01" style="display:none"><img src="empty.png"> 0.11% (21.47%) Kernel#rand [10000 calls, <a href='multi.graph.html#Kernel_rand_2148387240'>20000</a> total]
|
569
|
+
</li><li class="color01" style="display:none"><img src="empty.png"> 0.10% (18.28%) Array#[]= [10000 calls, <a href='multi.graph.html#Array_[]__2148387240'>20000</a> total]
|
570
|
+
</li></ul></li><li class="color01" style="display:none"><img class="toggle" src="empty.png"> 0.00% (0.72%) Class#new [1 calls, <a href='multi.graph.html#Class_new_2148387240'>2</a> total]
|
571
|
+
<ul style="display:none"><li class="color01" style="display:none"><img src="empty.png"> 0.00% (88.89%) Array#initialize [1 calls, <a href='multi.graph.html#Array_initialize_2148387240'>2</a> total]
|
572
|
+
</li><li class="color01" style="display:none"><img src="empty.png"> 0.00% (1.85%) <Class::Array>#allocate [1 calls, <a href='multi.graph.html#_Class__Array__allocate_2148387240'>2</a> total]
|
573
|
+
</li></ul></li></ul></li></ul></li></ul></li></ul><div id="sentinel"></div></body></html>
|