Skip to content

Instantly share code, notes, and snippets.

@fwbrasil
Created June 11, 2023 20:43
Show Gist options
  • Save fwbrasil/aa8173b9821c09804213d4c2e27e03b0 to your computer and use it in GitHub Desktop.
Save fwbrasil/aa8173b9821c09804213d4c2e27e03b0 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,26357,3,'all')
f(1,0,26352,1,'java/lang/Thread.run')
f(2,0,26352,1,'java/util/concurrent/ThreadPoolExecutor$Worker.run')
f(3,0,26352,1,'java/util/concurrent/ThreadPoolExecutor.runWorker')
f(4,0,4578,1,'java/util/concurrent/FutureTask.run')
f(5,0,4577,1,'java/util/concurrent/Executors$RunnableAdapter.call')
f(6,0,4577,1,'java/util/concurrent/FutureTask.run')
f(7,0,4577,1,'org/openjdk/jmh/runner/BenchmarkHandler$BenchmarkTask.call')
f(8,0,4577,1,'org/openjdk/jmh/runner/BenchmarkHandler$BenchmarkTask.call')
f(9,0,4577,1,'java/lang/reflect/Method.invoke')
f(10,0,4577,1,'jdk/internal/reflect/DelegatingMethodAccessorImpl.invoke')
f(11,0,4577,1,'jdk/internal/reflect/NativeMethodAccessorImpl.invoke')
f(12,0,4577,1,'jdk/internal/reflect/NativeMethodAccessorImpl.invoke0')
f(13,0,4577,1,'kyo/bench/jmh_generated/DeepBindBench_forkKyo_jmhTest.forkKyo_Throughput')
f(14,0,4577,1,'kyo/bench/jmh_generated/DeepBindBench_forkKyo_jmhTest.forkKyo_thrpt_jmhStub')
f(15,0,4577,1,'kyo/bench/Bench.forkKyo')
f(16,0,245,1,'java/lang/invoke/Invokers$Holder.linkToTargetMethod')
f(17,0,245,1,'java/lang/invoke/DirectMethodHandle$Holder.newInvokeSpecial')
f(18,0,245,1,'java/lang/invoke/DirectMethodHandle.allocateInstance')
f(19,0,245,2,'kyo.bench.Bench$$Lambda$37+0x0000000800c3e0d0')
f(16,245,612,1,'kyo/bench/Bench.kyo$bench$Bench$$_$_$transformLoop$1')
f(17,245,612,2,'kyo.bench.Bench$$anon$1')
f(16,857,3281,1,'kyo/bench/Bench.runLoop$2')
f(17,857,1163,1,'kyo/bench/Bench$$anon$1.apply')
f(18,857,162,1,'kyo/bench/Bench.kyo$bench$Bench$$_$_$transformLoop$1')
f(19,857,162,1,'kyo/bench/Bench$$Lambda$39.0x0000000800c82330.apply')
f(20,857,162,1,'kyo/bench/Bench.$anonfun$2')
f(21,857,162,1,'kyo/concurrent/fibers$Fiber.block')
f(22,857,162,2,'kyo.concurrent.fibers$Fiber$$anon$10')
f(18,1019,1001,1,'kyo/concurrent/fibers$Fibers$$anon$33.apply')
f(19,1019,1001,1,'kyo/concurrent/fibers$Fibers.kyo$concurrent$fibers$Fibers$$_$transformLoop$2')
f(20,1019,1001,1,'kyo/concurrent/fibers$Fibers$$Lambda$38.0x0000000800c3f828.apply')
f(21,1019,1001,1,'kyo/concurrent/fibers$Fibers.$anonfun$4')
f(22,1019,100,2,'kyo.concurrent.fibers$Fibers$$anon$32')
f(22,1119,741,2,'kyo.concurrent.scheduler.IOTask')
f(22,1860,160,1,'kyo/concurrent/fibers$Fiber$.promise')
f(23,1860,160,2,'kyo.concurrent.fibers$Fiber')
f(17,2020,2118,1,'kyo/concurrent/fibers$Fiber$$anon$10.apply')
f(18,2020,2118,1,'kyo/concurrent/fibers$Fiber$$anon$10.apply')
f(19,2020,2118,1,'kyo/concurrent/scheduler/IOPromise.block')
f(20,2020,2118,1,'kyo/concurrent/scheduler/IOPromise.loop$4')
f(21,2020,945,1,'java/util/concurrent/locks/AbstractQueuedSynchronizer.acquireSharedInterruptibly')
f(22,2020,945,1,'java/util/concurrent/locks/AbstractQueuedSynchronizer.acquire')
f(23,2020,257,2,'java.util.concurrent.locks.AbstractQueuedSynchronizer$SharedNode')
f(23,2277,688,1,'java/util/concurrent/locks/AbstractQueuedSynchronizer.tryInitializeHead')
f(24,2277,688,2,'java.util.concurrent.locks.AbstractQueuedSynchronizer$ExclusiveNode')
f(21,2965,740,2,'kyo.concurrent.scheduler.IOPromise$$anon$1')
f(21,3705,433,1,'kyo/concurrent/scheduler/IOPromise.loop$5')
f(22,3705,433,1,'kyo/concurrent/scheduler/IOPromise$Pending.add')
f(23,3705,433,2,'kyo.concurrent.scheduler.IOPromise$Pending$$anon$3')
f(16,4138,439,1,'kyo/concurrent/fibers$Fibers.forkFiber')
f(17,4138,242,1,'java/lang/invoke/Invokers$Holder.linkToTargetMethod')
f(18,4138,242,1,'java/lang/invoke/DirectMethodHandle$Holder.newInvokeSpecial')
f(19,4138,242,1,'java/lang/invoke/DirectMethodHandle.allocateInstance')
f(20,4138,242,2,'kyo.concurrent.fibers$Fibers$$Lambda$38+0x0000000800c3f828')
f(17,4380,118,1,'kyo/concurrent/fibers$Fibers.kyo$concurrent$fibers$Fibers$$_$transformLoop$2')
f(18,4380,118,2,'kyo.concurrent.fibers$Fibers$$anon$33')
f(17,4498,79,1,'kyo/locals$Locals$.save')
f(18,4498,79,2,'kyo.locals$Locals$$anon$3')
f(5,4577,1,1,'java/util/concurrent/FutureTask.set')
f(6,4577,1,1,'java/util/concurrent/FutureTask.finishCompletion')
f(7,4577,1,1,'java/util/concurrent/ExecutorCompletionService$QueueingFuture.done')
f(8,4577,1,1,'java/util/AbstractQueue.add')
f(9,4577,1,1,'java/util/concurrent/LinkedBlockingQueue.offer')
f(10,4577,1,1,'java/util/concurrent/LinkedBlockingQueue.signalNotEmpty')
f(11,4577,1,1,'java/util/concurrent/locks/AbstractQueuedSynchronizer$ConditionObject.signal')
f(12,4577,1,1,'java/util/concurrent/locks/AbstractQueuedSynchronizer$ConditionObject.doSignal')
f(13,4577,1,1,'java/util/concurrent/locks/AbstractQueuedSynchronizer.enqueue')
f(14,4577,1,1,'java/util/concurrent/locks/AbstractQueuedSynchronizer.tryInitializeHead')
f(15,4577,1,2,'java.util.concurrent.locks.AbstractQueuedSynchronizer$ExclusiveNode')
f(4,4578,18,1,'kyo/concurrent/scheduler/Coordinator$$$Lambda$49.0x0000000800d1baf0.run')
f(5,4578,18,1,'kyo/concurrent/scheduler/Coordinator$.$init$$$anonfun$1')
f(6,4578,18,1,'kyo/concurrent/scheduler/Coordinator$.update')
f(7,4578,18,1,'java/util/concurrent/ThreadPoolExecutor.execute')
f(8,4578,18,1,'java/util/concurrent/SynchronousQueue.offer')
f(9,4578,18,1,'java/util/concurrent/SynchronousQueue$TransferStack.transfer')
f(10,4578,18,1,'java/util/concurrent/SynchronousQueue$TransferStack.snode')
f(11,4578,18,2,'java.util.concurrent.SynchronousQueue$TransferStack$SNode')
f(4,4596,18,1,'kyo/concurrent/scheduler/Coordinator$$$Lambda$50.0x0000000800d1bd18.run')
f(5,4596,18,1,'kyo/concurrent/scheduler/Coordinator$.$init$$$anonfun$2')
f(6,4596,18,1,'kyo/concurrent/scheduler/Scheduler$.cycle')
f(7,4596,18,1,'java/lang/invoke/Invokers$Holder.linkToTargetMethod')
f(8,4596,18,1,'java/lang/invoke/DirectMethodHandle$Holder.newInvokeSpecial')
f(9,4596,18,1,'java/lang/invoke/DirectMethodHandle.allocateInstance')
f(10,4596,18,1,'jdk/internal/misc/Unsafe.allocateInstance')
f(11,4596,18,2,'kyo.concurrent.scheduler.Scheduler$$$Lambda$58+0x0000000800d482c0')
f(4,4614,21738,1,'kyo/concurrent/scheduler/Scheduler$$$Lambda$52.0x0000000800d22ac0.run')
f(5,4614,21738,1,'kyo/concurrent/scheduler/Scheduler$.startWorkers$$anonfun$1')
f(6,4614,21738,1,'kyo/concurrent/scheduler/Worker.runWorker')
f(7,4614,21735,1,'kyo/concurrent/scheduler/IOTask.run')
f(8,4614,21735,1,'kyo/concurrent/scheduler/IOTask.eval')
f(9,4614,21501,1,'kyo/bench/DeepBindBench$$anon$1.apply')
f(10,4614,21501,1,'kyo/bench/DeepBindBench$$anon$1.apply')
f(11,4614,21501,1,'kyo/bench/DeepBindBench.kyo$bench$DeepBindBench$$_$loop$1')
f(12,4614,21501,2,'kyo.bench.DeepBindBench$$anon$1')
f(9,26115,234,1,'kyo/concurrent/fibers$Fibers$$anon$32.apply')
f(10,26115,234,1,'kyo/concurrent/fibers$Fibers$$anon$32.apply')
f(11,26115,234,1,'kyo/bench/Bench$$Lambda$37.0x0000000800c3e0d0.apply')
f(12,26115,234,1,'kyo/bench/Bench.$anonfun$1')
f(13,26115,234,1,'kyo/bench/Bench.kyoBenchFiber')
f(14,26115,234,1,'kyo/bench/DeepBindBench.kyoBench')
f(15,26115,234,1,'kyo/bench/DeepBindBench.kyo$bench$DeepBindBench$$_$loop$1')
f(16,26115,234,2,'kyo.bench.DeepBindBench$$anon$1')
f(7,26349,3,1,'kyo/concurrent/scheduler/Scheduler$.steal')
f(8,26349,3,1,'kyo/concurrent/scheduler/Worker.steal')
f(9,26349,3,1,'kyo/concurrent/scheduler/Queue.steal')
f(10,26349,3,1,'scala/runtime/ObjectRef.create')
f(11,26349,3,2,'scala.runtime.ObjectRef')
f(1,26352,5,1,'org/openjdk/jmh/runner/ForkedMain.main')
f(2,26352,5,1,'org/openjdk/jmh/runner/ForkedRunner.run')
f(3,26352,5,1,'org/openjdk/jmh/runner/BaseRunner.runBenchmarksForked')
f(4,26352,5,1,'org/openjdk/jmh/runner/BaseRunner.doSingle')
f(5,26352,5,1,'org/openjdk/jmh/runner/BaseRunner.runBenchmark')
f(6,26352,5,1,'org/openjdk/jmh/runner/BaseRunner.runBenchmark')
f(7,26352,5,1,'org/openjdk/jmh/runner/BenchmarkHandler.runIteration')
f(8,26352,5,1,'org/openjdk/jmh/runner/InfraControl.awaitWarmdownReady')
f(9,26352,5,1,'org/openjdk/jmh/runner/InfraControlL2.awaitWarmdownReady')
f(10,26352,5,1,'java/util/concurrent/CountDownLatch.await')
f(11,26352,5,1,'java/util/concurrent/locks/AbstractQueuedSynchronizer.acquireSharedInterruptibly')
f(12,26352,5,1,'java/util/concurrent/locks/AbstractQueuedSynchronizer.acquire')
f(13,26352,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,422,3,'all')
f(1,0,1,3,'/usr/lib/x86_64-linux-gnu/libc.so.6')
f(2,0,1,3,'thread_native_entry(Thread*)')
f(3,0,1,4,'Thread::call_run()')
f(4,0,1,4,'VMThread::run()')
f(5,0,1,4,'VMThread::inner_execute(VM_Operation*)')
f(6,0,1,4,'VMThread::evaluate_operation(VM_Operation*)')
f(7,0,1,4,'VM_Operation::evaluate()')
f(8,0,1,4,'VM_G1CollectForAllocation::doit()')
f(9,0,1,4,'G1CollectedHeap::do_collection_pause_at_safepoint(double)')
f(10,0,1,4,'G1CollectedHeap::do_collection_pause_at_safepoint_helper(double)')
f(11,0,1,4,'G1CollectedHeap::evacuate_initial_collection_set(G1ParScanThreadStateSet*, bool)')
f(12,0,1,4,'G1RemSet::merge_heap_roots(bool)')
f(13,0,1,4,'WorkGang::run_task(AbstractGangTask*, unsigned int, bool)')
f(14,0,1,3,'sem_post')
f(15,0,1,5,'entry_SYSCALL_64_after_hwframe')
f(16,0,1,5,'do_syscall_64')
f(17,0,1,5,'__x64_sys_futex')
f(18,0,1,5,'do_futex')
f(19,0,1,5,'futex_wake')
f(20,0,1,5,'wake_up_q')
f(21,0,1,5,'_raw_spin_unlock_irqrestore')
f(1,1,421,1,'java/lang/Thread.run')
f(2,1,421,1,'java/util/concurrent/ThreadPoolExecutor$Worker.run')
f(3,1,421,1,'java/util/concurrent/ThreadPoolExecutor.runWorker')
f(4,1,48,1,'java/util/concurrent/FutureTask.run')
f(5,1,48,1,'java/util/concurrent/Executors$RunnableAdapter.call')
f(6,1,48,1,'java/util/concurrent/FutureTask.run')
f(7,1,48,1,'org/openjdk/jmh/runner/BenchmarkHandler$BenchmarkTask.call')
f(8,1,48,1,'org/openjdk/jmh/runner/BenchmarkHandler$BenchmarkTask.call')
f(9,1,48,1,'java/lang/reflect/Method.invoke')
f(10,1,48,1,'jdk/internal/reflect/DelegatingMethodAccessorImpl.invoke')
f(11,1,48,1,'jdk/internal/reflect/NativeMethodAccessorImpl.invoke')
f(12,1,48,1,'jdk/internal/reflect/NativeMethodAccessorImpl.invoke0')
f(13,1,48,1,'kyo/bench/jmh_generated/DeepBindBench_forkKyo_jmhTest.forkKyo_Throughput')
f(14,1,48,1,'kyo/bench/jmh_generated/DeepBindBench_forkKyo_jmhTest.forkKyo_thrpt_jmhStub')
f(15,1,1,4,'OptoRuntime::new_instance_C(Klass*, JavaThread*)')
f(16,1,1,4,'InstanceKlass::allocate_instance(JavaThread*)')
f(17,1,1,4,'MemAllocator::allocate() const')
f(18,1,1,4,'MemAllocator::allocate_inside_tlab_slow(MemAllocator::Allocation&) const')
f(19,1,1,4,'G1Allocator::unsafe_max_tlab_alloc()')
f(15,2,47,1,'kyo/bench/Bench.forkKyo')
f(16,2,47,1,'kyo/bench/Bench.runLoop$2')
f(17,2,23,1,'kyo/bench/Bench$$anon$1.apply')
f(18,2,23,1,'kyo/concurrent/fibers$Fibers$$anon$33.apply')
f(19,2,23,1,'kyo/concurrent/fibers$Fibers.kyo$concurrent$fibers$Fibers$$_$transformLoop$2')
f(20,2,23,1,'kyo/concurrent/fibers$Fibers$$Lambda$38.0x0000000800c3f828.apply',2,0,0)
f(21,2,23,1,'kyo/concurrent/fibers$Fibers.$anonfun$4',2,0,0)
f(22,2,23,1,'kyo/concurrent/scheduler/Scheduler$.schedule',2,0,0)
f(23,2,23,1,'kyo/concurrent/scheduler/Scheduler$.submit',2,0,0)
f(24,2,23,1,'kyo/concurrent/scheduler/Worker.enqueue',2,0,0)
f(25,2,21,1,'java/util/concurrent/locks/LockSupport.unpark')
f(26,2,21,1,'jdk/internal/misc/Unsafe.unpark')
f(27,2,1,3,'Unsafe_Unpark')
f(28,2,1,3,'pthread_mutex_lock')
f(27,3,20,3,'pthread_cond_signal')
f(28,3,20,5,'entry_SYSCALL_64_after_hwframe')
f(29,3,20,5,'do_syscall_64')
f(30,3,20,5,'__x64_sys_futex')
f(31,3,20,5,'do_futex')
f(32,3,20,5,'futex_wake')
f(33,4,1,5,'mark_wake_futex')
f(33,5,18,5,'wake_up_q')
f(34,5,18,5,'_raw_spin_unlock_irqrestore')
f(25,23,2,2,'kyo/concurrent/scheduler/Queue.offer',2,0,0)
f(26,23,2,2,'kyo/concurrent/scheduler/Queue.tryModify',2,0,0)
f(27,23,2,2,'scala/Function0.apply$mcZ$sp',2,0,0)
f(28,23,2,2,'kyo/concurrent/scheduler/Queue$$Lambda$54.0x0000000800d46000.apply',2,0,0)
f(29,23,2,2,'kyo/concurrent/scheduler/Queue.offer$$anonfun$1',2,0,0)
f(30,24,1,2,'scala/collection/mutable/PriorityQueue.addOne',1,0,0)
f(17,25,24,1,'kyo/concurrent/fibers$Fiber$$anon$10.apply',1,0,0)
f(18,25,24,1,'kyo/concurrent/fibers$Fiber$$anon$10.apply',1,0,0)
f(19,25,24,1,'kyo/concurrent/scheduler/IOPromise.block',1,0,0)
f(20,25,24,1,'kyo/concurrent/scheduler/IOPromise.loop$4',1,0,0)
f(21,25,23,1,'java/util/concurrent/locks/AbstractQueuedSynchronizer.acquireSharedInterruptibly')
f(22,25,23,1,'java/util/concurrent/locks/AbstractQueuedSynchronizer.acquire')
f(23,27,19,1,'java/util/concurrent/locks/LockSupport.park')
f(24,27,19,1,'jdk/internal/misc/Unsafe.park')
f(25,28,3,3,'Unsafe_Park')
f(26,29,1,3,'pthread_cond_wait')
f(26,30,1,3,'pthread_mutex_unlock')
f(25,31,15,3,'[unknown]')
f(26,31,15,3,'/usr/lib/x86_64-linux-gnu/libc.so.6')
f(27,31,15,5,'entry_SYSCALL_64_after_hwframe')
f(28,31,1,5,'__x64_sys_futex')
f(28,32,14,5,'do_syscall_64')
f(29,32,13,5,'__x64_sys_futex')
f(30,32,13,5,'do_futex')
f(31,32,13,5,'futex_wait')
f(32,36,1,5,'__get_user_nocheck_4')
f(32,37,1,5,'_raw_spin_lock')
f(32,38,7,5,'futex_wait_queue_me')
f(33,38,7,5,'schedule')
f(34,38,7,5,'__schedule')
f(35,38,7,5,'finish_task_switch.isra.0')
f(29,45,1,5,'syscall_exit_to_user_mode')
f(30,45,1,5,'exit_to_user_mode_prepare')
f(31,45,1,5,'exit_to_user_mode_loop')
f(32,45,1,5,'__rseq_handle_notify_resume')
f(23,46,2,2,'kyo/concurrent/scheduler/IOPromise$$anon$1.tryAcquireShared',2,0,0)
f(21,48,1,2,'kyo/concurrent/scheduler/IOPromise.loop$5',1,0,0)
f(22,48,1,2,'java/util/concurrent/atomic/AtomicReference.compareAndSet',1,0,0)
f(23,48,1,2,'java/lang/invoke/VarHandleGuards.guard_LLL_Z',1,0,0)
f(24,48,1,2,'java/lang/invoke/VarHandleReferences$FieldInstanceReadWrite.compareAndSet',1,0,0)
f(4,49,1,1,'kyo/concurrent/scheduler/Coordinator$$$Lambda$49.0x0000000800d1baf0.run')
f(5,49,1,1,'kyo/concurrent/scheduler/Coordinator$.$init$$$anonfun$1')
f(6,49,1,1,'kyo/concurrent/scheduler/Coordinator$.update')
f(7,49,1,1,'java/lang/Thread.sleep')
f(8,49,1,3,'JVM_Sleep')
f(9,49,1,4,'HandleMark::pop_and_restore()')
f(4,50,372,1,'kyo/concurrent/scheduler/Scheduler$$$Lambda$52.0x0000000800d22ac0.run')
f(5,50,372,1,'kyo/concurrent/scheduler/Scheduler$.startWorkers$$anonfun$1')
f(6,50,372,1,'kyo/concurrent/scheduler/Worker.runWorker')
f(7,55,88,2,'kyo/concurrent/scheduler/IOTask.run',63,0,0)
f(8,55,16,2,'kyo/concurrent/scheduler/IOTask.curr_$eq',16,0,0)
f(8,71,26,1,'kyo/concurrent/scheduler/IOTask.eval',1,0,0)
f(9,72,25,1,'kyo/concurrent/scheduler/IOTask.loop$8')
f(10,72,25,1,'kyo/concurrent/scheduler/IOPromise.kyo$concurrent$scheduler$IOPromise$$inline$complete',1,0,0)
f(11,72,25,1,'kyo/concurrent/scheduler/IOPromise.complete',1,0,0)
f(12,72,1,2,'java/util/concurrent/atomic/AtomicReference.compareAndSet',1,0,0)
f(13,72,1,2,'java/lang/invoke/VarHandleGuards.guard_LLL_Z',1,0,0)
f(14,72,1,2,'java/lang/invoke/VarHandleReferences$FieldInstanceReadWrite.compareAndSet',1,0,0)
f(12,73,24,1,'kyo/concurrent/scheduler/IOPromise$Pending.flush')
f(13,73,24,1,'kyo/concurrent/scheduler/IOPromise$Pending.loop$7')
f(14,73,24,1,'kyo/concurrent/scheduler/IOPromise$Pending$$anon$3.run')
f(15,73,24,1,'kyo/concurrent/scheduler/IOPromise$$anon$1.apply')
f(16,73,24,1,'kyo/concurrent/scheduler/IOPromise$$anon$1.apply')
f(17,73,24,1,'java/util/concurrent/locks/AbstractQueuedSynchronizer.releaseShared')
f(18,73,24,1,'java/util/concurrent/locks/AbstractQueuedSynchronizer.signalNext')
f(19,73,24,1,'java/util/concurrent/locks/LockSupport.unpark')
f(20,73,24,1,'jdk/internal/misc/Unsafe.unpark')
f(21,73,24,3,'pthread_cond_signal')
f(22,73,24,5,'entry_SYSCALL_64_after_hwframe')
f(23,73,24,5,'do_syscall_64')
f(24,73,23,5,'__x64_sys_futex')
f(25,73,23,5,'do_futex')
f(26,74,22,5,'futex_wake')
f(27,75,21,5,'wake_up_q')
f(28,75,21,5,'_raw_spin_unlock_irqrestore')
f(24,96,1,5,'syscall_enter_from_user_mode')
f(8,97,46,2,'scala/runtime/BoxesRunTime.equals',46,0,0)
f(9,110,33,2,'scala/runtime/BoxesRunTime.equals2',33,0,0)
f(7,143,258,2,'kyo/concurrent/scheduler/Queue.poll',257,0,0)
f(8,143,3,2,'java/lang/invoke/Invokers$Holder.linkToTargetMethod',3,0,0)
f(9,143,3,2,'java/lang/invoke/DirectMethodHandle$Holder.newInvokeSpecial',3,0,0)
f(8,146,255,2,'kyo/concurrent/scheduler/Queue.modify',254,0,0)
f(9,175,1,2,'java/util/concurrent/atomic/AtomicBoolean.compareAndSet',1,0,0)
f(9,176,225,2,'kyo/concurrent/scheduler/Queue$$Lambda$55.0x0000000800d46c78.apply',224,0,0)
f(10,190,211,2,'kyo/concurrent/scheduler/Queue.poll$$anonfun$1',210,0,0)
f(11,190,133,2,'kyo/concurrent/scheduler/Queue.isEmpty',133,0,0)
f(11,323,78,2,'scala/collection/mutable/PriorityQueue.dequeue',77,0,0)
f(12,400,1,4,'OptoRuntime::new_instance_C(Klass*, JavaThread*)')
f(13,400,1,4,'InstanceKlass::allocate_instance(JavaThread*)')
f(14,400,1,4,'MemAllocator::allocate() const')
f(15,400,1,4,'MemAllocator::allocate_inside_tlab_slow(MemAllocator::Allocation&) const')
f(16,400,1,4,'G1CollectedHeap::allocate_new_tlab(unsigned long, unsigned long, unsigned long*)')
f(17,400,1,3,'pthread_mutex_unlock')
f(7,401,21,1,'kyo/concurrent/scheduler/Scheduler$.idle')
f(8,401,21,1,'kyo/concurrent/scheduler/Worker.park')
f(9,401,21,1,'java/util/concurrent/locks/LockSupport.parkNanos')
f(10,401,21,1,'jdk/internal/misc/Unsafe.park')
f(11,401,2,3,'Unsafe_Park')
f(12,402,1,3,'/usr/lib/x86_64-linux-gnu/libc.so.6')
f(11,403,19,3,'[unknown]')
f(12,403,19,3,'/usr/lib/x86_64-linux-gnu/libc.so.6')
f(13,405,17,5,'entry_SYSCALL_64_after_hwframe')
f(14,405,17,5,'do_syscall_64')
f(15,405,16,5,'__x64_sys_futex')
f(16,406,15,5,'do_futex')
f(17,406,15,5,'futex_wait')
f(18,407,13,5,'futex_wait_queue_me')
f(19,407,13,5,'schedule')
f(20,407,13,5,'__schedule')
f(21,407,13,5,'finish_task_switch.isra.0')
f(18,420,1,5,'hrtimer_init_sleeper')
f(19,420,1,5,'__hrtimer_init')
f(15,421,1,5,'syscall_exit_to_user_mode')
f(16,421,1,5,'exit_to_user_mode_prepare')
f(17,421,1,5,'exit_to_user_mode_loop')
f(18,421,1,5,'__rseq_handle_notify_resume')
f(19,421,1,5,'__put_user_nocheck_8')
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" : 20713.23914374849,
"scoreError" : 1404.315826054571,
"scoreConfidence" : [
19308.92331769392,
22117.554969803063
],
"scorePercentiles" : {
"0.0" : 20122.701323459718,
"50.0" : 20711.032440427807,
"90.0" : 21040.640861686432,
"95.0" : 21040.640861686432,
"99.0" : 21040.640861686432,
"99.9" : 21040.640861686432,
"99.99" : 21040.640861686432,
"99.999" : 21040.640861686432,
"99.9999" : 21040.640861686432,
"100.0" : 21040.640861686432
},
"scoreUnit" : "ops/s",
"rawData" : [
[
21040.640861686432,
20122.701323459718,
20702.94434892882,
20711.032440427807,
20988.876744239675
]
]
},
"secondaryMetrics" : {
}
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment