!RBIX
12529030924842180271
x
M
1
n
n
x
10
__script__
i
158
5
7
0
64
47
49
1
1
15
5
7
2
64
47
49
1
1
15
99
7
3
7
4
65
67
49
5
0
49
6
4
15
99
7
7
7
8
65
67
49
5
0
49
6
4
15
45
9
10
49
11
0
19
0
15
45
12
13
20
0
49
14
1
9
68
1
8
91
5
7
15
20
0
47
101
16
7
17
63
3
47
49
18
1
15
5
79
47
49
19
1
15
45
9
20
49
11
0
19
1
15
5
7
21
20
0
47
101
16
7
22
20
1
47
101
16
7
23
63
5
47
49
18
1
15
45
24
25
45
12
26
20
0
49
27
1
49
28
1
19
2
15
45
12
29
20
1
7
30
64
56
31
50
32
2
15
2
11
I
9
I
3
I
0
I
0
n
p
33
s
8
rubygems
x
7
require
s
4
json
x
6
header
M
1
n
n
x
6
header
i
18
7
0
20
0
47
101
1
7
2
63
3
19
1
15
20
1
11
11
I
5
I
2
I
1
I
1
n
p
3
s
88
<html><head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>
x
4
to_s
s
13013
</title>
<style type="text/css">
<!--
body {
    font-size:70%;
    padding:0px;
    margin:5px;
    margin-right:0px;
    margin-left:0px;
    background: #ffffff;
}
ul {
    margin-left:0px;
    margin-top:0px;
    margin-bottom:0px;
    padding-left:0px;
    list-style-type:none;
}
li {
    margin-left:11px;
    padding:0px;
    white-space:nowrap;
    border-top:1px solid #cccccc;
    border-left:1px solid #cccccc;
    border-bottom:none;
}
.thread {
    margin-left:11px;
    background:#708090;
    padding-top:3px;
    padding-left:12px;
    padding-bottom:2px;
    border-left:1px solid #CCCCCC;
    border-top:1px solid #CCCCCC;
    font-weight:bold;
}
.hidden {
    display:none;
    width:0px;
    height:0px;
    margin:0px;
    padding:0px;
    border-style:none;
}
.color01 { background:#adbdeb }
.color05 { background:#9daddb }
.color0 { background:#8d9dcb }
.color1 { background:#89bccb }
.color2 { background:#56e3e7 }
.color3 { background:#32cd70 }
.color4 { background:#a3d53c }
.color5 { background:#c4cb34 }
.color6 { background:#dcb66d }
.color7 { background:#cda59e }
.color8 { background:#be9d9c }
.color9 { background:#cf947a }
#commands {
    font-size:10pt;
    padding:10px;
    margin-left:11px;
    margin-bottom:0px;
    margin-top:0px;
    background:#708090;
    border-top:1px solid #cccccc;
    border-left:1px solid #cccccc;
    border-bottom:none;
}
#titlebar {
    font-size:10pt;
    padding:10px;
    margin-left:11px;
    margin-bottom:0px;
    margin-top:10px;
    background:#8090a0;
    border-top:1px solid #cccccc;
    border-left:1px solid #cccccc;
    border-bottom:none;
}
#help {
    font-size:10pt;
    padding:10px;
    margin-left:11px;
    margin-bottom:0px;
    margin-top:0px;
    background:#8090a0;
    display:none;
    border-top:1px solid #cccccc;
    border-left:1px solid #cccccc;
    border-bottom:none;
}
#sentinel {
    height: 400px;
    margin-left:11px;
    background:#8090a0;
    border-top:1px solid #cccccc;
    border-left:1px solid #cccccc;
    border-bottom:none;
 }
input { margin-left:10px; }
-->
</style>
<script type="text/javascript">
/*
   Copyright (C) 2005,2009  Stefan Kaes
   skaes@railsexpress.de
*/

function rootNode() {
  return currentThread;
}

function hideUL(node) {
  var lis = node.childNodes
  var l = lis.length;
  for (var i=0; i < l ; i++ ) {
    hideLI(lis[i]);
  }
}

function showUL(node) {
  var lis = node.childNodes;
  var l = lis.length;
  for (var i=0; i < l ; i++ ) {
    showLI(lis[i]);
  }
}

function findUlChild(li){
  var ul = li.childNodes[2];
  while (ul && ul.nodeName != "UL") {
    ul = ul.nextSibling;
  }
  return ul;
}

function isLeafNode(li) {
  var img = li.firstChild;
  return (img.src.indexOf('empty.png') > -1);
}

function hideLI(li) {
  if (isLeafNode(li))
    return;

  var img = li.firstChild;
  img.src = 'http://asset.rubini.us/plus.png';

  var ul = findUlChild(li);
  if (ul) {
    ul.style.display = 'none';
    hideUL(ul);
  }
}

function showLI(li) {
  if (isLeafNode(li))
    return;

  var img = li.firstChild;
  img.src = 'http://asset.rubini.us/minus.png';

  var ul = findUlChild(li);
  if (ul) {
    ul.style.display = 'block';
    showUL(ul);
  }
}

function toggleLI(li) {
  var img = li.firstChild;
  if (img.src.indexOf("minus.png")>-1)
    hideLI(li);
  else {
    if (img.src.indexOf("plus.png")>-1)
      showLI(li);
  }
}

function aboveThreshold(text, threshold) {
  var match = text.match(/d+[.,]d+/);
  return (match && parseFloat(match[0].replace(/,/, '.'))>=threshold);
}

function setThresholdLI(li, threshold) {
  var img = li.firstChild;
  var text = img.nextSibling;
  var ul = findUlChild(li);

  var visible = aboveThreshold(text.nodeValue, threshold) ? 1 : 0;

  var count = 0;
  if (ul) {
    count = setThresholdUL(ul, threshold);
  }
  if (count>0) {
    img.src = 'http://asset.rubini.us/minus.png';
  }
  else {
    img.src = 'http://asset.rubini.us/empty.png';
  }
  if (visible) {
    li.style.display = 'block'
  }
  else {
    li.style.display = 'none'
  }
  return visible;
}

function setThresholdUL(node, threshold) {
  var lis = node.childNodes;
  var l = lis.length;

  var count = 0;
  for ( var i = 0; i < l ; i++ ) {
    count = count + setThresholdLI(lis[i], threshold);
  }

  var visible = (count > 0) ? 1 : 0;
  if (visible) {
    node.style.display = 'block';
  }
  else {
    node.style.display = 'none';
  }
  return visible;
}

function toggleChildren(img, event) {
  event.cancelBubble=true;

  if (img.src.indexOf('empty.png') > -1)
    return;

  var minus = (img.src.indexOf('minus.png') > -1);

  if (minus) {
    img.src = "http://asset.rubini.us/plus.png";
  }
  else
    img.src = "http://asset.rubini.us/minus.png";

  var li = img.parentNode;
  var ul = findUlChild(li);
  if (ul) {
    if (minus)
      ul.style.display = 'none';
    else
      ul.style.display = 'block';
  }
  if (minus)
    moveSelectionIfNecessary(li);
}

function showChildren(li) {
  var img = li.firstChild;
  if (img.src.indexOf('empty.png') > -1)
    return;
  img.src = "http://asset.rubini.us/minus.png";

  var ul = findUlChild(li);
  if (ul) {
    ul.style.display = 'block';
  }
}

function setThreshold() {
 var tv = document.getElementById("threshold").value;
 if (tv.match(/[0-9]+([.,][0-9]+)?/)) {
   var f = parseFloat(tv.replace(/,/, '.'));
   var threads = document.getElementsByName("thread");
   var l = threads.length;
   for ( var i = 0; i < l ; i++ ) {
     setThresholdUL(threads[i], f);
   }
   var p = selectedNode;
   while (p && p.style.display=='none')
     p=p.parentNode.parentNode;
   if (p && p.nodeName=="LI")
    selectNode(p);
 }
 else {
   alert("Please specify a decimal number as threshold value!");
 }
}

function collapseAll(event) {
  event.cancelBubble=true;
  var threads = document.getElementsByName("thread");
  var l = threads.length;
  for ( var i = 0; i < l ; i++ ) {
    hideUL(threads[i]);
  }
  selectNode(rootNode(), null);
}

function expandAll(event) {
  event.cancelBubble=true;
  var threads = document.getElementsByName("thread");
  var l = threads.length;
  for ( var i = 0; i < l ; i++ ) {
    showUL(threads[i]);
  }
}

function toggleHelp(node) {
  var help = document.getElementById("help");
  if (node.value == "Show Help") {
    node.value = "Hide Help";
    help.style.display = 'block';
  }
  else {
    node.value = "Show Help";
    help.style.display = 'none';
  }
}

var selectedNode = null;
var selectedColor = null;
var selectedThread = null;

function descendentOf(a,b){
  while (a!=b && b!=null)
    b=b.parentNode;
  return (a==b);
}

function moveSelectionIfNecessary(node){
  if (descendentOf(node, selectedNode))
    selectNode(node, null);
}

function selectNode(node, event) {
  if (event) {
    event.cancelBubble = true;
    thread = findThread(node);
    selectThread(thread);
  }
  if (selectedNode) {
    selectedNode.style.background = selectedColor;
  }
  selectedNode = node;
  selectedColor = node.style.background;
  selectedNode.style.background = "red";
  selectedNode.scrollIntoView();
  window.scrollBy(0,-400);
}

function moveUp(){
  var p = selectedNode.previousSibling;
  while (p && p.style.display == 'none')
    p = p.previousSibling;
  if (p && p.nodeName == "LI") {
    selectNode(p, null);
  }
}

function moveDown(){
  var p = selectedNode.nextSibling;
  while (p && p.style.display == 'none')
    p = p.nextSibling;
  if (p && p.nodeName == "LI") {
    selectNode(p, null);
  }
}

function moveLeft(){
  var p = selectedNode.parentNode.parentNode;
  if (p && p.nodeName=="LI") {
    selectNode(p, null);
  }
}

function moveRight(){
  if (!isLeafNode(selectedNode)) {
    showChildren(selectedNode);
    var ul = findUlChild(selectedNode);
    if (ul) {
      selectNode(ul.firstChild, null);
    }
  }
}

function moveForward(){
  if (isLeafNode(selectedNode)) {
    var p = selectedNode;
    while ((p.nextSibling == null || p.nextSibling.style.display=='none') && p.nodeName=="LI") {
      p = p.parentNode.parentNode;
    }
    if (p.nodeName=="LI")
      selectNode(p.nextSibling, null);
  }
  else {
    moveRight();
  }
}

function isExpandedNode(li){
  var img = li.firstChild;
  return(img.src.indexOf('minus.png')>-1);
}

function moveBackward(){
  var p = selectedNode;
  var q = p.previousSibling;
  while (q != null && q.style.display=='none')
    q = q.previousSibling;
  if (q == null) {
    p = p.parentNode.parentNode;
  } else {
    while (!isLeafNode(q) && isExpandedNode(q)) {
      q = findUlChild(q).lastChild;
      while (q.style.display=='none')
        q = q.previousSibling;
    }
    p = q;
  }
  if (p.nodeName=="LI")
    selectNode(p, null);
}

function moveHome() {
  selectNode(currentThread);
}

var currentThreadIndex = null;

function findThread(node){
  while (node && node.parentNode.nodeName!="BODY") {
    node = node.parentNode;
  }
  return node.firstChild;
}

function selectThread(node){
  var threads = document.getElementsByName("thread");
  currentThread = node;
  for (var i=0; i<threads.length; i++) {
    if (threads[i]==currentThread.parentNode)
      currentThreadIndex = i;
  }
}

function nextThread(){
  var threads = document.getElementsByName("thread");
  if (currentThreadIndex==threads.length-1)
    currentThreadIndex = 0;
  else
    currentThreadIndex += 1
  currentThread = threads[currentThreadIndex].firstChild;
  selectNode(currentThread, null);
}

function previousThread(){
  var threads = document.getElementsByName("thread");
  if (currentThreadIndex==0)
    currentThreadIndex = threads.length-1;
  else
    currentThreadIndex -= 1
  currentThread = threads[currentThreadIndex].firstChild;
  selectNode(currentThread, null);
}

function switchThread(node, event){
  event.cancelBubble = true;
  selectThread(node.nextSibling.firstChild);
  selectNode(currentThread, null);
}

function handleKeyEvent(event){
  var code = event.charCode ? event.charCode : event.keyCode;
  var str = String.fromCharCode(code);
  switch (str) {
    case "a": moveLeft();  break;
    case "s": moveDown();  break;
    case "d": moveRight(); break;
    case "w": moveUp();    break;
    case "f": moveForward(); break;
    case "b": moveBackward(); break;
    case "x": toggleChildren(selectedNode.firstChild, event); break;
    case "*": toggleLI(selectedNode); break;
    case "n": nextThread(); break;
    case "h": moveHome(); break;
    case "p": previousThread(); break;
  }
}
document.onkeypress=function(event){ handleKeyEvent(event) };

window.onload=function(){
  var images = document.getElementsByTagName("img");
  for (var i=0; i<images.length; i++) {
    var img = images[i];
    if (img.className == "toggle") {
      img.onclick = function(event){ toggleChildren(this, event); };
    }
  }
  var divs = document.getElementsByTagName("div");
  for (i=0; i<divs.length; i++) {
    var div = divs[i];
    if (div.className == "thread")
      div.onclick = function(event){ switchThread(this, event) };
  }
  var lis = document.getElementsByTagName("li");
  for (var i=0; i<lis.length; i++) {
    lis[i].onclick = function(event){ selectNode(this, event); };
  }
  var threads = document.getElementsByName("thread");
  currentThreadIndex = 0;
  currentThread = threads[0].firstChild;
  selectNode(currentThread, null);
}
</script>
</head><body>
<div id="titlebar">
Call tree for application <b>/Users/evan/.gem/ruby/1.8/bin/ruby-prof </b><br/>
Generated on Mon Mar 28 20:42:29 -0700 2011 with options {:min_percent=&gt;0}<br/>
</div>
<div id="commands">
<span style="font-size: 11pt; font-weight: bold;">Threshold:</span>
<input value="1.0" size="3" id="threshold" type="text">
<input value="Apply" onclick="setThreshold();" type="submit">
<input value="Expand All" onclick="expandAll(event);" type="submit">
<input value="Collapse All" onclick="collapseAll(event);" type="submit">
<input value="Show Help" onclick="toggleHelp(this);" type="submit">
</div>
<div style="display: none;" id="help">
<img src="http://asset.rubini.us/empty.png"> Enter a decimal value <i>d</i> into the threshold field and click "Apply"
to hide all nodes marked with time values lower than <i>d</i>.<br>
<img src="http://asset.rubini.us/empty.png"> Click on "Expand All" for full tree expansion.<br>
<img src="http://asset.rubini.us/empty.png"> Click on "Collapse All" to show only top level nodes.<br>
<img src="http://asset.rubini.us/empty.png"> Use a, s, d, w as in Quake or Urban Terror to navigate the tree.<br>
<img src="http://asset.rubini.us/empty.png"> Use f and b to navigate the tree in preorder forward and backwards.<br>
<img src="http://asset.rubini.us/empty.png"> Use x to toggle visibility of a subtree.<br>
<img src="http://asset.rubini.us/empty.png"> Use * to expand/collapse a whole subtree.<br>
<img src="http://asset.rubini.us/empty.png"> Use h to navigate to thread root.<br>
<img src="http://asset.rubini.us/empty.png"> Use n and p to navigate between threads.<br>
<img src="http://asset.rubini.us/empty.png"> Click on background to move focus to a subtree.<br>
</div>

p
9
I
-1
I
4
I
0
I
8
I
b
I
5
I
e
I
224
I
12
x
25
lib/bin/render_profile.rb
p
2
x
5
title
x
4
code
x
17
method_visibility
x
15
add_defn_method
x
10
print_node
M
1
n
n
x
10
print_node
i
307
23
3
10
8
78
19
3
15
20
2
7
0
64
49
1
1
20
1
49
2
0
49
1
1
19
4
15
20
4
9
34
1
8
51
5
7
3
20
1
47
101
2
63
2
47
49
4
1
15
1
11
15
7
5
64
7
6
20
4
7
7
64
49
1
1
49
8
0
20
2
7
9
64
49
1
1
49
8
0
49
10
1
49
11
1
35
1
49
12
1
19
5
15
20
2
7
13
64
49
1
1
20
4
7
14
64
49
1
1
49
2
0
49
1
1
7
15
64
49
1
1
19
6
15
20
5
49
16
0
4
10
49
10
1
19
7
15
20
4
7
17
64
49
1
1
49
18
0
9
180
20
0
7
19
20
7
47
101
2
7
20
20
5
47
101
2
7
21
20
6
47
101
2
63
6
49
4
1
8
297
20
3
4
20
85
22
9
227
20
0
7
19
20
7
47
101
2
7
23
20
5
47
101
2
7
21
20
6
47
101
2
63
6
49
4
1
15
20
0
7
24
64
49
4
1
8
264
20
0
7
19
20
7
47
101
2
7
25
20
5
47
101
2
7
21
20
6
47
101
2
63
6
49
4
1
15
20
0
7
26
64
49
4
1
15
20
4
7
17
64
49
1
1
56
27
50
28
0
19
8
15
20
8
56
29
50
30
0
15
20
0
7
31
64
49
4
1
15
20
0
7
32
64
49
4
1
11
I
10
I
9
I
3
I
4
n
p
33
s
5
nodes
x
2
[]
x
4
to_s
s
14
Missing node: 
x
4
puts
s
4
%.2f
d
 +0.781250000000000000000000000000000000000000000000000000     7
s
5
total
x
4
to_f
s
7
runtime
x
1
/
x
1
*
x
1
%
s
7
methods
s
6
method
s
4
name
x
4
to_i
s
9
sub_nodes
x
6
empty?
s
16
<li class="color
s
69
" style="display:block"><img src="http://asset.rubini.us/empty.png"> 
s
2
% 
x
1
>
s
83
" style="display:block"><img class="toggle" src="http://asset.rubini.us/plus.png"> 
s
25
<ul style="display:none">
s
84
" style="display:block"><img class="toggle" src="http://asset.rubini.us/minus.png"> 
s
4
<ul>
M
1
p
2
x
9
for_block
t
n
x
10
print_node
i
52
57
19
0
15
21
1
2
7
0
64
49
1
1
20
0
49
2
0
49
1
1
19
1
9
50
20
1
7
3
64
49
1
1
49
4
0
21
1
2
7
5
64
49
1
1
49
6
1
8
51
78
11
I
6
I
2
I
1
I
1
n
p
7
s
5
nodes
x
2
[]
x
4
to_s
s
5
total
x
4
to_f
s
7
runtime
x
1
/
p
11
I
0
I
23f
I
4
I
240
I
19
I
241
I
32
I
243
I
33
I
0
I
34
x
25
lib/bin/render_profile.rb
p
2
x
1
s
x
1
n
x
7
sort_by
M
1
p
2
x
9
for_block
t
n
x
10
print_node
i
24
57
19
0
15
5
21
1
0
20
0
21
1
2
21
1
3
79
81
0
47
49
1
4
11
I
8
I
1
I
1
I
1
n
p
2
x
1
+
x
10
print_node
p
5
I
0
I
247
I
4
I
248
I
18
x
25
lib/bin/render_profile.rb
p
1
x
4
s_id
x
12
reverse_each
s
5
</ul>
s
5
</li>
p
45
I
-1
I
227
I
8
I
228
I
1b
I
22a
I
22
I
22b
I
31
I
22c
I
33
I
0
I
34
I
22f
I
5d
I
230
I
7c
I
232
I
89
I
234
I
96
I
235
I
b4
I
237
I
bc
I
238
I
d9
I
239
I
e3
I
23b
I
100
I
23c
I
108
I
0
I
109
I
23f
I
119
I
247
I
121
I
24a
I
129
I
0
I
12a
I
24d
I
133
x
25
lib/bin/render_profile.rb
p
9
x
1
f
x
2
id
x
4
data
x
5
depth
x
4
node
x
4
prec
x
4
name
x
5
color
x
4
subs
x
4
ARGV
n
x
5
shift
x
4
File
n
x
7
exists?
s
6
File '
x
4
to_s
s
16
' does not exist
x
4
puts
x
4
exit
n
s
26
Rendering profiling from '
s
6
' to '
s
1
'
x
4
JSON
n
n
x
4
read
x
4
load
n
s
1
w
M
1
p
2
x
9
for_block
t
n
x
9
__block__
i
45
57
19
0
15
20
0
5
7
0
21
1
0
47
101
1
7
2
63
3
47
49
3
1
49
4
1
15
21
1
2
56
5
50
6
0
15
20
0
7
7
64
49
8
1
11
I
7
I
1
I
1
I
1
n
p
9
s
16
Profiling from '
x
4
to_s
s
1
'
x
6
header
x
2
<<
M
1
p
2
x
9
for_block
t
n
x
9
__block__
i
62
57
19
0
15
21
1
0
7
0
20
0
7
1
64
49
2
1
47
101
3
7
4
63
3
49
5
1
15
21
1
0
7
6
64
49
5
1
15
20
0
7
7
64
49
2
1
56
8
50
9
0
15
21
1
0
7
10
64
49
5
1
11
I
6
I
1
I
1
I
1
n
p
11
s
27
<div class="thread">Thread 
s
9
thread_id
x
2
[]
x
4
to_s
s
6
</div>
x
4
puts
s
18
<ul name="thread">
s
5
roots
M
1
p
2
x
9
for_block
t
n
x
9
__block__
i
18
57
19
0
15
5
21
2
0
20
0
21
1
0
47
49
0
3
11
I
6
I
1
I
1
I
1
n
p
1
x
10
print_node
p
5
I
0
I
263
I
4
I
264
I
12
x
25
lib/bin/render_profile.rb
p
1
x
4
n_id
x
4
each
s
5
</ul>
p
11
I
0
I
260
I
4
I
261
I
1c
I
262
I
26
I
263
I
34
I
266
I
3e
x
25
lib/bin/render_profile.rb
p
1
x
7
th_data
x
4
each
s
39
<div id="sentinel"></div></body></html>
x
4
puts
p
9
I
0
I
25d
I
4
I
25e
I
1b
I
260
I
24
I
269
I
2d
x
25
lib/bin/render_profile.rb
p
1
x
1
f
x
4
open
p
27
I
0
I
1
I
9
I
2
I
12
I
4
I
20
I
227
I
2e
I
250
I
37
I
252
I
44
I
253
I
55
I
254
I
5b
I
0
I
5c
I
257
I
65
I
259
I
7d
I
25b
I
8e
I
25d
I
9e
x
25
lib/bin/render_profile.rb
p
3
x
4
file
x
6
output
x
4
data
