Skip to content

Instantly share code, notes, and snippets.

@fwbrasil
Created June 11, 2023 20:53
Show Gist options
  • Save fwbrasil/e03844b89aaa193d2de0ae175ec8d32f to your computer and use it in GitHub Desktop.
Save fwbrasil/e03844b89aaa193d2de0ae175ec8d32f 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,28512,3,'all')
f(1,0,28506,1,'java/lang/Thread.run')
f(2,0,28506,1,'java/util/concurrent/ThreadPoolExecutor$Worker.run')
f(3,0,28506,1,'java/util/concurrent/ThreadPoolExecutor.runWorker')
f(4,0,4989,1,'java/util/concurrent/FutureTask.run')
f(5,0,4989,1,'java/util/concurrent/Executors$RunnableAdapter.call')
f(6,0,4989,1,'java/util/concurrent/FutureTask.run')
f(7,0,4989,1,'org/openjdk/jmh/runner/BenchmarkHandler$BenchmarkTask.call')
f(8,0,4989,1,'org/openjdk/jmh/runner/BenchmarkHandler$BenchmarkTask.call')
f(9,0,4989,1,'java/lang/reflect/Method.invoke')
f(10,0,4989,1,'jdk/internal/reflect/DelegatingMethodAccessorImpl.invoke')
f(11,0,4989,1,'jdk/internal/reflect/NativeMethodAccessorImpl.invoke')
f(12,0,4989,1,'jdk/internal/reflect/NativeMethodAccessorImpl.invoke0')
f(13,0,4989,1,'kyo/bench/jmh_generated/DeepBindBench_forkKyo_jmhTest.forkKyo_Throughput')
f(14,0,4988,1,'kyo/bench/jmh_generated/DeepBindBench_forkKyo_jmhTest.forkKyo_thrpt_jmhStub')
f(15,0,4988,1,'kyo/bench/Bench.forkKyo')
f(16,0,343,1,'java/lang/invoke/Invokers$Holder.linkToTargetMethod')
f(17,0,343,1,'java/lang/invoke/DirectMethodHandle$Holder.newInvokeSpecial')
f(18,0,343,1,'java/lang/invoke/DirectMethodHandle.allocateInstance')
f(19,0,343,2,'kyo.bench.Bench$$Lambda$37+0x0000000800c3e0d0')
f(16,343,631,1,'kyo/bench/Bench.kyo$bench$Bench$$_$_$transformLoop$1')
f(17,343,631,2,'kyo.bench.Bench$$anon$1')
f(16,974,3356,1,'kyo/bench/Bench.runLoop$2')
f(17,974,1185,1,'kyo/bench/Bench$$anon$1.apply')
f(18,974,161,1,'kyo/bench/Bench.kyo$bench$Bench$$_$_$transformLoop$1')
f(19,974,161,1,'kyo/bench/Bench$$Lambda$39.0x0000000800c82330.apply')
f(20,974,161,1,'kyo/bench/Bench.$anonfun$2')
f(21,974,161,1,'kyo/concurrent/fibers$Fiber.block')
f(22,974,161,2,'kyo.concurrent.fibers$Fiber$$anon$10')
f(18,1135,1024,1,'kyo/concurrent/fibers$Fibers$$anon$33.apply')
f(19,1135,1024,1,'kyo/concurrent/fibers$Fibers.kyo$concurrent$fibers$Fibers$$_$transformLoop$2')
f(20,1135,1024,1,'kyo/concurrent/fibers$Fibers$$Lambda$38.0x0000000800c3f828.apply')
f(21,1135,1024,1,'kyo/concurrent/fibers$Fibers.$anonfun$4')
f(22,1135,130,2,'kyo.concurrent.fibers$Fibers$$anon$32')
f(22,1265,774,2,'kyo.concurrent.scheduler.IOTask')
f(22,2039,120,1,'kyo/concurrent/fibers$Fiber$.promise')
f(23,2039,120,2,'kyo.concurrent.fibers$Fiber')
f(17,2159,2171,1,'kyo/concurrent/fibers$Fiber$$anon$10.apply')
f(18,2159,2171,1,'kyo/concurrent/fibers$Fiber$$anon$10.apply')
f(19,2159,2171,1,'kyo/concurrent/scheduler/IOPromise.block')
f(20,2159,2171,1,'kyo/concurrent/scheduler/IOPromise.loop$4')
f(21,2159,894,1,'java/util/concurrent/locks/AbstractQueuedSynchronizer.acquireSharedInterruptibly')
f(22,2159,894,1,'java/util/concurrent/locks/AbstractQueuedSynchronizer.acquire')
f(23,2159,234,2,'java.util.concurrent.locks.AbstractQueuedSynchronizer$SharedNode')
f(23,2393,660,1,'java/util/concurrent/locks/AbstractQueuedSynchronizer.tryInitializeHead')
f(24,2393,660,2,'java.util.concurrent.locks.AbstractQueuedSynchronizer$ExclusiveNode')
f(21,3053,686,2,'kyo.concurrent.scheduler.IOPromise$$anon$1')
f(21,3739,591,1,'kyo/concurrent/scheduler/IOPromise.loop$5')
f(22,3739,591,1,'kyo/concurrent/scheduler/IOPromise$Pending.add')
f(23,3739,591,2,'kyo.concurrent.scheduler.IOPromise$Pending$$anon$3')
f(16,4330,658,1,'kyo/concurrent/fibers$Fibers.forkFiber')
f(17,4330,406,1,'java/lang/invoke/Invokers$Holder.linkToTargetMethod')
f(18,4330,406,1,'java/lang/invoke/DirectMethodHandle$Holder.newInvokeSpecial')
f(19,4330,406,1,'java/lang/invoke/DirectMethodHandle.allocateInstance')
f(20,4330,406,2,'kyo.concurrent.fibers$Fibers$$Lambda$38+0x0000000800c3f828')
f(17,4736,162,1,'kyo/concurrent/fibers$Fibers.kyo$concurrent$fibers$Fibers$$_$transformLoop$2')
f(18,4736,162,2,'kyo.concurrent.fibers$Fibers$$anon$33')
f(17,4898,90,1,'kyo/locals$Locals$.save')
f(18,4898,90,2,'kyo.locals$Locals$$anon$3')
f(14,4988,1,2,'org.openjdk.jmh.results.BenchmarkTaskResult')
f(4,4989,18,1,'kyo/concurrent/scheduler/Coordinator$$$Lambda$49.0x0000000800d1baf0.run')
f(5,4989,18,1,'kyo/concurrent/scheduler/Coordinator$.$init$$$anonfun$1')
f(6,4989,18,1,'kyo/concurrent/scheduler/Coordinator$.update')
f(7,4989,18,1,'java/util/concurrent/ThreadPoolExecutor.execute')
f(8,4989,18,1,'java/util/concurrent/SynchronousQueue.offer')
f(9,4989,18,1,'java/util/concurrent/SynchronousQueue$TransferStack.transfer')
f(10,4989,18,1,'java/util/concurrent/SynchronousQueue$TransferStack.snode')
f(11,4989,18,2,'java.util.concurrent.SynchronousQueue$TransferStack$SNode')
f(4,5007,18,1,'kyo/concurrent/scheduler/Coordinator$$$Lambda$50.0x0000000800d1bd18.run')
f(5,5007,18,1,'kyo/concurrent/scheduler/Coordinator$.$init$$$anonfun$2')
f(6,5007,18,1,'kyo/concurrent/scheduler/Scheduler$.cycle')
f(7,5007,18,1,'java/lang/invoke/Invokers$Holder.linkToTargetMethod')
f(8,5007,18,1,'java/lang/invoke/DirectMethodHandle$Holder.newInvokeSpecial')
f(9,5007,18,1,'java/lang/invoke/DirectMethodHandle.allocateInstance')
f(10,5007,18,1,'jdk/internal/misc/Unsafe.allocateInstance')
f(11,5007,18,2,'kyo.concurrent.scheduler.Scheduler$$$Lambda$58+0x0000000800d4c000')
f(4,5025,23481,1,'kyo/concurrent/scheduler/Scheduler$$$Lambda$52.0x0000000800d22ac0.run')
f(5,5025,23481,1,'kyo/concurrent/scheduler/Scheduler$.startWorkers$$anonfun$1')
f(6,5025,23481,1,'kyo/concurrent/scheduler/Worker.runWorker')
f(7,5025,23475,1,'kyo/concurrent/scheduler/IOTask.run')
f(8,5025,23475,1,'kyo/concurrent/scheduler/IOTask.eval')
f(9,5025,23240,1,'kyo/bench/DeepBindBench$$anon$1.apply')
f(10,5025,23240,1,'kyo/bench/DeepBindBench$$anon$1.apply')
f(11,5025,23240,1,'kyo/bench/DeepBindBench.kyo$bench$DeepBindBench$$_$loop$1')
f(12,5025,23240,2,'kyo.bench.DeepBindBench$$anon$1')
f(9,28265,235,1,'kyo/concurrent/fibers$Fibers$$anon$32.apply')
f(10,28265,235,1,'kyo/concurrent/fibers$Fibers$$anon$32.apply')
f(11,28265,235,1,'kyo/bench/Bench$$Lambda$37.0x0000000800c3e0d0.apply')
f(12,28265,235,1,'kyo/bench/Bench.$anonfun$1')
f(13,28265,235,1,'kyo/bench/Bench.kyoBenchFiber')
f(14,28265,235,1,'kyo/bench/DeepBindBench.kyoBench')
f(15,28265,235,1,'kyo/bench/DeepBindBench.kyo$bench$DeepBindBench$$_$loop$1')
f(16,28265,235,2,'kyo.bench.DeepBindBench$$anon$1')
f(7,28500,6,1,'kyo/concurrent/scheduler/Scheduler$.steal')
f(8,28500,6,1,'kyo/concurrent/scheduler/Worker.steal')
f(9,28500,6,1,'kyo/concurrent/scheduler/Queue.steal')
f(10,28500,6,1,'scala/runtime/ObjectRef.create')
f(11,28500,6,2,'scala.runtime.ObjectRef')
f(1,28506,6,1,'org/openjdk/jmh/runner/ForkedMain.main')
f(2,28506,6,1,'org/openjdk/jmh/runner/ForkedRunner.run')
f(3,28506,6,1,'org/openjdk/jmh/runner/BaseRunner.runBenchmarksForked')
f(4,28506,6,1,'org/openjdk/jmh/runner/BaseRunner.doSingle')
f(5,28506,6,1,'org/openjdk/jmh/runner/BaseRunner.runBenchmark')
f(6,28506,6,1,'org/openjdk/jmh/runner/BaseRunner.runBenchmark')
f(7,28506,6,1,'org/openjdk/jmh/runner/BenchmarkHandler.runIteration')
f(8,28506,1,2,'org.openjdk.jmh.runner.InfraControl')
f(8,28507,5,1,'org/openjdk/jmh/runner/InfraControl.awaitWarmdownReady')
f(9,28507,5,1,'org/openjdk/jmh/runner/InfraControlL2.awaitWarmdownReady')
f(10,28507,5,1,'java/util/concurrent/CountDownLatch.await')
f(11,28507,5,1,'java/util/concurrent/locks/AbstractQueuedSynchronizer.acquireSharedInterruptibly')
f(12,28507,5,1,'java/util/concurrent/locks/AbstractQueuedSynchronizer.acquire')
f(13,28507,5,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: 576px}
</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(36);
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,438,3,'all')
f(1,0,1,3,'[unknown]')
f(2,0,1,3,'/usr/lib/x86_64-linux-gnu/libc.so.6')
f(1,1,437,1,'java/lang/Thread.run')
f(2,1,437,1,'java/util/concurrent/ThreadPoolExecutor$Worker.run')
f(3,1,437,1,'java/util/concurrent/ThreadPoolExecutor.runWorker')
f(4,1,42,1,'java/util/concurrent/FutureTask.run')
f(5,1,42,1,'java/util/concurrent/Executors$RunnableAdapter.call')
f(6,1,42,1,'java/util/concurrent/FutureTask.run')
f(7,1,42,1,'org/openjdk/jmh/runner/BenchmarkHandler$BenchmarkTask.call')
f(8,1,42,1,'org/openjdk/jmh/runner/BenchmarkHandler$BenchmarkTask.call')
f(9,1,42,1,'java/lang/reflect/Method.invoke')
f(10,1,42,1,'jdk/internal/reflect/DelegatingMethodAccessorImpl.invoke')
f(11,1,42,1,'jdk/internal/reflect/NativeMethodAccessorImpl.invoke')
f(12,1,42,1,'jdk/internal/reflect/NativeMethodAccessorImpl.invoke0')
f(13,1,42,1,'kyo/bench/jmh_generated/DeepBindBench_forkKyo_jmhTest.forkKyo_Throughput')
f(14,1,42,1,'kyo/bench/jmh_generated/DeepBindBench_forkKyo_jmhTest.forkKyo_thrpt_jmhStub')
f(15,1,42,1,'kyo/bench/Bench.forkKyo',1,0,0)
f(16,1,1,2,'kyo/bench/Bench.kyo$bench$Bench$$_$_$transformLoop$1',1,0,0)
f(17,1,1,2,'kyo/bench/Bench$$anon$1.<init>',1,0,0)
f(18,1,1,2,'kyo/core$internal$KyoCont.<init>',1,0,0)
f(16,2,41,1,'kyo/bench/Bench.runLoop$2')
f(17,2,18,1,'kyo/bench/Bench$$anon$1.apply')
f(18,2,1,1,'kyo/bench/Bench.kyo$bench$Bench$$_$_$transformLoop$1')
f(19,2,1,1,'kyo/bench/Bench$$Lambda$39.0x0000000800c82330.apply')
f(20,2,1,4,'OptoRuntime::new_instance_C(Klass*, JavaThread*)')
f(21,2,1,4,'InstanceKlass::allocate_instance(JavaThread*)')
f(22,2,1,4,'MemAllocator::allocate() const')
f(23,2,1,4,'AllocTracer::send_allocation_in_new_tlab(Klass*, HeapWordImpl**, unsigned long, unsigned long, JavaThread*)')
f(18,3,17,1,'kyo/concurrent/fibers$Fibers$$anon$33.apply')
f(19,3,17,1,'kyo/concurrent/fibers$Fibers.kyo$concurrent$fibers$Fibers$$_$transformLoop$2')
f(20,3,17,1,'kyo/concurrent/fibers$Fibers$$Lambda$38.0x0000000800c3f828.apply',2,0,0)
f(21,3,17,1,'kyo/concurrent/fibers$Fibers.$anonfun$4',2,0,0)
f(22,3,1,2,'kyo/concurrent/scheduler/IOTask.<init>',1,0,0)
f(22,4,16,1,'kyo/concurrent/scheduler/Scheduler$.schedule',1,0,0)
f(23,4,16,1,'kyo/concurrent/scheduler/Scheduler$.submit',1,0,0)
f(24,4,16,1,'kyo/concurrent/scheduler/Worker.enqueue',1,0,0)
f(25,4,15,1,'java/util/concurrent/locks/LockSupport.unpark')
f(26,4,15,1,'jdk/internal/misc/Unsafe.unpark')
f(27,4,15,3,'pthread_cond_signal')
f(28,4,15,5,'entry_SYSCALL_64_after_hwframe')
f(29,4,15,5,'do_syscall_64')
f(30,4,15,5,'__x64_sys_futex')
f(31,4,15,5,'do_futex')
f(32,4,15,5,'futex_wake')
f(33,5,14,5,'wake_up_q')
f(34,5,14,5,'_raw_spin_unlock_irqrestore')
f(25,19,1,2,'kyo/concurrent/scheduler/Queue.offer',1,0,0)
f(26,19,1,2,'kyo/concurrent/scheduler/Queue.tryModify',1,0,0)
f(27,19,1,2,'scala/Function0.apply$mcZ$sp',1,0,0)
f(28,19,1,2,'kyo/concurrent/scheduler/Queue$$Lambda$54.0x0000000800d46000.apply',1,0,0)
f(29,19,1,2,'kyo/concurrent/scheduler/Queue.offer$$anonfun$1',1,0,0)
f(30,19,1,2,'scala/collection/mutable/PriorityQueue.addOne',1,0,0)
f(17,20,23,1,'kyo/concurrent/fibers$Fiber$$anon$10.apply')
f(18,20,23,1,'kyo/concurrent/fibers$Fiber$$anon$10.apply')
f(19,20,23,1,'kyo/concurrent/scheduler/IOPromise.block')
f(20,20,23,1,'kyo/concurrent/scheduler/IOPromise.loop$4')
f(21,20,23,1,'java/util/concurrent/locks/AbstractQueuedSynchronizer.acquireSharedInterruptibly')
f(22,20,23,1,'java/util/concurrent/locks/AbstractQueuedSynchronizer.acquire')
f(23,20,23,1,'java/util/concurrent/locks/LockSupport.park')
f(24,20,23,1,'jdk/internal/misc/Unsafe.park')
f(25,21,3,3,'Unsafe_Park')
f(26,21,1,3,'/usr/lib/x86_64-linux-gnu/libc.so.6')
f(26,22,1,4,'Parker::park(bool, long)')
f(26,23,1,3,'pthread_mutex_unlock')
f(25,24,19,3,'[unknown]')
f(26,24,19,3,'/usr/lib/x86_64-linux-gnu/libc.so.6')
f(27,26,17,5,'entry_SYSCALL_64_after_hwframe')
f(28,26,17,5,'do_syscall_64')
f(29,26,16,5,'__x64_sys_futex')
f(30,26,16,5,'do_futex')
f(31,26,16,5,'futex_wait')
f(32,27,13,5,'futex_wait_queue_me')
f(33,27,13,5,'schedule')
f(34,27,13,5,'__schedule')
f(35,28,12,5,'finish_task_switch.isra.0')
f(32,40,1,5,'futex_wait_setup')
f(32,41,1,5,'hash_futex')
f(29,42,1,5,'syscall_enter_from_user_mode')
f(4,43,1,1,'kyo/concurrent/scheduler/Coordinator$$$Lambda$49.0x0000000800d1baf0.run')
f(5,43,1,1,'kyo/concurrent/scheduler/Coordinator$.$init$$$anonfun$1')
f(6,43,1,1,'kyo/concurrent/scheduler/Coordinator$.update')
f(7,43,1,1,'java/lang/Thread.sleep')
f(8,43,1,3,'[unknown]')
f(9,43,1,3,'/usr/lib/x86_64-linux-gnu/libc.so.6')
f(10,43,1,5,'entry_SYSCALL_64_after_hwframe')
f(11,43,1,5,'do_syscall_64')
f(12,43,1,5,'__x64_sys_futex')
f(13,43,1,5,'do_futex')
f(14,43,1,5,'futex_wait')
f(15,43,1,5,'futex_wait_queue_me')
f(16,43,1,5,'schedule')
f(17,43,1,5,'__schedule')
f(18,43,1,5,'finish_task_switch.isra.0')
f(4,44,394,1,'kyo/concurrent/scheduler/Scheduler$$$Lambda$52.0x0000000800d22ac0.run')
f(5,44,394,1,'kyo/concurrent/scheduler/Scheduler$.startWorkers$$anonfun$1')
f(6,44,394,1,'kyo/concurrent/scheduler/Worker.runWorker')
f(7,45,93,2,'kyo/concurrent/scheduler/IOTask.run',74,0,0)
f(8,53,85,2,'kyo/concurrent/scheduler/IOTask.eval',66,0,0)
f(9,75,32,2,'kyo/concurrent/fibers$Fibers$$anon$32.apply',32,0,0)
f(10,75,32,2,'kyo/concurrent/fibers$Fibers$$anon$32.apply',32,0,0)
f(11,75,32,2,'kyo/bench/Bench$$Lambda$37.0x0000000800c3e0d0.apply',32,0,0)
f(12,75,32,2,'kyo/bench/Bench.$anonfun$1',32,0,0)
f(13,75,32,2,'kyo/bench/Bench.kyoBenchFiber',32,0,0)
f(14,75,32,2,'kyo/bench/DeepBindBench.kyoBench',32,0,0)
f(15,75,32,2,'kyo/bench/DeepBindBench.kyo$bench$DeepBindBench$$_$loop$1',32,0,0)
f(16,75,32,2,'kyo/bench/DeepBindBench$$anon$1.<init>',32,0,0)
f(9,107,19,1,'kyo/concurrent/scheduler/IOTask.loop$8')
f(10,107,19,1,'kyo/concurrent/scheduler/IOPromise.kyo$concurrent$scheduler$IOPromise$$inline$complete')
f(11,107,19,1,'kyo/concurrent/scheduler/IOPromise.complete')
f(12,107,19,1,'kyo/concurrent/scheduler/IOPromise$Pending.flush')
f(13,107,19,1,'kyo/concurrent/scheduler/IOPromise$Pending.loop$7')
f(14,107,19,1,'kyo/concurrent/scheduler/IOPromise$Pending$$anon$3.run')
f(15,107,19,1,'kyo/concurrent/scheduler/IOPromise$$anon$1.apply')
f(16,107,19,1,'kyo/concurrent/scheduler/IOPromise$$anon$1.apply')
f(17,107,19,1,'java/util/concurrent/locks/AbstractQueuedSynchronizer.releaseShared')
f(18,107,19,1,'java/util/concurrent/locks/AbstractQueuedSynchronizer.signalNext')
f(19,107,19,1,'java/util/concurrent/locks/LockSupport.unpark')
f(20,107,19,1,'jdk/internal/misc/Unsafe.unpark')
f(21,107,19,3,'pthread_cond_signal')
f(22,107,19,5,'entry_SYSCALL_64_after_hwframe')
f(23,107,19,5,'do_syscall_64')
f(24,107,18,5,'__x64_sys_futex')
f(25,107,18,5,'do_futex')
f(26,107,18,5,'futex_wake')
f(27,108,17,5,'wake_up_q')
f(28,108,17,5,'_raw_spin_unlock_irqrestore')
f(24,125,1,5,'syscall_enter_from_user_mode')
f(9,126,12,2,'kyo/ios$KyoIO.effect',12,0,0)
f(7,138,274,2,'kyo/concurrent/scheduler/Queue.poll',272,0,0)
f(8,138,11,2,'java/lang/invoke/Invokers$Holder.linkToTargetMethod',11,0,0)
f(9,138,11,2,'java/lang/invoke/DirectMethodHandle$Holder.newInvokeSpecial',11,0,0)
f(10,147,2,2,'java/lang/invoke/DirectMethodHandle.allocateInstance',2,0,0)
f(8,149,263,2,'kyo/concurrent/scheduler/Queue.modify',261,0,0)
f(9,149,135,2,'java/util/concurrent/atomic/AtomicBoolean.compareAndSet',135,0,0)
f(10,166,118,2,'java/lang/invoke/VarHandleGuards.guard_LII_Z',118,0,0)
f(11,190,94,2,'java/lang/invoke/VarForm.getMemberName',94,0,0)
f(9,284,128,2,'kyo/concurrent/scheduler/Queue$$Lambda$55.0x0000000800d46c78.apply',126,0,0)
f(10,284,128,2,'kyo/concurrent/scheduler/Queue.poll$$anonfun$1',126,0,0)
f(11,287,1,4,'OptoRuntime::new_instance_C(Klass*, JavaThread*)')
f(12,287,1,4,'InstanceKlass::allocate_instance(JavaThread*)')
f(13,287,1,4,'MemAllocator::allocate() const')
f(14,287,1,4,'MemAllocator::allocate_inside_tlab_slow(MemAllocator::Allocation&) const')
f(15,287,1,4,'G1CardTable::g1_mark_as_young(MemRegion const&)')
f(11,288,124,2,'scala/collection/mutable/PriorityQueue.dequeue',124,0,0)
f(7,412,26,1,'kyo/concurrent/scheduler/Scheduler$.idle')
f(8,412,2,1,'java/util/AbstractQueue.add')
f(9,412,2,1,'org/jctools/queues/MpmcUnboundedXaddArrayQueue.offer')
f(10,413,1,2,'org/jctools/queues/MpUnboundedXaddArrayQueue.producerChunkForIndex',1,0,0)
f(11,413,1,2,'org/jctools/queues/MpUnboundedXaddArrayQueue.appendNextChunks',1,0,0)
f(12,413,1,2,'org/jctools/queues/MpUnboundedXaddArrayQueueProducerChunk.casProducerChunkIndex',1,0,0)
f(13,413,1,2,'sun/misc/Unsafe.compareAndSwapLong',1,0,0)
f(8,414,24,1,'kyo/concurrent/scheduler/Worker.park')
f(9,414,24,1,'java/util/concurrent/locks/LockSupport.parkNanos')
f(10,414,24,1,'jdk/internal/misc/Unsafe.park')
f(11,415,4,3,'Unsafe_Park')
f(12,416,1,4,'Parker::park(bool, long)')
f(12,417,1,3,'clock_gettime')
f(12,418,1,3,'pthread_cond_timedwait')
f(11,419,19,3,'[unknown]')
f(12,419,18,3,'/usr/lib/x86_64-linux-gnu/libc.so.6')
f(13,419,18,5,'entry_SYSCALL_64_after_hwframe')
f(14,419,18,5,'do_syscall_64')
f(15,419,17,5,'__x64_sys_futex')
f(16,419,1,5,'_copy_from_user')
f(16,420,16,5,'do_futex')
f(17,420,16,5,'futex_wait')
f(18,420,15,5,'futex_wait_queue_me')
f(19,420,2,5,'hrtimer_sleeper_start_expires')
f(20,420,2,5,'_raw_spin_unlock_irqrestore')
f(19,422,13,5,'schedule')
f(20,422,13,5,'__schedule')
f(21,422,13,5,'finish_task_switch.isra.0')
f(18,435,1,5,'hrtimer_cancel')
f(19,435,1,5,'hrtimer_active')
f(15,436,1,5,'syscall_enter_from_user_mode')
f(12,437,1,3,'pthread_cond_timedwait')
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" : 10,
"warmupTime" : "1 s",
"warmupBatchSize" : 1,
"measurementIterations" : 5,
"measurementTime" : "1 s",
"measurementBatchSize" : 1,
"primaryMetric" : {
"score" : 20686.31424576597,
"scoreError" : 1259.0211453953489,
"scoreConfidence" : [
19427.29310037062,
21945.33539116132
],
"scorePercentiles" : {
"0.0" : 20210.153399893625,
"50.0" : 20654.535335607474,
"90.0" : 21063.23437626316,
"95.0" : 21063.23437626316,
"99.0" : 21063.23437626316,
"99.9" : 21063.23437626316,
"99.99" : 21063.23437626316,
"99.999" : 21063.23437626316,
"99.9999" : 21063.23437626316,
"100.0" : 21063.23437626316
},
"scoreUnit" : "ops/s",
"rawData" : [
[
20210.153399893625,
21063.23437626316,
20654.535335607474,
20908.716350000253,
20594.931767065344
]
]
},
"secondaryMetrics" : {
}
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment