Skip to content

Instantly share code, notes, and snippets.

@AndreasMadsen
Created September 17, 2015 20:05
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AndreasMadsen/54f9dd53e5e8ad586e8f to your computer and use it in GitHub Desktop.
Save AndreasMadsen/54f9dd53e5e8ad586e8f to your computer and use it in GitHub Desktop.
chrome-bug
<!DOCTYPE html>
<meta charset="utf8">
<title>dprof visualizer</title>
<style>
/* general page layout */
html, body {
margin: 0;
height: 100%;
}
body {
display: flex;
flex-direction: column;
}
section#info {
flex: 0 0 119px;
background: #F3F3F3;
border-bottom: 1px solid #666;
}
div#content-box {
flex-grow: 1;
}
svg {
display: block;
width: 100%;
}
svg#content {
box-sizing: border-box;
}
/* info style */
section#info {
font-family: monospace;
font-size: 8pt;
}
section#info #stacktrace {
float: left;
width: calc(100% - 155px);
height: 119px;
white-space: pre-wrap;
overflow-y: auto;
}
section#info #stats {
float: right;
width: 155px;
height: 119px;
white-space: pre-wrap;
}
</style>
<section id="info">
<div id="stacktrace"></div>
<div id="stats"></div>
</section>
<div id="content-box">
<svg id="content"></svg>
</div>
<script>
var nodes = [
{
'name':'GetAddrInfoReqWrap',
'stack':[
' at Object.lookup (dns.js:164:19)',
' at listenAfterLookup (net.js:1371:20)',
' at Server.listen (net.js:1367:5)',
' at Object.<anonymous> (/Users/Andreas/Sites/node_modules/dprof/test/scripts/tcp.js:10:8)',
' at Module._compile (module.js:434:26)',
' at Object.Module._extensions..js (module.js:452:10)',
' at Module.load (module.js:355:32)',
' at Function.Module._load (module.js:310:12)',
' at Function.Module.runMain (module.js:475:10)',
' at startup (node.js:117:18)',
' at node.js:951:3'
]
},
{
'name':'TCP',
'stack': [
' at exports._createServerHandle (net.js:1158:14)',
' at Server._listen2 (net.js:1215:14)',
' at listen (net.js:1267:10)',
' at net.js:1376:9',
' at GetAddrInfoReqWrap.asyncCallback [as callback] (dns.js:62:16)',
' at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:81:10)'
]
}
];
function clickNode(node) {
var stats = 'dprof version: 0.10.0\ntime: 10 sec\n';
var trace = '';
if (node) {
stats += `\nhandle: ${node.name}\n`;
trace += node.stack.join('\n');
}
document.querySelector('#stats').innerHTML = stats;
document.querySelector('#stacktrace').innerHTML = trace;
}
setTimeout(function () {
clickNode(nodes[0]);
setTimeout(function () {
clickNode(nodes[1]);
}, 500);
}, 500);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment