Skip to content

Instantly share code, notes, and snippets.

@fwbrasil
Created June 11, 2023 21:51
Show Gist options
  • Save fwbrasil/69fab710c03fbe2258401bfb4a16666a to your computer and use it in GitHub Desktop.
Save fwbrasil/69fab710c03fbe2258401bfb4a16666a to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang='en'>
<head>
<meta charset='utf-8'>
<style>
body {margin: 0; padding: 10px; background-color: #ffffff}
h1 {margin: 5px 0 0 0; font-size: 18px; font-weight: normal; text-align: center}
header {margin: -24px 0 5px 0; line-height: 24px}
button {font: 12px sans-serif; cursor: pointer}
p {margin: 5px 0 5px 0}
a {color: #0366d6}
#hl {position: absolute; display: none; overflow: hidden; white-space: nowrap; pointer-events: none; background-color: #ffffe0; outline: 1px solid #ffc000; height: 15px}
#hl span {padding: 0 3px 0 3px}
#status {overflow: hidden; white-space: nowrap}
#match {overflow: hidden; white-space: nowrap; display: none; float: right; text-align: right}
#reset {cursor: pointer}
#canvas {width: 100%; height: 400px}
</style>
</head>
<body style='font: 12px Verdana, sans-serif'>
<h1>Allocation profile</h1>
<header style='text-align: left'><button id='reverse' title='Reverse'>&#x1f53b;</button>&nbsp;&nbsp;<button id='search' title='Search'>&#x1f50d;</button></header>
<header style='text-align: right'>Produced by <a href='https://github.com/jvm-profiling-tools/async-profiler'>async-profiler</a></header>
<canvas id='canvas'></canvas>
<div id='hl'><span></span></div>
<p id='match'>Matched: <span id='matchval'></span> <span id='reset' title='Clear'>&#x274c;</span></p>
<p id='status'>&nbsp;</p>
<script>
// Copyright 2020 Andrei Pangin
// Licensed under the Apache License, Version 2.0.
'use strict';
var root, rootLevel, px, pattern;
var reverse = false;
const levels = Array(25);
for (let h = 0; h < levels.length; h++) {
levels[h] = [];
}
const canvas = document.getElementById('canvas');
const c = canvas.getContext('2d');
const hl = document.getElementById('hl');
const status = document.getElementById('status');
const canvasWidth = canvas.offsetWidth;
const canvasHeight = canvas.offsetHeight;
canvas.style.width = canvasWidth + 'px';
canvas.width = canvasWidth * (devicePixelRatio || 1);
canvas.height = canvasHeight * (devicePixelRatio || 1);
if (devicePixelRatio) c.scale(devicePixelRatio, devicePixelRatio);
c.font = document.body.style.font;
const palette = [
[0xb2e1b2, 20, 20, 20],
[0x50e150, 30, 30, 30],
[0x50cccc, 30, 30, 30],
[0xe15a5a, 30, 40, 40],
[0xc8c83c, 30, 30, 10],
[0xe17d00, 30, 30, 0],
[0xcce880, 20, 20, 20],
];
function getColor(p) {
const v = Math.random();
return '#' + (p[0] + ((p[1] * v) << 16 | (p[2] * v) << 8 | (p[3] * v))).toString(16);
}
function f(level, left, width, type, title, inln, c1, int) {
levels[level].push({left: left, width: width, color: getColor(palette[type]), title: title,
details: (int ? ', int=' + int : '') + (c1 ? ', c1=' + c1 : '') + (inln ? ', inln=' + inln : '')
});
}
function samples(n) {
return n === 1 ? '1 sample' : n.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',') + ' samples';
}
function pct(a, b) {
return a >= b ? '100' : (100 * a / b).toFixed(2);
}
function findFrame(frames, x) {
let left = 0;
let right = frames.length - 1;
while (left <= right) {
const mid = (left + right) >>> 1;
const f = frames[mid];
if (f.left > x) {
right = mid - 1;
} else if (f.left + f.width <= x) {
left = mid + 1;
} else {
return f;
}
}
if (frames[left] && (frames[left].left - x) * px < 0.5) return frames[left];
if (frames[right] && (x - (frames[right].left + frames[right].width)) * px < 0.5) return frames[right];
return null;
}
function search(r) {
if (r === true && (r = prompt('Enter regexp to search:', '')) === null) {
return;
}
pattern = r ? RegExp(r) : undefined;
const matched = render(root, rootLevel);
document.getElementById('matchval').textContent = pct(matched, root.width) + '%';
document.getElementById('match').style.display = r ? 'inherit' : 'none';
}
function render(newRoot, newLevel) {
if (root) {
c.fillStyle = '#ffffff';
c.fillRect(0, 0, canvasWidth, canvasHeight);
}
root = newRoot || levels[0][0];
rootLevel = newLevel || 0;
px = canvasWidth / root.width;
const x0 = root.left;
const x1 = x0 + root.width;
const marked = [];
function mark(f) {
return marked[f.left] >= f.width || (marked[f.left] = f.width);
}
function totalMarked() {
let total = 0;
let left = 0;
Object.keys(marked).sort(function(a, b) { return a - b; }).forEach(function(x) {
if (+x >= left) {
total += marked[x];
left = +x + marked[x];
}
});
return total;
}
function drawFrame(f, y, alpha) {
if (f.left < x1 && f.left + f.width > x0) {
c.fillStyle = pattern && f.title.match(pattern) && mark(f) ? '#ee00ee' : f.color;
c.fillRect((f.left - x0) * px, y, f.width * px, 15);
if (f.width * px >= 21) {
const chars = Math.floor(f.width * px / 7);
const title = f.title.length <= chars ? f.title : f.title.substring(0, chars - 2) + '..';
c.fillStyle = '#000000';
c.fillText(title, Math.max(f.left - x0, 0) * px + 3, y + 12, f.width * px - 6);
}
if (alpha) {
c.fillStyle = 'rgba(255, 255, 255, 0.5)';
c.fillRect((f.left - x0) * px, y, f.width * px, 15);
}
}
}
for (let h = 0; h < levels.length; h++) {
const y = reverse ? h * 16 : canvasHeight - (h + 1) * 16;
const frames = levels[h];
for (let i = 0; i < frames.length; i++) {
drawFrame(frames[i], y, h < rootLevel);
}
}
return totalMarked();
}
canvas.onmousemove = function() {
const h = Math.floor((reverse ? event.offsetY : (canvasHeight - event.offsetY)) / 16);
if (h >= 0 && h < levels.length) {
const f = findFrame(levels[h], event.offsetX / px + root.left);
if (f) {
if (f != root) getSelection().removeAllRanges();
hl.style.left = (Math.max(f.left - root.left, 0) * px + canvas.offsetLeft) + 'px';
hl.style.width = (Math.min(f.width, root.width) * px) + 'px';
hl.style.top = ((reverse ? h * 16 : canvasHeight - (h + 1) * 16) + canvas.offsetTop) + 'px';
hl.firstChild.textContent = f.title;
hl.style.display = 'block';
canvas.title = f.title + '\n(' + samples(f.width) + f.details + ', ' + pct(f.width, levels[0][0].width) + '%)';
canvas.style.cursor = 'pointer';
canvas.onclick = function() {
if (f != root) {
render(f, h);
canvas.onmousemove();
}
};
status.textContent = 'Function: ' + canvas.title;
return;
}
}
canvas.onmouseout();
}
canvas.onmouseout = function() {
hl.style.display = 'none';
status.textContent = '\xa0';
canvas.title = '';
canvas.style.cursor = '';
canvas.onclick = '';
}
canvas.ondblclick = function() {
getSelection().selectAllChildren(hl);
}
document.getElementById('reverse').onclick = function() {
reverse = !reverse;
render();
}
document.getElementById('search').onclick = function() {
search(true);
}
document.getElementById('reset').onclick = function() {
search(false);
}
window.onkeydown = function() {
if (event.ctrlKey && event.keyCode === 70) {
event.preventDefault();
search(true);
} else if (event.keyCode === 27) {
search(false);
}
}
f(0,0,3881,3,'all')
f(1,0,3880,1,'java/lang/Thread.run')
f(2,0,3880,1,'java/util/concurrent/ThreadPoolExecutor$Worker.run')
f(3,0,3880,1,'java/util/concurrent/ThreadPoolExecutor.runWorker')
f(4,0,287,1,'java/util/concurrent/FutureTask.run')
f(5,0,287,1,'java/util/concurrent/Executors$RunnableAdapter.call')
f(6,0,287,1,'java/util/concurrent/FutureTask.run')
f(7,0,287,1,'org/openjdk/jmh/runner/BenchmarkHandler$BenchmarkTask.call')
f(8,0,287,1,'org/openjdk/jmh/runner/BenchmarkHandler$BenchmarkTask.call')
f(9,0,287,1,'java/lang/reflect/Method.invoke')
f(10,0,287,1,'jdk/internal/reflect/DelegatingMethodAccessorImpl.invoke')
f(11,0,287,1,'jdk/internal/reflect/NativeMethodAccessorImpl.invoke')
f(12,0,287,1,'jdk/internal/reflect/NativeMethodAccessorImpl.invoke0')
f(13,0,287,1,'kyo/bench/jmh_generated/DeepBindBench_forkKyo_jmhTest.forkKyo_Throughput')
f(14,0,287,1,'kyo/bench/jmh_generated/DeepBindBench_forkKyo_jmhTest.forkKyo_thrpt_jmhStub')
f(15,0,287,1,'kyo/bench/Bench.forkKyo')
f(16,0,22,1,'java/lang/invoke/Invokers$Holder.linkToTargetMethod')
f(17,0,22,1,'java/lang/invoke/DirectMethodHandle$Holder.newInvokeSpecial')
f(18,0,22,1,'java/lang/invoke/DirectMethodHandle.allocateInstance')
f(19,0,22,2,'kyo.bench.Bench$$Lambda$37+0x0000000800c3e0d0')
f(16,22,18,1,'kyo/bench/Bench.kyo$bench$Bench$$_$_$transformLoop$1')
f(17,22,18,2,'kyo.bench.Bench$$anon$1')
f(16,40,181,1,'kyo/bench/Bench.runLoop$2')
f(17,40,82,1,'kyo/bench/Bench$$anon$1.apply')
f(18,40,7,1,'kyo/bench/Bench.kyo$bench$Bench$$_$_$transformLoop$1')
f(19,40,7,1,'kyo/bench/Bench$$Lambda$39.0x0000000800c82330.apply')
f(20,40,7,1,'kyo/bench/Bench.$anonfun$2')
f(21,40,7,1,'kyo/concurrent/fibers$Fiber.block')
f(22,40,7,2,'kyo.concurrent.fibers$Fiber$$anon$10')
f(18,47,75,1,'kyo/concurrent/fibers$Fibers$$anon$33.apply')
f(19,47,75,1,'kyo/concurrent/fibers$Fibers.kyo$concurrent$fibers$Fibers$$_$transformLoop$2')
f(20,47,75,1,'kyo/concurrent/fibers$Fibers$$Lambda$38.0x0000000800c3f828.apply')
f(21,47,75,1,'kyo/concurrent/fibers$Fibers.$anonfun$4')
f(22,47,8,2,'kyo.concurrent.fibers$Fibers$$anon$32')
f(22,55,49,2,'kyo.concurrent.scheduler.IOTask')
f(22,104,18,1,'kyo/concurrent/fibers$Fiber$.promise')
f(23,104,18,2,'kyo.concurrent.fibers$Fiber')
f(17,122,99,1,'kyo/concurrent/fibers$Fiber$$anon$10.apply')
f(18,122,99,1,'kyo/concurrent/fibers$Fiber$$anon$10.apply')
f(19,122,99,1,'kyo/concurrent/scheduler/IOPromise.block')
f(20,122,99,1,'kyo/concurrent/scheduler/IOPromise.loop$4')
f(21,122,41,1,'java/util/concurrent/locks/AbstractQueuedSynchronizer.acquireSharedInterruptibly')
f(22,122,41,1,'java/util/concurrent/locks/AbstractQueuedSynchronizer.acquire')
f(23,122,17,2,'java.util.concurrent.locks.AbstractQueuedSynchronizer$SharedNode')
f(23,139,24,1,'java/util/concurrent/locks/AbstractQueuedSynchronizer.tryInitializeHead')
f(24,139,24,2,'java.util.concurrent.locks.AbstractQueuedSynchronizer$ExclusiveNode')
f(21,163,26,2,'kyo.concurrent.scheduler.IOPromise$$anon$1')
f(21,189,32,1,'kyo/concurrent/scheduler/IOPromise.loop$5')
f(22,189,32,1,'kyo/concurrent/scheduler/IOPromise$Pending.add')
f(23,189,32,2,'kyo.concurrent.scheduler.IOPromise$Pending$$anon$3')
f(16,221,66,1,'kyo/concurrent/fibers$Fibers.forkFiber')
f(17,221,21,1,'java/lang/invoke/Invokers$Holder.linkToTargetMethod')
f(18,221,21,1,'java/lang/invoke/DirectMethodHandle$Holder.newInvokeSpecial')
f(19,221,21,1,'java/lang/invoke/DirectMethodHandle.allocateInstance')
f(20,221,21,2,'kyo.concurrent.fibers$Fibers$$Lambda$38+0x0000000800c3f828')
f(17,242,24,1,'kyo/concurrent/fibers$Fibers.kyo$concurrent$fibers$Fibers$$_$transformLoop$2')
f(18,242,24,2,'kyo.concurrent.fibers$Fibers$$anon$33')
f(17,266,21,1,'kyo/locals$Locals$.save')
f(18,266,21,2,'kyo.locals$Locals$$anon$3')
f(4,287,3,1,'kyo/concurrent/scheduler/Coordinator$$$Lambda$49.0x0000000800d1baf0.run')
f(5,287,3,1,'kyo/concurrent/scheduler/Coordinator$.$init$$$anonfun$1')
f(6,287,3,1,'kyo/concurrent/scheduler/Coordinator$.update')
f(7,287,3,1,'java/util/concurrent/ThreadPoolExecutor.execute')
f(8,287,3,1,'java/util/concurrent/SynchronousQueue.offer')
f(9,287,3,1,'java/util/concurrent/SynchronousQueue$TransferStack.transfer')
f(10,287,3,1,'java/util/concurrent/SynchronousQueue$TransferStack.snode')
f(11,287,3,2,'java.util.concurrent.SynchronousQueue$TransferStack$SNode')
f(4,290,3,1,'kyo/concurrent/scheduler/Coordinator$$$Lambda$50.0x0000000800d1bd18.run')
f(5,290,3,1,'kyo/concurrent/scheduler/Coordinator$.$init$$$anonfun$2')
f(6,290,3,1,'kyo/concurrent/scheduler/Scheduler$.cycle')
f(7,290,3,1,'java/lang/invoke/Invokers$Holder.linkToTargetMethod')
f(8,290,3,1,'java/lang/invoke/DirectMethodHandle$Holder.newInvokeSpecial')
f(9,290,3,1,'java/lang/invoke/DirectMethodHandle.allocateInstance')
f(10,290,3,1,'jdk/internal/misc/Unsafe.allocateInstance')
f(11,290,3,2,'kyo.concurrent.scheduler.Scheduler$$$Lambda$59+0x0000000800d4c2c0')
f(4,293,3587,1,'kyo/concurrent/scheduler/Scheduler$$$Lambda$52.0x0000000800d22ac0.run')
f(5,293,3587,1,'kyo/concurrent/scheduler/Scheduler$.startWorkers$$anonfun$1')
f(6,293,3587,1,'kyo/concurrent/scheduler/Worker.runWorker')
f(7,293,3579,1,'kyo/concurrent/scheduler/IOTask.run')
f(8,293,3579,1,'kyo/concurrent/scheduler/IOTask.eval')
f(9,293,3559,1,'kyo/bench/DeepBindBench$$anon$1.apply')
f(10,293,3559,1,'kyo/bench/DeepBindBench$$anon$1.apply')
f(11,293,3559,1,'kyo/bench/DeepBindBench.kyo$bench$DeepBindBench$$_$loop$1')
f(12,293,3559,2,'kyo.bench.DeepBindBench$$anon$1')
f(9,3852,20,1,'kyo/concurrent/fibers$Fibers$$anon$32.apply')
f(10,3852,20,1,'kyo/concurrent/fibers$Fibers$$anon$32.apply')
f(11,3852,20,1,'kyo/bench/Bench$$Lambda$37.0x0000000800c3e0d0.apply')
f(12,3852,20,1,'kyo/bench/Bench.$anonfun$1')
f(13,3852,20,1,'kyo/bench/Bench.kyoBenchFiber')
f(14,3852,20,1,'kyo/bench/DeepBindBench.kyoBench')
f(15,3852,20,1,'kyo/bench/DeepBindBench.kyo$bench$DeepBindBench$$_$loop$1')
f(16,3852,20,2,'kyo.bench.DeepBindBench$$anon$1')
f(7,3872,8,1,'kyo/concurrent/scheduler/Queue.poll')
f(8,3872,8,1,'java/lang/invoke/Invokers$Holder.linkToTargetMethod')
f(9,3872,8,1,'java/lang/invoke/DirectMethodHandle$Holder.newInvokeSpecial')
f(10,3872,8,1,'java/lang/invoke/DirectMethodHandle.allocateInstance')
f(11,3872,8,1,'jdk/internal/misc/Unsafe.allocateInstance')
f(12,3872,8,2,'kyo.concurrent.scheduler.Queue$$Lambda$55+0x0000000800d46c78')
f(1,3880,1,1,'org/openjdk/jmh/runner/ForkedMain.main')
f(2,3880,1,1,'org/openjdk/jmh/runner/ForkedRunner.run')
f(3,3880,1,1,'org/openjdk/jmh/runner/BaseRunner.runBenchmarksForked')
f(4,3880,1,1,'org/openjdk/jmh/runner/BaseRunner.doSingle')
f(5,3880,1,1,'org/openjdk/jmh/runner/BaseRunner.runBenchmark')
f(6,3880,1,1,'org/openjdk/jmh/runner/BaseRunner.runBenchmark')
f(7,3880,1,1,'org/openjdk/jmh/runner/BenchmarkHandler.runIteration')
f(8,3880,1,1,'org/openjdk/jmh/runner/InfraControl.awaitWarmdownReady')
f(9,3880,1,1,'org/openjdk/jmh/runner/InfraControlL2.awaitWarmdownReady')
f(10,3880,1,1,'java/util/concurrent/CountDownLatch.await')
f(11,3880,1,1,'java/util/concurrent/locks/AbstractQueuedSynchronizer.acquireSharedInterruptibly')
f(12,3880,1,1,'java/util/concurrent/locks/AbstractQueuedSynchronizer.acquire')
f(13,3880,1,2,'java.util.concurrent.locks.AbstractQueuedSynchronizer$SharedNode')
search();
</script></body></html>
<!DOCTYPE html>
<html lang='en'>
<head>
<meta charset='utf-8'>
<style>
body {margin: 0; padding: 10px; background-color: #ffffff}
h1 {margin: 5px 0 0 0; font-size: 18px; font-weight: normal; text-align: center}
header {margin: -24px 0 5px 0; line-height: 24px}
button {font: 12px sans-serif; cursor: pointer}
p {margin: 5px 0 5px 0}
a {color: #0366d6}
#hl {position: absolute; display: none; overflow: hidden; white-space: nowrap; pointer-events: none; background-color: #ffffe0; outline: 1px solid #ffc000; height: 15px}
#hl span {padding: 0 3px 0 3px}
#status {overflow: hidden; white-space: nowrap}
#match {overflow: hidden; white-space: nowrap; display: none; float: right; text-align: right}
#reset {cursor: pointer}
#canvas {width: 100%; height: 1488px}
</style>
</head>
<body style='font: 12px Verdana, sans-serif'>
<h1>CPU profile</h1>
<header style='text-align: left'><button id='reverse' title='Reverse'>&#x1f53b;</button>&nbsp;&nbsp;<button id='search' title='Search'>&#x1f50d;</button></header>
<header style='text-align: right'>Produced by <a href='https://github.com/jvm-profiling-tools/async-profiler'>async-profiler</a></header>
<canvas id='canvas'></canvas>
<div id='hl'><span></span></div>
<p id='match'>Matched: <span id='matchval'></span> <span id='reset' title='Clear'>&#x274c;</span></p>
<p id='status'>&nbsp;</p>
<script>
// Copyright 2020 Andrei Pangin
// Licensed under the Apache License, Version 2.0.
'use strict';
var root, rootLevel, px, pattern;
var reverse = false;
const levels = Array(93);
for (let h = 0; h < levels.length; h++) {
levels[h] = [];
}
const canvas = document.getElementById('canvas');
const c = canvas.getContext('2d');
const hl = document.getElementById('hl');
const status = document.getElementById('status');
const canvasWidth = canvas.offsetWidth;
const canvasHeight = canvas.offsetHeight;
canvas.style.width = canvasWidth + 'px';
canvas.width = canvasWidth * (devicePixelRatio || 1);
canvas.height = canvasHeight * (devicePixelRatio || 1);
if (devicePixelRatio) c.scale(devicePixelRatio, devicePixelRatio);
c.font = document.body.style.font;
const palette = [
[0xb2e1b2, 20, 20, 20],
[0x50e150, 30, 30, 30],
[0x50cccc, 30, 30, 30],
[0xe15a5a, 30, 40, 40],
[0xc8c83c, 30, 30, 10],
[0xe17d00, 30, 30, 0],
[0xcce880, 20, 20, 20],
];
function getColor(p) {
const v = Math.random();
return '#' + (p[0] + ((p[1] * v) << 16 | (p[2] * v) << 8 | (p[3] * v))).toString(16);
}
function f(level, left, width, type, title, inln, c1, int) {
levels[level].push({left: left, width: width, color: getColor(palette[type]), title: title,
details: (int ? ', int=' + int : '') + (c1 ? ', c1=' + c1 : '') + (inln ? ', inln=' + inln : '')
});
}
function samples(n) {
return n === 1 ? '1 sample' : n.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',') + ' samples';
}
function pct(a, b) {
return a >= b ? '100' : (100 * a / b).toFixed(2);
}
function findFrame(frames, x) {
let left = 0;
let right = frames.length - 1;
while (left <= right) {
const mid = (left + right) >>> 1;
const f = frames[mid];
if (f.left > x) {
right = mid - 1;
} else if (f.left + f.width <= x) {
left = mid + 1;
} else {
return f;
}
}
if (frames[left] && (frames[left].left - x) * px < 0.5) return frames[left];
if (frames[right] && (x - (frames[right].left + frames[right].width)) * px < 0.5) return frames[right];
return null;
}
function search(r) {
if (r === true && (r = prompt('Enter regexp to search:', '')) === null) {
return;
}
pattern = r ? RegExp(r) : undefined;
const matched = render(root, rootLevel);
document.getElementById('matchval').textContent = pct(matched, root.width) + '%';
document.getElementById('match').style.display = r ? 'inherit' : 'none';
}
function render(newRoot, newLevel) {
if (root) {
c.fillStyle = '#ffffff';
c.fillRect(0, 0, canvasWidth, canvasHeight);
}
root = newRoot || levels[0][0];
rootLevel = newLevel || 0;
px = canvasWidth / root.width;
const x0 = root.left;
const x1 = x0 + root.width;
const marked = [];
function mark(f) {
return marked[f.left] >= f.width || (marked[f.left] = f.width);
}
function totalMarked() {
let total = 0;
let left = 0;
Object.keys(marked).sort(function(a, b) { return a - b; }).forEach(function(x) {
if (+x >= left) {
total += marked[x];
left = +x + marked[x];
}
});
return total;
}
function drawFrame(f, y, alpha) {
if (f.left < x1 && f.left + f.width > x0) {
c.fillStyle = pattern && f.title.match(pattern) && mark(f) ? '#ee00ee' : f.color;
c.fillRect((f.left - x0) * px, y, f.width * px, 15);
if (f.width * px >= 21) {
const chars = Math.floor(f.width * px / 7);
const title = f.title.length <= chars ? f.title : f.title.substring(0, chars - 2) + '..';
c.fillStyle = '#000000';
c.fillText(title, Math.max(f.left - x0, 0) * px + 3, y + 12, f.width * px - 6);
}
if (alpha) {
c.fillStyle = 'rgba(255, 255, 255, 0.5)';
c.fillRect((f.left - x0) * px, y, f.width * px, 15);
}
}
}
for (let h = 0; h < levels.length; h++) {
const y = reverse ? h * 16 : canvasHeight - (h + 1) * 16;
const frames = levels[h];
for (let i = 0; i < frames.length; i++) {
drawFrame(frames[i], y, h < rootLevel);
}
}
return totalMarked();
}
canvas.onmousemove = function() {
const h = Math.floor((reverse ? event.offsetY : (canvasHeight - event.offsetY)) / 16);
if (h >= 0 && h < levels.length) {
const f = findFrame(levels[h], event.offsetX / px + root.left);
if (f) {
if (f != root) getSelection().removeAllRanges();
hl.style.left = (Math.max(f.left - root.left, 0) * px + canvas.offsetLeft) + 'px';
hl.style.width = (Math.min(f.width, root.width) * px) + 'px';
hl.style.top = ((reverse ? h * 16 : canvasHeight - (h + 1) * 16) + canvas.offsetTop) + 'px';
hl.firstChild.textContent = f.title;
hl.style.display = 'block';
canvas.title = f.title + '\n(' + samples(f.width) + f.details + ', ' + pct(f.width, levels[0][0].width) + '%)';
canvas.style.cursor = 'pointer';
canvas.onclick = function() {
if (f != root) {
render(f, h);
canvas.onmousemove();
}
};
status.textContent = 'Function: ' + canvas.title;
return;
}
}
canvas.onmouseout();
}
canvas.onmouseout = function() {
hl.style.display = 'none';
status.textContent = '\xa0';
canvas.title = '';
canvas.style.cursor = '';
canvas.onclick = '';
}
canvas.ondblclick = function() {
getSelection().selectAllChildren(hl);
}
document.getElementById('reverse').onclick = function() {
reverse = !reverse;
render();
}
document.getElementById('search').onclick = function() {
search(true);
}
document.getElementById('reset').onclick = function() {
search(false);
}
window.onkeydown = function() {
if (event.ctrlKey && event.keyCode === 70) {
event.preventDefault();
search(true);
} else if (event.keyCode === 27) {
search(false);
}
}
f(0,0,90,3,'all')
f(1,0,6,3,'/usr/lib/x86_64-linux-gnu/libc.so.6')
f(2,0,6,3,'thread_native_entry(Thread*)')
f(3,0,6,4,'Thread::call_run()')
f(4,0,6,4,'JavaThread::thread_main_inner()')
f(5,0,6,4,'CompileBroker::compiler_thread_loop()')
f(6,0,6,4,'CompileBroker::invoke_compiler_on_method(CompileTask*)')
f(7,0,6,4,'C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)')
f(8,0,6,4,'Compile::Compile(ciEnv*, ciMethod*, int, bool, bool, bool, bool, bool, DirectiveSet*)')
f(9,0,3,4,'Compile::Code_Gen()')
f(10,0,2,4,'Matcher::match()')
f(11,0,2,4,'Matcher::xform(Node*, int)')
f(12,0,1,4,'IfNode::Opcode() const')
f(12,1,1,4,'Matcher::match_tree(Node const*)')
f(13,1,1,4,'Matcher::ReduceInst(State*, int, Node*&)')
f(14,1,1,4,'Matcher::ReduceInst_Interior(State*, int, Node*&, MachNode*, unsigned int)')
f(15,1,1,4,'Matcher::ReduceInst(State*, int, Node*&)')
f(16,1,1,4,'Matcher::ReduceInst_Interior(State*, int, Node*&, MachNode*, unsigned int)')
f(17,1,1,4,'Node::add_req(Node*)')
f(10,2,1,4,'PhaseOutput::fill_buffer(CodeBuffer*, unsigned int*)')
f(11,2,1,4,'storeImmCM0_regNode::emit(CodeBuffer&, PhaseRegAlloc*) const')
f(12,2,1,4,'Assembler::movb(Address, RegisterImpl*)')
f(13,2,1,4,'Assembler::prefix(Address, RegisterImpl*, bool)')
f(9,3,2,4,'Compile::Optimize()')
f(10,3,1,4,'Compile::final_graph_reshaping() [clone .part.0]')
f(11,3,1,4,'Compile::final_graph_reshaping_walk(Node_Stack&, Node*, Final_Reshape_Counts&)')
f(12,3,1,4,'Compile::final_graph_reshaping_main_switch(Node*, Final_Reshape_Counts&, unsigned int)')
f(13,3,1,4,'Node::replace_by(Node*)')
f(10,4,1,4,'PhaseIdealLoop::optimize(PhaseIterGVN&, LoopOptsMode)')
f(11,4,1,4,'PhaseIdealLoop::build_and_optimize(LoopOptsMode)')
f(12,4,1,4,'PhaseIdealLoop::build_loop_tree()')
f(13,4,1,4,'Node::is_CFG() const')
f(9,5,1,4,'ParseGenerator::generate(JVMState*)')
f(10,5,1,4,'Parse::Parse(JVMState*, ciMethod*, float)')
f(11,5,1,4,'Parse::do_all_blocks()')
f(12,5,1,4,'Parse::do_one_block()')
f(13,5,1,4,'Parse::do_call()')
f(14,5,1,4,'PredictedCallGenerator::generate(JVMState*)')
f(15,5,1,4,'PredictedCallGenerator::generate(JVMState*)')
f(16,5,1,4,'ParseGenerator::generate(JVMState*)')
f(17,5,1,4,'Parse::Parse(JVMState*, ciMethod*, float)')
f(18,5,1,4,'Parse::do_all_blocks()')
f(19,5,1,4,'Parse::do_one_block()')
f(20,5,1,4,'Parse::do_call()')
f(21,5,1,4,'PredictedCallGenerator::generate(JVMState*)')
f(22,5,1,4,'ParseGenerator::generate(JVMState*)')
f(23,5,1,4,'Parse::Parse(JVMState*, ciMethod*, float)')
f(24,5,1,4,'Parse::do_all_blocks()')
f(25,5,1,4,'Parse::do_one_block()')
f(26,5,1,4,'Parse::do_call()')
f(27,5,1,4,'PredictedCallGenerator::generate(JVMState*)')
f(28,5,1,4,'ParseGenerator::generate(JVMState*)')
f(29,5,1,4,'Parse::Parse(JVMState*, ciMethod*, float)')
f(30,5,1,4,'Parse::do_all_blocks()')
f(31,5,1,4,'Parse::do_one_block()')
f(32,5,1,4,'Parse::do_call()')
f(33,5,1,4,'PredictedCallGenerator::generate(JVMState*)')
f(34,5,1,4,'ParseGenerator::generate(JVMState*)')
f(35,5,1,4,'Parse::Parse(JVMState*, ciMethod*, float)')
f(36,5,1,4,'Parse::do_all_blocks()')
f(37,5,1,4,'Parse::do_one_block()')
f(38,5,1,4,'Parse::do_call()')
f(39,5,1,4,'PredictedCallGenerator::generate(JVMState*)')
f(40,5,1,4,'ParseGenerator::generate(JVMState*)')
f(41,5,1,4,'Parse::Parse(JVMState*, ciMethod*, float)')
f(42,5,1,4,'Parse::do_all_blocks()')
f(43,5,1,4,'Parse::do_one_block()')
f(44,5,1,4,'Parse::do_call()')
f(45,5,1,4,'PredictedCallGenerator::generate(JVMState*)')
f(46,5,1,4,'ParseGenerator::generate(JVMState*)')
f(47,5,1,4,'Parse::Parse(JVMState*, ciMethod*, float)')
f(48,5,1,4,'Parse::do_all_blocks()')
f(49,5,1,4,'Parse::do_one_block()')
f(50,5,1,4,'Parse::do_call()')
f(51,5,1,4,'ParseGenerator::generate(JVMState*)')
f(52,5,1,4,'Parse::Parse(JVMState*, ciMethod*, float)')
f(53,5,1,4,'Parse::do_all_blocks()')
f(54,5,1,4,'Parse::do_one_block()')
f(55,5,1,4,'Parse::do_call()')
f(56,5,1,4,'PredictedCallGenerator::generate(JVMState*)')
f(57,5,1,4,'PredictedCallGenerator::generate(JVMState*)')
f(58,5,1,4,'ParseGenerator::generate(JVMState*)')
f(59,5,1,4,'Parse::Parse(JVMState*, ciMethod*, float)')
f(60,5,1,4,'Parse::do_all_blocks()')
f(61,5,1,4,'Parse::do_one_block()')
f(62,5,1,4,'Parse::do_call()')
f(63,5,1,4,'PredictedCallGenerator::generate(JVMState*)')
f(64,5,1,4,'ParseGenerator::generate(JVMState*)')
f(65,5,1,4,'Parse::Parse(JVMState*, ciMethod*, float)')
f(66,5,1,4,'Parse::do_all_blocks()')
f(67,5,1,4,'Parse::do_one_block()')
f(68,5,1,4,'Parse::do_call()')
f(69,5,1,4,'PredictedCallGenerator::generate(JVMState*)')
f(70,5,1,4,'ParseGenerator::generate(JVMState*)')
f(71,5,1,4,'Parse::Parse(JVMState*, ciMethod*, float)')
f(72,5,1,4,'Parse::do_all_blocks()')
f(73,5,1,4,'Parse::do_one_block()')
f(74,5,1,4,'Parse::do_call()')
f(75,5,1,4,'PredictedCallGenerator::generate(JVMState*)')
f(76,5,1,4,'ParseGenerator::generate(JVMState*)')
f(77,5,1,4,'Parse::Parse(JVMState*, ciMethod*, float)')
f(78,5,1,4,'Parse::do_all_blocks()')
f(79,5,1,4,'Parse::do_one_block()')
f(80,5,1,4,'Parse::do_call()')
f(81,5,1,4,'Compile::call_generator(ciMethod*, int, bool, JVMState*, bool, float, ciKlass*, bool)')
f(82,5,1,4,'InlineTree::ok_to_inline(ciMethod*, JVMState*, ciCallProfile&, bool&)')
f(83,5,1,4,'ciMethod::get_flow_analysis()')
f(84,5,1,4,'ciTypeFlow::do_flow()')
f(85,5,1,4,'ciTypeFlow::flow_types()')
f(86,5,1,4,'ciTypeFlow::df_flow_types(ciTypeFlow::Block*, bool, ciTypeFlow::StateVector*, ciTypeFlow::JsrSet*)')
f(87,5,1,4,'ciTypeFlow::flow_block(ciTypeFlow::Block*, ciTypeFlow::StateVector*, ciTypeFlow::JsrSet*)')
f(88,5,1,4,'ciTypeFlow::StateVector::apply_one_bytecode(ciBytecodeStream*)')
f(89,5,1,4,'ciTypeFlow::StateVector::do_invoke(ciBytecodeStream*, bool)')
f(90,5,1,4,'ciBytecodeStream::get_method(bool&, ciSignature**)')
f(91,5,1,4,'ciEnv::get_method_by_index(constantPoolHandle const&, int, Bytecodes::Code, ciInstanceKlass*)')
f(92,5,1,3,'/usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2')
f(1,6,2,3,'[unknown]')
f(2,6,1,3,'/usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2')
f(2,7,1,3,'__open')
f(3,7,1,5,'entry_SYSCALL_64_after_hwframe')
f(4,7,1,5,'do_syscall_64')
f(5,7,1,5,'__x64_sys_openat')
f(6,7,1,5,'do_sys_openat2')
f(7,7,1,5,'do_filp_open')
f(8,7,1,5,'path_openat')
f(9,7,1,5,'link_path_walk.part.0.constprop.0')
f(10,7,1,5,'walk_component')
f(11,7,1,5,'kernfs_dop_revalidate')
f(1,8,82,1,'java/lang/Thread.run')
f(2,8,82,1,'java/util/concurrent/ThreadPoolExecutor$Worker.run')
f(3,8,82,1,'java/util/concurrent/ThreadPoolExecutor.runWorker')
f(4,8,10,1,'java/util/concurrent/FutureTask.run')
f(5,8,10,1,'java/util/concurrent/Executors$RunnableAdapter.call')
f(6,8,10,1,'java/util/concurrent/FutureTask.run')
f(7,8,10,1,'org/openjdk/jmh/runner/BenchmarkHandler$BenchmarkTask.call')
f(8,8,10,1,'org/openjdk/jmh/runner/BenchmarkHandler$BenchmarkTask.call')
f(9,8,10,1,'java/lang/reflect/Method.invoke')
f(10,8,10,1,'jdk/internal/reflect/DelegatingMethodAccessorImpl.invoke')
f(11,8,10,1,'jdk/internal/reflect/NativeMethodAccessorImpl.invoke')
f(12,8,10,1,'jdk/internal/reflect/NativeMethodAccessorImpl.invoke0')
f(13,8,10,1,'kyo/bench/jmh_generated/DeepBindBench_forkKyo_jmhTest.forkKyo_Throughput')
f(14,8,10,1,'kyo/bench/jmh_generated/DeepBindBench_forkKyo_jmhTest.forkKyo_thrpt_jmhStub',0,0,1)
f(15,9,9,1,'kyo/bench/Bench.forkKyo')
f(16,9,9,1,'kyo/bench/Bench.runLoop$2')
f(17,9,5,1,'kyo/bench/Bench$$anon$1.apply')
f(18,9,5,1,'kyo/concurrent/fibers$Fibers$$anon$33.apply')
f(19,9,5,1,'kyo/concurrent/fibers$Fibers.kyo$concurrent$fibers$Fibers$$_$transformLoop$2')
f(20,9,5,1,'kyo/concurrent/fibers$Fibers$$Lambda$38.0x0000000800c3f828.apply')
f(21,9,5,1,'kyo/concurrent/fibers$Fibers.$anonfun$4')
f(22,9,5,1,'kyo/concurrent/scheduler/Scheduler$.schedule')
f(23,9,5,1,'kyo/concurrent/scheduler/Scheduler$.submit')
f(24,9,5,1,'kyo/concurrent/scheduler/Worker.enqueue')
f(25,9,5,1,'java/util/concurrent/locks/LockSupport.unpark')
f(26,9,5,1,'jdk/internal/misc/Unsafe.unpark')
f(27,9,5,3,'pthread_cond_signal')
f(28,9,5,5,'entry_SYSCALL_64_after_hwframe')
f(29,9,5,5,'do_syscall_64')
f(30,9,5,5,'__x64_sys_futex')
f(31,9,5,5,'do_futex')
f(32,9,5,5,'futex_wake')
f(33,9,5,5,'wake_up_q')
f(34,9,5,5,'_raw_spin_unlock_irqrestore')
f(17,14,4,1,'kyo/concurrent/fibers$Fiber$$anon$10.apply')
f(18,14,4,1,'kyo/concurrent/fibers$Fiber$$anon$10.apply')
f(19,14,4,1,'kyo/concurrent/scheduler/IOPromise.block')
f(20,14,4,1,'kyo/concurrent/scheduler/IOPromise.loop$4')
f(21,14,4,1,'java/util/concurrent/locks/AbstractQueuedSynchronizer.acquireSharedInterruptibly')
f(22,14,4,1,'java/util/concurrent/locks/AbstractQueuedSynchronizer.acquire')
f(23,14,4,1,'java/util/concurrent/locks/LockSupport.park')
f(24,14,4,1,'jdk/internal/misc/Unsafe.park')
f(25,14,4,3,'[unknown]')
f(26,14,3,3,'/usr/lib/x86_64-linux-gnu/libc.so.6')
f(27,14,3,5,'entry_SYSCALL_64_after_hwframe')
f(28,14,3,5,'do_syscall_64')
f(29,14,3,5,'__x64_sys_futex')
f(30,14,3,5,'do_futex')
f(31,14,3,5,'futex_wait')
f(32,14,2,5,'futex_wait_queue_me')
f(33,14,2,5,'schedule')
f(34,14,2,5,'__schedule')
f(35,14,2,5,'finish_task_switch.isra.0')
f(32,16,1,5,'futex_wait_setup')
f(26,17,1,3,'pthread_cond_wait')
f(4,18,72,1,'kyo/concurrent/scheduler/Scheduler$$$Lambda$52.0x0000000800d22ac0.run')
f(5,18,72,1,'kyo/concurrent/scheduler/Scheduler$.startWorkers$$anonfun$1')
f(6,18,72,1,'kyo/concurrent/scheduler/Worker.runWorker',0,0,1)
f(7,19,65,1,'kyo/concurrent/scheduler/IOTask.run')
f(8,19,65,2,'kyo/concurrent/scheduler/IOTask.eval',58,0,0)
f(9,70,7,2,'kyo/bench/DeepBindBench$$anon$1.apply',7,0,0)
f(10,70,7,2,'kyo/bench/DeepBindBench$$anon$1.apply',7,0,0)
f(11,71,6,2,'kyo/bench/DeepBindBench.kyo$bench$DeepBindBench$$_$loop$1',6,0,0)
f(9,77,7,1,'kyo/concurrent/scheduler/IOTask.loop$8')
f(10,77,7,1,'kyo/concurrent/scheduler/IOPromise.kyo$concurrent$scheduler$IOPromise$$inline$complete')
f(11,77,7,1,'kyo/concurrent/scheduler/IOPromise.complete')
f(12,77,7,1,'kyo/concurrent/scheduler/IOPromise$Pending.flush')
f(13,77,7,1,'kyo/concurrent/scheduler/IOPromise$Pending.loop$7')
f(14,77,7,1,'kyo/concurrent/scheduler/IOPromise$Pending$$anon$3.run')
f(15,77,7,1,'kyo/concurrent/scheduler/IOPromise$$anon$1.apply')
f(16,77,7,1,'kyo/concurrent/scheduler/IOPromise$$anon$1.apply')
f(17,77,7,1,'java/util/concurrent/locks/AbstractQueuedSynchronizer.releaseShared')
f(18,77,7,1,'java/util/concurrent/locks/AbstractQueuedSynchronizer.signalNext')
f(19,77,7,1,'java/util/concurrent/locks/LockSupport.unpark')
f(20,77,7,1,'jdk/internal/misc/Unsafe.unpark')
f(21,77,2,3,'Unsafe_Unpark')
f(22,78,1,3,'pthread_mutex_lock')
f(21,79,5,3,'pthread_cond_signal')
f(22,79,5,5,'entry_SYSCALL_64_after_hwframe')
f(23,79,5,5,'do_syscall_64')
f(24,79,5,5,'__x64_sys_futex')
f(25,79,5,5,'do_futex')
f(26,79,5,5,'futex_wake')
f(27,79,5,5,'wake_up_q')
f(28,79,5,5,'_raw_spin_unlock_irqrestore')
f(7,84,6,1,'kyo/concurrent/scheduler/Scheduler$.idle')
f(8,84,6,1,'kyo/concurrent/scheduler/Worker.park')
f(9,84,6,1,'java/util/concurrent/locks/LockSupport.parkNanos')
f(10,84,6,1,'jdk/internal/misc/Unsafe.park')
f(11,84,2,3,'Unsafe_Park')
f(12,85,1,4,'Parker::park(bool, long)')
f(13,85,1,4,'HandshakeState::has_a_non_suspend_operation()')
f(14,85,1,3,'__tls_get_addr')
f(11,86,4,3,'[unknown]')
f(12,86,4,3,'/usr/lib/x86_64-linux-gnu/libc.so.6')
f(13,87,3,5,'entry_SYSCALL_64_after_hwframe')
f(14,87,3,5,'do_syscall_64')
f(15,87,3,5,'__x64_sys_futex')
f(16,88,2,5,'do_futex')
f(17,88,2,5,'futex_wait')
f(18,88,1,5,'futex_wait_queue_me')
f(19,88,1,5,'schedule')
f(20,88,1,5,'__schedule')
f(21,88,1,5,'finish_task_switch.isra.0')
f(18,89,1,5,'futex_wait_setup')
search();
</script></body></html>
<html><body>
<a href='https://jmh.morethan.io/?source=output/jmh-result.json'><h2>Results</h2></a><br>
<h2>Flamegraphs:</h2>
<a href='output/index.html'>index.html</a><br>
<a href='output/DeepBindBench-alloc.html'>DeepBindBench-alloc.html</a><br>
<a href='output/DeepBindBench-cpu.html'>DeepBindBench-cpu.html</a><br>
</body></html>
[
{
"jmhVersion" : "1.36",
"benchmark" : "kyo.bench.DeepBindBench.forkKyo",
"mode" : "thrpt",
"threads" : 1,
"forks" : 1,
"jvm" : "/home/runner/.jabba/jdk/openjdk@1.17.0/bin/java",
"jvmArgs" : [
"-Dcats.effect.tracing.mode=DISABLED"
],
"jdkVersion" : "17",
"vmName" : "OpenJDK 64-Bit Server VM",
"vmVersion" : "17+35-2724",
"warmupIterations" : 1,
"warmupTime" : "1 s",
"warmupBatchSize" : 1,
"measurementIterations" : 1,
"measurementTime" : "1 s",
"measurementBatchSize" : 1,
"primaryMetric" : {
"score" : 19422.996233632468,
"scoreError" : "NaN",
"scoreConfidence" : [
"NaN",
"NaN"
],
"scorePercentiles" : {
"0.0" : 19422.996233632468,
"50.0" : 19422.996233632468,
"90.0" : 19422.996233632468,
"95.0" : 19422.996233632468,
"99.0" : 19422.996233632468,
"99.9" : 19422.996233632468,
"99.99" : 19422.996233632468,
"99.999" : 19422.996233632468,
"99.9999" : 19422.996233632468,
"100.0" : 19422.996233632468
},
"scoreUnit" : "ops/s",
"rawData" : [
[
19422.996233632468
]
]
},
"secondaryMetrics" : {
}
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment