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.
Files changed (203) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGES +532 -467
  3. data/LICENSE +24 -24
  4. data/README.rdoc +5 -454
  5. data/Rakefile +110 -113
  6. data/bin/ruby-prof +380 -340
  7. data/bin/ruby-prof-check-trace +45 -45
  8. data/ext/ruby_prof/extconf.rb +36 -64
  9. data/ext/ruby_prof/rp_allocation.c +279 -0
  10. data/ext/ruby_prof/rp_allocation.h +31 -0
  11. data/ext/ruby_prof/rp_call_info.c +271 -407
  12. data/ext/ruby_prof/rp_call_info.h +35 -48
  13. data/ext/ruby_prof/rp_measure_allocations.c +52 -76
  14. data/ext/ruby_prof/rp_measure_memory.c +42 -77
  15. data/ext/ruby_prof/rp_measure_process_time.c +67 -71
  16. data/ext/ruby_prof/rp_measure_wall_time.c +62 -45
  17. data/ext/ruby_prof/rp_measurement.c +230 -0
  18. data/ext/ruby_prof/rp_measurement.h +50 -0
  19. data/ext/ruby_prof/rp_method.c +630 -411
  20. data/ext/ruby_prof/rp_method.h +70 -52
  21. data/ext/ruby_prof/rp_profile.c +895 -0
  22. data/ext/ruby_prof/rp_profile.h +37 -0
  23. data/ext/ruby_prof/rp_stack.c +196 -128
  24. data/ext/ruby_prof/rp_stack.h +56 -51
  25. data/ext/ruby_prof/rp_thread.c +337 -273
  26. data/ext/ruby_prof/rp_thread.h +36 -27
  27. data/ext/ruby_prof/ruby_prof.c +48 -671
  28. data/ext/ruby_prof/ruby_prof.h +17 -56
  29. data/ext/ruby_prof/vc/ruby_prof.sln +20 -21
  30. data/ext/ruby_prof/vc/{ruby_prof_20.vcxproj → ruby_prof.vcxproj} +38 -5
  31. data/lib/ruby-prof.rb +52 -58
  32. data/lib/ruby-prof/assets/call_stack_printer.html.erb +713 -0
  33. data/lib/ruby-prof/assets/call_stack_printer.png +0 -0
  34. data/lib/ruby-prof/assets/graph_printer.html.erb +356 -0
  35. data/lib/ruby-prof/call_info.rb +57 -126
  36. data/lib/ruby-prof/call_info_visitor.rb +38 -40
  37. data/lib/ruby-prof/compatibility.rb +109 -178
  38. data/lib/ruby-prof/exclude_common_methods.rb +198 -0
  39. data/lib/ruby-prof/measurement.rb +14 -0
  40. data/lib/ruby-prof/method_info.rb +90 -129
  41. data/lib/ruby-prof/printers/abstract_printer.rb +127 -85
  42. data/lib/ruby-prof/printers/call_info_printer.rb +51 -41
  43. data/lib/ruby-prof/printers/call_stack_printer.rb +182 -260
  44. data/lib/ruby-prof/printers/call_tree_printer.rb +151 -130
  45. data/lib/ruby-prof/printers/dot_printer.rb +132 -132
  46. data/lib/ruby-prof/printers/flat_printer.rb +52 -70
  47. data/lib/ruby-prof/printers/graph_html_printer.rb +63 -244
  48. data/lib/ruby-prof/printers/graph_printer.rb +114 -116
  49. data/lib/ruby-prof/printers/multi_printer.rb +127 -58
  50. data/lib/ruby-prof/profile.rb +33 -55
  51. data/lib/ruby-prof/rack.rb +171 -95
  52. data/lib/ruby-prof/task.rb +147 -147
  53. data/lib/ruby-prof/thread.rb +35 -41
  54. data/lib/ruby-prof/version.rb +3 -3
  55. data/lib/unprof.rb +10 -10
  56. data/ruby-prof.gemspec +58 -57
  57. data/test/abstract_printer_test.rb +26 -0
  58. data/test/alias_test.rb +129 -0
  59. data/test/basic_test.rb +129 -128
  60. data/test/call_info_visitor_test.rb +31 -31
  61. data/test/duplicate_names_test.rb +32 -32
  62. data/test/dynamic_method_test.rb +53 -55
  63. data/test/enumerable_test.rb +21 -21
  64. data/test/exceptions_test.rb +24 -16
  65. data/test/exclude_methods_test.rb +146 -0
  66. data/test/exclude_threads_test.rb +53 -53
  67. data/test/fiber_test.rb +73 -79
  68. data/test/gc_test.rb +96 -0
  69. data/test/line_number_test.rb +161 -71
  70. data/test/marshal_test.rb +119 -0
  71. data/test/measure_allocations.rb +30 -0
  72. data/test/measure_allocations_test.rb +385 -26
  73. data/test/measure_allocations_trace_test.rb +385 -0
  74. data/test/measure_memory_trace_test.rb +756 -0
  75. data/test/measure_process_time_test.rb +849 -63
  76. data/test/measure_times.rb +54 -0
  77. data/test/measure_wall_time_test.rb +459 -255
  78. data/test/multi_printer_test.rb +71 -83
  79. data/test/no_method_class_test.rb +15 -15
  80. data/test/parser_timings.rb +24 -0
  81. data/test/pause_resume_test.rb +166 -166
  82. data/test/prime.rb +56 -54
  83. data/test/printer_call_stack_test.rb +28 -0
  84. data/test/printer_call_tree_test.rb +31 -0
  85. data/test/printer_flat_test.rb +68 -0
  86. data/test/printer_graph_html_test.rb +60 -0
  87. data/test/printer_graph_test.rb +41 -0
  88. data/test/printers_test.rb +141 -255
  89. data/test/printing_recursive_graph_test.rb +81 -127
  90. data/test/rack_test.rb +157 -93
  91. data/test/recursive_test.rb +210 -215
  92. data/test/singleton_test.rb +38 -38
  93. data/test/stack_printer_test.rb +64 -78
  94. data/test/start_stop_test.rb +109 -112
  95. data/test/test_helper.rb +24 -264
  96. data/test/thread_test.rb +144 -187
  97. data/test/unique_call_path_test.rb +190 -202
  98. data/test/yarv_test.rb +56 -55
  99. metadata +34 -114
  100. data/doc/LICENSE.html +0 -114
  101. data/doc/README_rdoc.html +0 -603
  102. data/doc/Rack.html +0 -95
  103. data/doc/Rack/RubyProf.html +0 -226
  104. data/doc/RubyProf.html +0 -962
  105. data/doc/RubyProf/AbstractPrinter.html +0 -546
  106. data/doc/RubyProf/AggregateCallInfo.html +0 -551
  107. data/doc/RubyProf/CallInfo.html +0 -639
  108. data/doc/RubyProf/CallInfoPrinter.html +0 -120
  109. data/doc/RubyProf/CallInfoVisitor.html +0 -198
  110. data/doc/RubyProf/CallStackPrinter.html +0 -1121
  111. data/doc/RubyProf/CallTreePrinter.html +0 -641
  112. data/doc/RubyProf/Cmd.html +0 -631
  113. data/doc/RubyProf/DotPrinter.html +0 -257
  114. data/doc/RubyProf/FlatPrinter.html +0 -163
  115. data/doc/RubyProf/FlatPrinterWithLineNumbers.html +0 -208
  116. data/doc/RubyProf/GraphHtmlPrinter.html +0 -552
  117. data/doc/RubyProf/GraphPrinter.html +0 -139
  118. data/doc/RubyProf/MethodInfo.html +0 -745
  119. data/doc/RubyProf/MultiPrinter.html +0 -360
  120. data/doc/RubyProf/Profile.html +0 -763
  121. data/doc/RubyProf/ProfileTask.html +0 -490
  122. data/doc/RubyProf/Thread.html +0 -310
  123. data/doc/created.rid +0 -31
  124. data/doc/css/fonts.css +0 -167
  125. data/doc/css/rdoc.css +0 -590
  126. data/doc/examples/flat_txt.html +0 -138
  127. data/doc/examples/graph_html.html +0 -909
  128. data/doc/examples/graph_txt.html +0 -247
  129. data/doc/fonts/Lato-Light.ttf +0 -0
  130. data/doc/fonts/Lato-LightItalic.ttf +0 -0
  131. data/doc/fonts/Lato-Regular.ttf +0 -0
  132. data/doc/fonts/Lato-RegularItalic.ttf +0 -0
  133. data/doc/fonts/SourceCodePro-Bold.ttf +0 -0
  134. data/doc/fonts/SourceCodePro-Regular.ttf +0 -0
  135. data/doc/images/add.png +0 -0
  136. data/doc/images/arrow_up.png +0 -0
  137. data/doc/images/brick.png +0 -0
  138. data/doc/images/brick_link.png +0 -0
  139. data/doc/images/bug.png +0 -0
  140. data/doc/images/bullet_black.png +0 -0
  141. data/doc/images/bullet_toggle_minus.png +0 -0
  142. data/doc/images/bullet_toggle_plus.png +0 -0
  143. data/doc/images/date.png +0 -0
  144. data/doc/images/delete.png +0 -0
  145. data/doc/images/find.png +0 -0
  146. data/doc/images/loadingAnimation.gif +0 -0
  147. data/doc/images/macFFBgHack.png +0 -0
  148. data/doc/images/package.png +0 -0
  149. data/doc/images/page_green.png +0 -0
  150. data/doc/images/page_white_text.png +0 -0
  151. data/doc/images/page_white_width.png +0 -0
  152. data/doc/images/plugin.png +0 -0
  153. data/doc/images/ruby.png +0 -0
  154. data/doc/images/tag_blue.png +0 -0
  155. data/doc/images/tag_green.png +0 -0
  156. data/doc/images/transparent.png +0 -0
  157. data/doc/images/wrench.png +0 -0
  158. data/doc/images/wrench_orange.png +0 -0
  159. data/doc/images/zoom.png +0 -0
  160. data/doc/index.html +0 -626
  161. data/doc/js/darkfish.js +0 -161
  162. data/doc/js/jquery.js +0 -4
  163. data/doc/js/navigation.js +0 -142
  164. data/doc/js/navigation.js.gz +0 -0
  165. data/doc/js/search.js +0 -109
  166. data/doc/js/search_index.js +0 -1
  167. data/doc/js/search_index.js.gz +0 -0
  168. data/doc/js/searcher.js +0 -228
  169. data/doc/js/searcher.js.gz +0 -0
  170. data/doc/table_of_contents.html +0 -942
  171. data/examples/cachegrind.out.1 +0 -114
  172. data/examples/cachegrind.out.1.32313213 +0 -114
  173. data/examples/flat.txt +0 -50
  174. data/examples/graph.dot +0 -84
  175. data/examples/graph.html +0 -823
  176. data/examples/graph.txt +0 -139
  177. data/examples/multi.flat.txt +0 -23
  178. data/examples/multi.graph.html +0 -760
  179. data/examples/multi.grind.dat +0 -114
  180. data/examples/multi.stack.html +0 -547
  181. data/examples/stack.html +0 -547
  182. data/ext/ruby_prof/rp_measure.c +0 -40
  183. data/ext/ruby_prof/rp_measure.h +0 -45
  184. data/ext/ruby_prof/rp_measure_cpu_time.c +0 -136
  185. data/ext/ruby_prof/rp_measure_gc_runs.c +0 -73
  186. data/ext/ruby_prof/rp_measure_gc_time.c +0 -60
  187. data/ext/ruby_prof/vc/ruby_prof_18.vcxproj +0 -108
  188. data/ext/ruby_prof/vc/ruby_prof_19.vcxproj +0 -110
  189. data/lib/ruby-prof/aggregate_call_info.rb +0 -76
  190. data/lib/ruby-prof/assets/call_stack_printer.css.html +0 -117
  191. data/lib/ruby-prof/assets/call_stack_printer.js.html +0 -385
  192. data/lib/ruby-prof/printers/flat_printer_with_line_numbers.rb +0 -64
  193. data/test/aggregate_test.rb +0 -136
  194. data/test/block_test.rb +0 -74
  195. data/test/call_info_test.rb +0 -78
  196. data/test/issue137_test.rb +0 -63
  197. data/test/measure_cpu_time_test.rb +0 -213
  198. data/test/measure_gc_runs_test.rb +0 -32
  199. data/test/measure_gc_time_test.rb +0 -36
  200. data/test/measure_memory_test.rb +0 -33
  201. data/test/method_elimination_test.rb +0 -84
  202. data/test/module_test.rb +0 -45
  203. data/test/stack_test.rb +0 -138
@@ -1,547 +0,0 @@
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:0;
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
- .toggle {
104
- background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABsAAAAJCAMAAAD0FKf3AAAAA3NCSVQICAjb4U/gAAAAb1BMVEX///98jcR8jMV4jMB7jcR7jcR8jcT////7/f/3/P/0+vzx+v7s9vzq9Pzm8Prk7vzi7fnj5/Pc5vTb5vbg5PHW4fHV3/XS3fLM1+3K1e/G0e3EzuzCzey8x+m8xuystuSqtt98jsR8jcR7jcQAAADWswcWAAAAJXRSTlMAVVVV3e7u////////////////////////////////////////Vv4VOQAAAAlwSFlzAAALEgAACxIB0t1+/AAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTNui8sowAAACVSURBVAiZPc/hDoIwDATgobCWgZsWgSGidOz9n9F1CPfrki+5tIqPXHSQVMVZFH8/sx/Is16X9zR2vtQPAMC6LxVnco5Dpvtt40QRGrspnueBqDUcdmrEMILtknkiQkQOU5RAsn9RPGRKNkLOxiibIEauNSYZy2CNyerGRngtsilkiLXP9Cx1bzuAZU13Himq/a3rWX4VVRPEuDWiLQAAAABJRU5ErkJggg==) no-repeat left center;
105
- float:left;
106
- width:9px;
107
- height:9px;
108
- margin:2px 1px 1px 1px;
109
- }
110
-
111
- .toggle.minus {
112
- background-position: -9px 0;
113
- }
114
-
115
- .toggle.plus {
116
- background-position: -18px 0;
117
- }
118
-
119
- -->
120
- </style>
121
- <script type="text/javascript">
122
- /*
123
- Copyright (C) 2005,2009 Stefan Kaes
124
- skaes@railsexpress.de
125
- */
126
-
127
- function rootNode() {
128
- return currentThread;
129
- }
130
-
131
- function showUL(node, show) {
132
- var lis = node.childNodes;
133
- var l = lis.length;
134
- for (var i=0; i < l ; i++ ) {
135
- toggle(lis[i], show);
136
- }
137
- }
138
-
139
- function findUlChild(li){
140
- var ul = li.childNodes[2];
141
- while (ul && ul.nodeName != "UL") {
142
- ul = ul.nextSibling;
143
- }
144
- return ul;
145
- }
146
-
147
- function isLeafNode(li) {
148
- var img = li.firstChild;
149
- return (img.className.indexOf('empty') > -1);
150
- }
151
-
152
- function toggle(li, show) {
153
- if (isLeafNode(li))
154
- return;
155
-
156
- var img = li.firstChild;
157
- img.className = 'toggle ';
158
- img.className += show ? 'minus' : 'plus';
159
-
160
- var ul = findUlChild(li);
161
- if (ul) {
162
- ul.style.display = show ? 'block' : 'none';
163
- showUL(ul, true);
164
- }
165
- }
166
-
167
- function toggleLI(li) {
168
- var img = li.firstChild;
169
- if (img.className.indexOf("minus")>-1)
170
- toggle(li, false);
171
- else {
172
- if (img.className.indexOf("plus")>-1)
173
- toggle(li, true);
174
- }
175
- }
176
-
177
- function aboveThreshold(text, threshold) {
178
- var match = text.match(/\d+[.,]\d+/);
179
- return (match && parseFloat(match[0].replace(/,/, '.'))>=threshold);
180
- }
181
-
182
- function setThresholdLI(li, threshold) {
183
- var img = li.firstChild;
184
- var text = img.nextSibling;
185
- var ul = findUlChild(li);
186
-
187
- var visible = aboveThreshold(text.nodeValue, threshold) ? 1 : 0;
188
-
189
- var count = 0;
190
- if (ul) {
191
- count = setThresholdUL(ul, threshold);
192
- }
193
- if (count>0) {
194
- img.className = 'toggle minus';
195
- }
196
- else {
197
- img.className = 'toggle empty';
198
- }
199
- if (visible) {
200
- li.style.display = 'block'
201
- }
202
- else {
203
- li.style.display = 'none'
204
- }
205
- return visible;
206
- }
207
-
208
- function setThresholdUL(node, threshold) {
209
- var lis = node.childNodes;
210
- var l = lis.length;
211
-
212
- var count = 0;
213
- for ( var i = 0; i < l ; i++ ) {
214
- count = count + setThresholdLI(lis[i], threshold);
215
- }
216
-
217
- var visible = (count > 0) ? 1 : 0;
218
- if (visible) {
219
- node.style.display = 'block';
220
- }
221
- else {
222
- node.style.display = 'none';
223
- }
224
- return visible;
225
- }
226
-
227
- function toggleChildren(img, event) {
228
- event.cancelBubble=true;
229
- if (img.className.indexOf('empty') > -1)
230
- return;
231
-
232
- var minus = (img.className.indexOf('minus') > -1);
233
-
234
- if (minus) {
235
- img.className = 'toggle plus';
236
- }
237
- else
238
- img.className = 'toggle minus';
239
-
240
- var li = img.parentNode;
241
- var ul = findUlChild(li);
242
- if (ul) {
243
- if (minus)
244
- ul.style.display = 'none';
245
- else
246
- ul.style.display = 'block';
247
- }
248
- if (minus)
249
- moveSelectionIfNecessary(li);
250
- }
251
-
252
- function showChildren(li) {
253
- var img = li.firstChild;
254
- if (img.className.indexOf('empty') > -1)
255
- return;
256
- img.className = 'toggle minus';
257
-
258
- var ul = findUlChild(li);
259
- if (ul) {
260
- ul.style.display = 'block';
261
- }
262
- }
263
-
264
- function setThreshold() {
265
- var tv = document.getElementById("threshold").value;
266
- if (tv.match(/[0-9]+([.,][0-9]+)?/)) {
267
- var f = parseFloat(tv.replace(/,/, '.'));
268
- var threads = document.getElementsByName("thread");
269
- var l = threads.length;
270
- for ( var i = 0; i < l ; i++ ) {
271
- setThresholdUL(threads[i], f);
272
- }
273
- var p = selectedNode;
274
- while (p && p.style.display=='none')
275
- p=p.parentNode.parentNode;
276
- if (p && p.nodeName=="LI")
277
- selectNode(p);
278
- }
279
- else {
280
- alert("Please specify a decimal number as threshold value!");
281
- }
282
- }
283
-
284
- function expandAll(event) {
285
- toggleAll(event, true);
286
- }
287
-
288
- function collapseAll(event) {
289
- toggleAll(event, false);
290
- selectNode(rootNode(), null);
291
- }
292
-
293
- function toggleAll(event, show) {
294
- event.cancelBubble=true;
295
- var threads = document.getElementsByName("thread");
296
- var l = threads.length;
297
- for ( var i = 0; i < l ; i++ ) {
298
- showUL(threads[i], show);
299
- }
300
- }
301
-
302
- function toggleHelp(node) {
303
- var help = document.getElementById("help");
304
- if (node.value == "Show Help") {
305
- node.value = "Hide Help";
306
- help.style.display = 'block';
307
- }
308
- else {
309
- node.value = "Show Help";
310
- help.style.display = 'none';
311
- }
312
- }
313
-
314
- var selectedNode = null;
315
- var selectedColor = null;
316
- var selectedThread = null;
317
-
318
- function descendentOf(a,b){
319
- while (a!=b && b!=null)
320
- b=b.parentNode;
321
- return (a==b);
322
- }
323
-
324
- function moveSelectionIfNecessary(node){
325
- if (descendentOf(node, selectedNode))
326
- selectNode(node, null);
327
- }
328
-
329
- function selectNode(node, event) {
330
- if (event) {
331
- event.cancelBubble = true;
332
- thread = findThread(node);
333
- selectThread(thread);
334
- }
335
- if (selectedNode) {
336
- selectedNode.style.background = selectedColor;
337
- }
338
- selectedNode = node;
339
- selectedColor = node.style.background;
340
- selectedNode.style.background = "red";
341
- selectedNode.scrollIntoView();
342
- window.scrollBy(0,-400);
343
- }
344
-
345
- function moveUp(){
346
- move(selectedNode.previousSibling);
347
- }
348
-
349
- function moveDown(){
350
- move(selectedNode.nextSibling);
351
- }
352
-
353
- function move(p) {
354
- while (p && p.style.display == 'none')
355
- p = p.nextSibling;
356
- if (p && p.nodeName == "LI") {
357
- selectNode(p, null);
358
- }
359
- }
360
-
361
- function moveLeft(){
362
- var p = selectedNode.parentNode.parentNode;
363
- if (p && p.nodeName=="LI") {
364
- selectNode(p, null);
365
- }
366
- }
367
-
368
- function moveRight(){
369
- if (!isLeafNode(selectedNode)) {
370
- showChildren(selectedNode);
371
- var ul = findUlChild(selectedNode);
372
- if (ul) {
373
- selectNode(ul.firstChild, null);
374
- }
375
- }
376
- }
377
-
378
- function moveForward(){
379
- if (isLeafNode(selectedNode)) {
380
- var p = selectedNode;
381
- while ((p.nextSibling == null || p.nextSibling.style.display=='none') && p.nodeName=="LI") {
382
- p = p.parentNode.parentNode;
383
- }
384
- if (p.nodeName=="LI")
385
- selectNode(p.nextSibling, null);
386
- }
387
- else {
388
- moveRight();
389
- }
390
- }
391
-
392
- function isExpandedNode(li){
393
- var img = li.firstChild;
394
- return(img.className.indexOf('minus')>-1);
395
- }
396
-
397
- function moveBackward(){
398
- var p = selectedNode;
399
- var q = p.previousSibling;
400
- while (q != null && q.style.display=='none')
401
- q = q.previousSibling;
402
- if (q == null) {
403
- p = p.parentNode.parentNode;
404
- } else {
405
- while (!isLeafNode(q) && isExpandedNode(q)) {
406
- q = findUlChild(q).lastChild;
407
- while (q.style.display=='none')
408
- q = q.previousSibling;
409
- }
410
- p = q;
411
- }
412
- if (p.nodeName=="LI")
413
- selectNode(p, null);
414
- }
415
-
416
- function moveHome() {
417
- selectNode(currentThread);
418
- }
419
-
420
- var currentThreadIndex = null;
421
-
422
- function findThread(node){
423
- while (node && !node.parentNode.nodeName.match(/BODY|DIV/g)) {
424
- node = node.parentNode;
425
- }
426
- return node.firstChild;
427
- }
428
-
429
- function selectThread(node){
430
- var threads = document.getElementsByName("thread");
431
- currentThread = node;
432
- for (var i=0; i<threads.length; i++) {
433
- if (threads[i]==currentThread.parentNode)
434
- currentThreadIndex = i;
435
- }
436
- }
437
-
438
- function nextThread(){
439
- var threads = document.getElementsByName("thread");
440
- if (currentThreadIndex==threads.length-1)
441
- currentThreadIndex = 0;
442
- else
443
- currentThreadIndex += 1
444
- currentThread = threads[currentThreadIndex].firstChild;
445
- selectNode(currentThread, null);
446
- }
447
-
448
- function previousThread(){
449
- var threads = document.getElementsByName("thread");
450
- if (currentThreadIndex==0)
451
- currentThreadIndex = threads.length-1;
452
- else
453
- currentThreadIndex -= 1
454
- currentThread = threads[currentThreadIndex].firstChild;
455
- selectNode(currentThread, null);
456
- }
457
-
458
- function switchThread(node, event){
459
- event.cancelBubble = true;
460
- selectThread(node.nextSibling.firstChild);
461
- selectNode(currentThread, null);
462
- }
463
-
464
- function handleKeyEvent(event){
465
- var code = event.charCode ? event.charCode : event.keyCode;
466
- var str = String.fromCharCode(code);
467
- switch (str) {
468
- case "a": moveLeft(); break;
469
- case "s": moveDown(); break;
470
- case "d": moveRight(); break;
471
- case "w": moveUp(); break;
472
- case "f": moveForward(); break;
473
- case "b": moveBackward(); break;
474
- case "x": toggleChildren(selectedNode.firstChild, event); break;
475
- case "*": toggleLI(selectedNode); break;
476
- case "n": nextThread(); break;
477
- case "h": moveHome(); break;
478
- case "p": previousThread(); break;
479
- }
480
- }
481
- document.onkeypress=function(event){ handleKeyEvent(event) };
482
-
483
- window.onload=function(){
484
- var images = document.querySelectorAll(".toggle");
485
- for (var i=0; i<images.length; i++) {
486
- var img = images[i];
487
- img.onclick = function(event){ toggleChildren(this, event); return false; };
488
- }
489
- var divs = document.getElementsByTagName("div");
490
- for (i=0; i<divs.length; i++) {
491
- var div = divs[i];
492
- if (div.className == "thread")
493
- div.onclick = function(event){ switchThread(this, event) };
494
- }
495
- var lis = document.getElementsByTagName("li");
496
- for (var i=0; i<lis.length; i++) {
497
- lis[i].onclick = function(event){ selectNode(this, event); };
498
- }
499
- var threads = document.getElementsByName("thread");;
500
- currentThreadIndex = 0;
501
- currentThread = threads[0].firstChild;
502
- selectNode(currentThread, null);
503
- };
504
-
505
- </script>
506
- </head><body><div style="display: inline-block;">
507
- <div id="titlebar">
508
- Call tree for application <b>primes </b><br/>
509
- Generated on 2015-04-24 11:52:24 +0200 with options {:application=&gt;&quot;primes&quot;}<br/>
510
- </div>
511
- <div id="commands">
512
- <span style="font-size: 11pt; font-weight: bold;">Threshold:</span>
513
- <input value="1.0" size="3" id="threshold" type="text">
514
- <input value="Apply" onclick="setThreshold();" type="submit">
515
- <input value="Expand All" onclick="expandAll(event);" type="submit">
516
- <input value="Collapse All" onclick="collapseAll(event);" type="submit">
517
- <input value="Show Help" onclick="toggleHelp(this);" type="submit">
518
- </div>
519
- <div style="display: none;" id="help">
520
- &#8226; Enter a decimal value <i>d</i> into the threshold field and click "Apply"
521
- to hide all nodes marked with time values lower than <i>d</i>.<br>
522
- &#8226; Click on "Expand All" for full tree expansion.<br>
523
- &#8226; Click on "Collapse All" to show only top level nodes.<br>
524
- &#8226; Use a, s, d, w as in Quake or Urban Terror to navigate the tree.<br>
525
- &#8226; Use f and b to navigate the tree in preorder forward and backwards.<br>
526
- &#8226; Use x to toggle visibility of a subtree.<br>
527
- &#8226; Use * to expand/collapse a whole subtree.<br>
528
- &#8226; Use h to navigate to thread root.<br>
529
- &#8226; Use n and p to navigate between threads.<br>
530
- &#8226; Click on background to move focus to a subtree.<br>
531
- </div>
532
- <div class="thread">Thread: 70140045951280, Fiber: 70140054192180 (100.00% ~ 0.0029680728912353516)</div><ul name="thread"><li class="color9" style="display:block"><a href="#" class="toggle minus" ></a><span> 100.00% (100.00%) <a href="txmt://open?url=file:///Users/stefan.kaes/src/ruby-prof/test/printers_test.rb&line=14">PrintersTest#setup</a> [1 calls, 1 total]</span>
533
- <ul><li class="color9" style="display:block"><a href="#" class="toggle minus" ></a><span> 99.82% (99.82%) <a href="txmt://open?url=file:///Users/stefan.kaes/src/ruby-prof/test/prime.rb&line=45">Object#run_primes</a> [1 calls, 1 total]</span>
534
- <ul><li class="color9" style="display:block"><a href="#" class="toggle minus" ></a><span> 92.62% (92.78%) <a href="txmt://open?url=file:///Users/stefan.kaes/src/ruby-prof/test/prime.rb&line=24">Object#find_primes</a> [1 calls, 1 total]</span>
535
- <ul><li class="color9" style="display:block"><a href="#" class="toggle minus" ></a><span> 92.55% (99.93%) Array#select [1 calls, 1 total]</span>
536
- <ul><li class="color8" style="display:block"><a href="#" class="toggle minus" ></a><span> 89.73% (96.95%) <a href="txmt://open?url=file:///Users/stefan.kaes/src/ruby-prof/test/prime.rb&line=16">Object#is_prime</a> [200 calls, 200 total]</span>
537
- <ul><li class="color8" style="display:block"><a href="#" class="toggle empty" ></a><span> 86.63% (96.54%) Integer#upto [200 calls, 201 total]</span>
538
- </li></ul></li></ul></li></ul></li><li class="color05" style="display:block"><a href="#" class="toggle plus" ></a><span> 6.64% (6.65%) <a href="txmt://open?url=file:///Users/stefan.kaes/src/ruby-prof/test/prime.rb&line=7">Object#make_random_array</a> [1 calls, 1 total]</span>
539
- <ul style="display:none"><li class="color05" style="display:block"><a href="#" class="toggle plus" ></a><span> 6.33% (95.40%) Array#each_index [1 calls, 1 total]</span>
540
- <ul style="display:none"><li class="color01" style="display:block"><a href="#" class="toggle plus" ></a><span> 3.96% (62.56%) Kernel#rand [200 calls, 200 total]</span>
541
- <ul style="display:none"><li class="color01" style="display:block"><a href="#" class="toggle empty" ></a><span> 1.02% (25.76%) Kernel#respond_to_missing? [200 calls, 200 total]</span>
542
- </li></ul></li></ul></li><li class="color01" style="display:none"><a href="#" class="toggle empty" ></a><span> 0.20% (3.03%) Class#new [1 calls, 1 total]</span>
543
- <ul style="display:none"><li class="color01" style="display:none"><a href="#" class="toggle empty" ></a><span> 0.06% (32.00%) Array#initialize [1 calls, 1 total]</span>
544
- </li></ul></li></ul></li><li class="color01" style="display:none"><a href="#" class="toggle empty" ></a><span> 0.51% (0.51%) <a href="txmt://open?url=file:///Users/stefan.kaes/src/ruby-prof/test/prime.rb&line=31">Object#find_largest</a> [1 calls, 1 total]</span>
545
- <ul style="display:none"><li class="color01" style="display:none"><a href="#" class="toggle empty" ></a><span> 0.37% (73.02%) Integer#upto [1 calls, 201 total]</span>
546
- </li><li class="color01" style="display:none"><a href="#" class="toggle empty" ></a><span> 0.03% (6.35%) Array#first [1 calls, 1 total]</span>
547
- </li></ul></li></ul></li></ul></li></ul><div id="sentinel"></div></div></body></html>