Skip to content

Instantly share code, notes, and snippets.

@fwbrasil
Created June 11, 2023 21:09
Show Gist options
  • Save fwbrasil/c4042a02a6960580cacaa325b87cf23d to your computer and use it in GitHub Desktop.
Save fwbrasil/c4042a02a6960580cacaa325b87cf23d 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,27340,3,'all')
f(1,0,27335,1,'java/lang/Thread.run')
f(2,0,27335,1,'java/util/concurrent/ThreadPoolExecutor$Worker.run')
f(3,0,27335,1,'java/util/concurrent/ThreadPoolExecutor.runWorker')
f(4,0,4737,1,'java/util/concurrent/FutureTask.run')
f(5,0,4737,1,'java/util/concurrent/Executors$RunnableAdapter.call')
f(6,0,4737,1,'java/util/concurrent/FutureTask.run')
f(7,0,4737,1,'org/openjdk/jmh/runner/BenchmarkHandler$BenchmarkTask.call')
f(8,0,4737,1,'org/openjdk/jmh/runner/BenchmarkHandler$BenchmarkTask.call')
f(9,0,4737,1,'java/lang/reflect/Method.invoke')
f(10,0,4737,1,'jdk/internal/reflect/DelegatingMethodAccessorImpl.invoke')
f(11,0,4737,1,'jdk/internal/reflect/NativeMethodAccessorImpl.invoke')
f(12,0,4737,1,'jdk/internal/reflect/NativeMethodAccessorImpl.invoke0')
f(13,0,4737,1,'kyo/bench/jmh_generated/DeepBindBench_forkKyo_jmhTest.forkKyo_Throughput')
f(14,0,4737,1,'kyo/bench/jmh_generated/DeepBindBench_forkKyo_jmhTest.forkKyo_thrpt_jmhStub')
f(15,0,4737,1,'kyo/bench/Bench.forkKyo')
f(16,0,223,1,'java/lang/invoke/Invokers$Holder.linkToTargetMethod')
f(17,0,223,1,'java/lang/invoke/DirectMethodHandle$Holder.newInvokeSpecial')
f(18,0,223,1,'java/lang/invoke/DirectMethodHandle.allocateInstance')
f(19,0,223,2,'kyo.bench.Bench$$Lambda$37+0x0000000800c3e0d0')
f(16,223,616,1,'kyo/bench/Bench.kyo$bench$Bench$$_$_$transformLoop$1')
f(17,223,616,2,'kyo.bench.Bench$$anon$1')
f(16,839,3433,1,'kyo/bench/Bench.runLoop$2')
f(17,839,1278,1,'kyo/bench/Bench$$anon$1.apply')
f(18,839,197,1,'kyo/bench/Bench.kyo$bench$Bench$$_$_$transformLoop$1')
f(19,839,197,1,'kyo/bench/Bench$$Lambda$39.0x0000000800c82330.apply')
f(20,839,197,1,'kyo/bench/Bench.$anonfun$2')
f(21,839,197,1,'kyo/concurrent/fibers$Fiber.block')
f(22,839,197,2,'kyo.concurrent.fibers$Fiber$$anon$10')
f(18,1036,1081,1,'kyo/concurrent/fibers$Fibers$$anon$33.apply')
f(19,1036,1081,1,'kyo/concurrent/fibers$Fibers.kyo$concurrent$fibers$Fibers$$_$transformLoop$2')
f(20,1036,1081,1,'kyo/concurrent/fibers$Fibers$$Lambda$38.0x0000000800c3f828.apply')
f(21,1036,1081,1,'kyo/concurrent/fibers$Fibers.$anonfun$4')
f(22,1036,105,2,'kyo.concurrent.fibers$Fibers$$anon$32')
f(22,1141,837,2,'kyo.concurrent.scheduler.IOTask')
f(22,1978,139,1,'kyo/concurrent/fibers$Fiber$.promise')
f(23,1978,139,2,'kyo.concurrent.fibers$Fiber')
f(17,2117,2155,1,'kyo/concurrent/fibers$Fiber$$anon$10.apply')
f(18,2117,2155,1,'kyo/concurrent/fibers$Fiber$$anon$10.apply')
f(19,2117,2155,1,'kyo/concurrent/scheduler/IOPromise.block')
f(20,2117,2155,1,'kyo/concurrent/scheduler/IOPromise.loop$4')
f(21,2117,913,1,'java/util/concurrent/locks/AbstractQueuedSynchronizer.acquireSharedInterruptibly')
f(22,2117,913,1,'java/util/concurrent/locks/AbstractQueuedSynchronizer.acquire')
f(23,2117,229,2,'java.util.concurrent.locks.AbstractQueuedSynchronizer$SharedNode')
f(23,2346,684,1,'java/util/concurrent/locks/AbstractQueuedSynchronizer.tryInitializeHead')
f(24,2346,684,2,'java.util.concurrent.locks.AbstractQueuedSynchronizer$ExclusiveNode')
f(21,3030,663,2,'kyo.concurrent.scheduler.IOPromise$$anon$1')
f(21,3693,579,1,'kyo/concurrent/scheduler/IOPromise.loop$5')
f(22,3693,579,1,'kyo/concurrent/scheduler/IOPromise$Pending.add')
f(23,3693,579,2,'kyo.concurrent.scheduler.IOPromise$Pending$$anon$3')
f(16,4272,465,1,'kyo/concurrent/fibers$Fibers.forkFiber')
f(17,4272,304,1,'java/lang/invoke/Invokers$Holder.linkToTargetMethod')
f(18,4272,304,1,'java/lang/invoke/DirectMethodHandle$Holder.newInvokeSpecial')
f(19,4272,304,1,'java/lang/invoke/DirectMethodHandle.allocateInstance')
f(20,4272,304,2,'kyo.concurrent.fibers$Fibers$$Lambda$38+0x0000000800c3f828')
f(17,4576,102,1,'kyo/concurrent/fibers$Fibers.kyo$concurrent$fibers$Fibers$$_$transformLoop$2')
f(18,4576,102,2,'kyo.concurrent.fibers$Fibers$$anon$33')
f(17,4678,59,1,'kyo/locals$Locals$.save')
f(18,4678,59,2,'kyo.locals$Locals$$anon$3')
f(4,4737,18,1,'kyo/concurrent/scheduler/Coordinator$$$Lambda$49.0x0000000800d1baf0.run')
f(5,4737,18,1,'kyo/concurrent/scheduler/Coordinator$.$init$$$anonfun$1')
f(6,4737,18,1,'kyo/concurrent/scheduler/Coordinator$.update')
f(7,4737,18,1,'java/util/concurrent/ThreadPoolExecutor.execute')
f(8,4737,18,1,'java/util/concurrent/SynchronousQueue.offer')
f(9,4737,18,1,'java/util/concurrent/SynchronousQueue$TransferStack.transfer')
f(10,4737,18,1,'java/util/concurrent/SynchronousQueue$TransferStack.snode')
f(11,4737,18,2,'java.util.concurrent.SynchronousQueue$TransferStack$SNode')
f(4,4755,18,1,'kyo/concurrent/scheduler/Coordinator$$$Lambda$50.0x0000000800d1bd18.run')
f(5,4755,18,1,'kyo/concurrent/scheduler/Coordinator$.$init$$$anonfun$2')
f(6,4755,18,1,'kyo/concurrent/scheduler/Scheduler$.cycle')
f(7,4755,18,1,'java/lang/invoke/Invokers$Holder.linkToTargetMethod')
f(8,4755,18,1,'java/lang/invoke/DirectMethodHandle$Holder.newInvokeSpecial')
f(9,4755,18,1,'java/lang/invoke/DirectMethodHandle.allocateInstance')
f(10,4755,18,1,'jdk/internal/misc/Unsafe.allocateInstance')
f(11,4755,18,2,'kyo.concurrent.scheduler.Scheduler$$$Lambda$57+0x0000000800d44cf0')
f(4,4773,22562,1,'kyo/concurrent/scheduler/Scheduler$$$Lambda$52.0x0000000800d22ac0.run')
f(5,4773,22562,1,'kyo/concurrent/scheduler/Scheduler$.startWorkers$$anonfun$1')
f(6,4773,22562,1,'kyo/concurrent/scheduler/Worker.runWorker')
f(7,4773,22556,1,'kyo/concurrent/scheduler/IOTask.run')
f(8,4773,22556,1,'kyo/concurrent/scheduler/IOTask.eval')
f(9,4773,22310,1,'kyo/bench/DeepBindBench$$anon$1.apply')
f(10,4773,22310,1,'kyo/bench/DeepBindBench$$anon$1.apply')
f(11,4773,22310,1,'kyo/bench/DeepBindBench.kyo$bench$DeepBindBench$$_$loop$1')
f(12,4773,22310,2,'kyo.bench.DeepBindBench$$anon$1')
f(9,27083,246,1,'kyo/concurrent/fibers$Fibers$$anon$32.apply')
f(10,27083,246,1,'kyo/concurrent/fibers$Fibers$$anon$32.apply')
f(11,27083,246,1,'kyo/bench/Bench$$Lambda$37.0x0000000800c3e0d0.apply')
f(12,27083,246,1,'kyo/bench/Bench.$anonfun$1')
f(13,27083,246,1,'kyo/bench/Bench.kyoBenchFiber')
f(14,27083,246,1,'kyo/bench/DeepBindBench.kyoBench')
f(15,27083,246,1,'kyo/bench/DeepBindBench.kyo$bench$DeepBindBench$$_$loop$1')
f(16,27083,246,2,'kyo.bench.DeepBindBench$$anon$1')
f(7,27329,6,1,'kyo/concurrent/scheduler/Scheduler$.steal')
f(8,27329,6,1,'kyo/concurrent/scheduler/Worker.steal')
f(9,27329,6,1,'kyo/concurrent/scheduler/Queue.steal')
f(10,27329,6,1,'scala/runtime/ObjectRef.create')
f(11,27329,6,2,'scala.runtime.ObjectRef')
f(1,27335,5,1,'org/openjdk/jmh/runner/ForkedMain.main')
f(2,27335,5,1,'org/openjdk/jmh/runner/ForkedRunner.run')
f(3,27335,5,1,'org/openjdk/jmh/runner/BaseRunner.runBenchmarksForked')
f(4,27335,5,1,'org/openjdk/jmh/runner/BaseRunner.doSingle')
f(5,27335,5,1,'org/openjdk/jmh/runner/BaseRunner.runBenchmark')
f(6,27335,5,1,'org/openjdk/jmh/runner/BaseRunner.runBenchmark')
f(7,27335,5,1,'org/openjdk/jmh/runner/BenchmarkHandler.runIteration')
f(8,27335,5,1,'org/openjdk/jmh/runner/InfraControl.awaitWarmdownReady')
f(9,27335,5,1,'org/openjdk/jmh/runner/InfraControlL2.awaitWarmdownReady')
f(10,27335,5,1,'java/util/concurrent/CountDownLatch.await')
f(11,27335,5,1,'java/util/concurrent/locks/AbstractQueuedSynchronizer.acquireSharedInterruptibly')
f(12,27335,5,1,'java/util/concurrent/locks/AbstractQueuedSynchronizer.acquire')
f(13,27335,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,429,3,'all')
f(1,0,7,3,'/usr/lib/x86_64-linux-gnu/libc.so.6')
f(2,0,7,3,'thread_native_entry(Thread*)')
f(3,0,7,4,'Thread::call_run()')
f(4,0,7,4,'JavaThread::thread_main_inner()')
f(5,0,7,4,'CompileBroker::compiler_thread_loop()')
f(6,0,7,4,'CompileBroker::invoke_compiler_on_method(CompileTask*)')
f(7,0,7,4,'C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)')
f(8,0,7,4,'Compile::Compile(ciEnv*, ciMethod*, int, bool, bool, bool, bool, bool, DirectiveSet*)')
f(9,0,3,4,'Compile::Code_Gen()')
f(10,0,1,4,'Matcher::match()')
f(11,0,1,4,'Matcher::xform(Node*, int)')
f(12,0,1,4,'Matcher::match_tree(Node const*)')
f(10,1,2,4,'PhaseChaitin::Register_Allocate()')
f(11,1,1,4,'PhaseChaitin::build_ifg_physical(ResourceArea*)')
f(12,1,1,4,'PhaseChaitin::interfere_with_live(unsigned int, IndexSet*) [clone .part.0]')
f(11,2,1,4,'PhaseLive::compute(unsigned int)')
f(9,3,4,4,'Compile::Optimize()')
f(10,3,1,4,'PhaseIdealLoop::build_and_optimize(LoopOptsMode)')
f(11,3,1,4,'PhaseIdealLoop::split_if_with_blocks(VectorSet&, Node_Stack&)')
f(12,3,1,4,'PhaseIdealLoop::do_split_if(Node*)')
f(13,3,1,4,'PhaseIdealLoop::handle_use(Node*, Node*, small_cache*, Node*, Node*, Node*, Node*, Node*)')
f(14,3,1,4,'NodeHash::hash_delete(Node const*)')
f(15,3,1,4,'PhiNode::hash() const')
f(10,4,3,4,'PhaseIdealLoop::optimize(PhaseIterGVN&, LoopOptsMode)')
f(11,4,3,4,'PhaseIdealLoop::build_and_optimize(LoopOptsMode)')
f(12,4,2,4,'PhaseIdealLoop::build_loop_late(VectorSet&, Node_List&, Node_Stack&)')
f(12,6,1,4,'PhaseIdealLoop::split_if_with_blocks(VectorSet&, Node_Stack&)')
f(13,6,1,4,'DecodeNNode::Opcode() const')
f(1,7,1,3,'[unknown]')
f(2,7,1,3,'__open')
f(1,8,421,1,'java/lang/Thread.run')
f(2,8,421,1,'java/util/concurrent/ThreadPoolExecutor$Worker.run')
f(3,8,421,1,'java/util/concurrent/ThreadPoolExecutor.runWorker')
f(4,8,47,1,'java/util/concurrent/FutureTask.run')
f(5,8,47,1,'java/util/concurrent/Executors$RunnableAdapter.call')
f(6,8,47,1,'java/util/concurrent/FutureTask.run')
f(7,8,47,1,'org/openjdk/jmh/runner/BenchmarkHandler$BenchmarkTask.call')
f(8,8,47,1,'org/openjdk/jmh/runner/BenchmarkHandler$BenchmarkTask.call')
f(9,8,47,1,'java/lang/reflect/Method.invoke')
f(10,8,47,1,'jdk/internal/reflect/DelegatingMethodAccessorImpl.invoke')
f(11,8,47,1,'jdk/internal/reflect/NativeMethodAccessorImpl.invoke')
f(12,8,47,1,'jdk/internal/reflect/NativeMethodAccessorImpl.invoke0')
f(13,8,47,1,'kyo/bench/jmh_generated/DeepBindBench_forkKyo_jmhTest.forkKyo_Throughput')
f(14,8,47,1,'kyo/bench/jmh_generated/DeepBindBench_forkKyo_jmhTest.forkKyo_thrpt_jmhStub')
f(15,8,47,1,'kyo/bench/Bench.forkKyo',1,0,0)
f(16,8,46,1,'kyo/bench/Bench.runLoop$2',1,0,0)
f(17,8,25,1,'kyo/bench/Bench$$anon$1.apply')
f(18,8,25,1,'kyo/concurrent/fibers$Fibers$$anon$33.apply',1,0,0)
f(19,8,25,1,'kyo/concurrent/fibers$Fibers.kyo$concurrent$fibers$Fibers$$_$transformLoop$2',1,0,0)
f(20,8,24,1,'kyo/concurrent/fibers$Fibers$$Lambda$38.0x0000000800c3f828.apply')
f(21,8,24,1,'kyo/concurrent/fibers$Fibers.$anonfun$4')
f(22,8,24,1,'kyo/concurrent/scheduler/Scheduler$.schedule')
f(23,8,24,1,'kyo/concurrent/scheduler/Scheduler$.submit')
f(24,8,24,1,'kyo/concurrent/scheduler/Worker.enqueue')
f(25,8,24,1,'java/util/concurrent/locks/LockSupport.unpark')
f(26,8,24,1,'jdk/internal/misc/Unsafe.unpark')
f(27,9,1,3,'Unsafe_Unpark')
f(28,9,1,4,'ThreadsListHandle::ThreadsListHandle(Thread*)')
f(27,10,22,3,'pthread_cond_signal')
f(28,10,22,5,'entry_SYSCALL_64_after_hwframe')
f(29,10,22,5,'do_syscall_64')
f(30,10,22,5,'__x64_sys_futex')
f(31,10,22,5,'do_futex')
f(32,10,22,5,'futex_wake')
f(33,11,1,5,'try_to_wake_up')
f(33,12,20,5,'wake_up_q')
f(34,12,20,5,'_raw_spin_unlock_irqrestore')
f(20,32,1,2,'kyo/concurrent/fibers$Fibers$$anon$33.<init>',1,0,0)
f(21,32,1,2,'kyo/core$internal$KyoCont.<init>',1,0,0)
f(17,33,21,1,'kyo/concurrent/fibers$Fiber$$anon$10.apply',1,0,0)
f(18,33,21,1,'kyo/concurrent/fibers$Fiber$$anon$10.apply',1,0,0)
f(19,33,21,1,'kyo/concurrent/scheduler/IOPromise.block',1,0,0)
f(20,33,21,1,'kyo/concurrent/scheduler/IOPromise.loop$4',1,0,0)
f(21,33,20,1,'java/util/concurrent/locks/AbstractQueuedSynchronizer.acquireSharedInterruptibly')
f(22,33,20,1,'java/util/concurrent/locks/AbstractQueuedSynchronizer.acquire')
f(23,33,20,1,'java/util/concurrent/locks/LockSupport.park')
f(24,33,20,1,'jdk/internal/misc/Unsafe.park')
f(25,33,1,4,'JavaThread::threadObj() const')
f(25,34,1,3,'Unsafe_Park')
f(26,34,1,4,'JavaThread::is_interrupted(bool)')
f(25,35,17,3,'[unknown]')
f(26,35,16,3,'/usr/lib/x86_64-linux-gnu/libc.so.6')
f(27,35,16,5,'entry_SYSCALL_64_after_hwframe')
f(28,35,16,5,'do_syscall_64')
f(29,36,14,5,'__x64_sys_futex')
f(30,36,14,5,'do_futex')
f(31,36,14,5,'futex_wait')
f(32,36,1,5,'__get_user_nocheck_4')
f(32,37,12,5,'futex_wait_queue_me')
f(33,37,1,5,'rcu_all_qs')
f(33,38,11,5,'schedule')
f(34,38,11,5,'__schedule')
f(35,39,10,5,'finish_task_switch.isra.0')
f(32,49,1,5,'hash_futex')
f(29,50,1,5,'syscall_exit_to_user_mode')
f(30,50,1,5,'exit_to_user_mode_prepare')
f(31,50,1,5,'exit_to_user_mode_loop')
f(32,50,1,5,'__rseq_handle_notify_resume')
f(33,50,1,5,'__put_user_nocheck_8')
f(26,51,1,3,'pthread_mutex_trylock')
f(25,52,1,4,'java_lang_Thread::set_thread_status(oopDesc*, JavaThreadStatus)')
f(21,53,1,2,'kyo/concurrent/scheduler/IOPromise$$anon$1.<init>',1,0,0)
f(22,53,1,2,'java/util/concurrent/locks/AbstractQueuedSynchronizer.<init>',1,0,0)
f(23,53,1,2,'java/util/concurrent/locks/AbstractOwnableSynchronizer.<init>',1,0,0)
f(16,54,1,1,'kyo/concurrent/fibers$Fibers.forkFiber')
f(17,54,1,1,'kyo/concurrent/fibers$Fibers.kyo$concurrent$fibers$Fibers$$_$transformLoop$2')
f(18,54,1,1,'kyo/concurrent/fibers$Fibers$$anon$33.<init>')
f(19,54,1,4,'OptoRuntime::new_instance_C(Klass*, JavaThread*)')
f(20,54,1,4,'AccessInternal::PostRuntimeDispatch<G1BarrierSet::AccessBarrier<598116ul, G1BarrierSet>, (AccessInternal::BarrierType)2, 598116ul>::oop_access_barrier(void*)')
f(4,55,1,1,'kyo/concurrent/scheduler/Coordinator$$$Lambda$49.0x0000000800d1baf0.run')
f(5,55,1,1,'kyo/concurrent/scheduler/Coordinator$.$init$$$anonfun$1')
f(6,55,1,1,'kyo/concurrent/scheduler/Coordinator$.update')
f(7,55,1,1,'java/lang/Thread.sleep')
f(8,55,1,3,'[unknown]')
f(9,55,1,3,'/usr/lib/x86_64-linux-gnu/libc.so.6')
f(10,55,1,5,'entry_SYSCALL_64_after_hwframe')
f(11,55,1,5,'do_syscall_64')
f(12,55,1,5,'__x64_sys_futex')
f(13,55,1,5,'do_futex')
f(14,55,1,5,'futex_wait')
f(15,55,1,5,'futex_wait_queue_me')
f(16,55,1,5,'schedule')
f(17,55,1,5,'__schedule')
f(18,55,1,5,'finish_task_switch.isra.0')
f(4,56,373,1,'kyo/concurrent/scheduler/Scheduler$$$Lambda$52.0x0000000800d22ac0.run')
f(5,56,373,1,'kyo/concurrent/scheduler/Scheduler$.startWorkers$$anonfun$1')
f(6,56,373,1,'kyo/concurrent/scheduler/Worker.runWorker')
f(7,61,99,1,'kyo/concurrent/scheduler/IOTask.run',14,0,0)
f(8,61,14,1,'kyo/concurrent/scheduler/IOTask.curr_$eq',4,0,0)
f(8,75,55,2,'kyo/concurrent/scheduler/IOTask.eval',28,0,0)
f(9,99,6,2,'kyo/bench/DeepBindBench$$anon$1.apply',6,0,0)
f(10,99,6,2,'kyo/bench/DeepBindBench$$anon$1.apply',6,0,0)
f(11,100,5,2,'kyo/bench/DeepBindBench.kyo$bench$DeepBindBench$$_$loop$1',5,0,0)
f(9,105,1,1,'kyo/concurrent/scheduler/IOTask.finalize$1')
f(9,106,24,1,'kyo/concurrent/scheduler/IOTask.loop$8')
f(10,106,24,1,'kyo/concurrent/scheduler/IOPromise.kyo$concurrent$scheduler$IOPromise$$inline$complete')
f(11,106,24,1,'kyo/concurrent/scheduler/IOPromise.complete')
f(12,106,24,1,'kyo/concurrent/scheduler/IOPromise$Pending.flush')
f(13,106,24,1,'kyo/concurrent/scheduler/IOPromise$Pending.loop$7')
f(14,106,24,1,'kyo/concurrent/scheduler/IOPromise$Pending$$anon$3.run')
f(15,106,24,1,'kyo/concurrent/scheduler/IOPromise$$anon$1.apply')
f(16,106,24,1,'kyo/concurrent/scheduler/IOPromise$$anon$1.apply')
f(17,106,24,1,'java/util/concurrent/locks/AbstractQueuedSynchronizer.releaseShared')
f(18,106,24,1,'java/util/concurrent/locks/AbstractQueuedSynchronizer.signalNext')
f(19,106,24,1,'java/util/concurrent/locks/LockSupport.unpark')
f(20,106,24,1,'jdk/internal/misc/Unsafe.unpark')
f(21,108,1,4,'ThreadsListHandle::cv_internal_thread_to_JavaThread(_jobject*, JavaThread**, oopDesc**)')
f(21,109,1,3,'Unsafe_Unpark')
f(22,109,1,3,'pthread_mutex_lock')
f(21,110,20,3,'pthread_cond_signal')
f(22,110,20,5,'entry_SYSCALL_64_after_hwframe')
f(23,110,20,5,'do_syscall_64')
f(24,110,20,5,'__x64_sys_futex')
f(25,110,19,5,'do_futex')
f(26,110,19,5,'futex_wake')
f(27,111,1,5,'get_futex_key')
f(27,112,17,5,'wake_up_q')
f(28,112,17,5,'_raw_spin_unlock_irqrestore')
f(25,129,1,5,'futex_wake')
f(8,130,30,2,'scala/runtime/BoxesRunTime.equals',10,0,0)
f(9,130,30,2,'scala/runtime/BoxesRunTime.equals2',10,0,0)
f(7,160,244,1,'kyo/concurrent/scheduler/Queue.poll',72,0,0)
f(8,172,1,1,'java/lang/invoke/Invokers$Holder.linkToTargetMethod')
f(9,172,1,1,'java/lang/invoke/DirectMethodHandle$Holder.newInvokeSpecial')
f(8,173,231,1,'kyo/concurrent/scheduler/Queue.modify',61,0,0)
f(9,191,1,1,'java/util/concurrent/atomic/AtomicBoolean.compareAndSet')
f(9,192,212,1,'kyo/concurrent/scheduler/Queue$$Lambda$55.0x0000000800d46c78.apply',61,0,0)
f(10,212,192,1,'kyo/concurrent/scheduler/Queue.poll$$anonfun$1',55,0,0)
f(11,251,107,1,'kyo/concurrent/scheduler/Queue.isEmpty',30,0,0)
f(12,357,1,1,'kyo/concurrent/scheduler/Queue.items')
f(11,358,46,2,'scala/collection/mutable/PriorityQueue.dequeue',25,0,0)
f(12,382,1,4,'OptoRuntime::new_instance_C(Klass*, JavaThread*)')
f(13,382,1,4,'InstanceKlass::allocate_instance(JavaThread*)')
f(14,382,1,4,'MemAllocator::allocate() const')
f(15,382,1,4,'MemAllocator::allocate_inside_tlab_slow(MemAllocator::Allocation&) const')
f(16,382,1,4,'G1Allocator::unsafe_max_tlab_alloc()')
f(12,383,21,2,'scala/collection/mutable/PriorityQueue.scala$collection$mutable$PriorityQueue$$resarr',10,0,0)
f(7,404,24,1,'kyo/concurrent/scheduler/Scheduler$.idle')
f(8,404,24,1,'kyo/concurrent/scheduler/Worker.park')
f(9,404,24,1,'java/util/concurrent/locks/LockSupport.parkNanos')
f(10,404,24,1,'jdk/internal/misc/Unsafe.park')
f(11,405,4,3,'Unsafe_Park')
f(12,405,1,3,'/usr/lib/x86_64-linux-gnu/libc.so.6')
f(13,405,1,5,'entry_SYSCALL_64_after_hwframe')
f(14,405,1,5,'do_syscall_64')
f(15,405,1,5,'__x64_sys_futex')
f(16,405,1,5,'do_futex')
f(17,405,1,5,'futex_wake')
f(18,405,1,5,'hash_futex')
f(12,406,2,4,'Parker::park(bool, long)')
f(13,407,1,4,'AccessInternal::PostRuntimeDispatch<G1BarrierSet::AccessBarrier<544868ul, G1BarrierSet>, (AccessInternal::BarrierType)2, 544868ul>::oop_access_barrier(void*)')
f(12,408,1,3,'clock_gettime')
f(11,409,19,3,'[unknown]')
f(12,409,19,3,'/usr/lib/x86_64-linux-gnu/libc.so.6')
f(13,411,17,5,'entry_SYSCALL_64_after_hwframe')
f(14,411,17,5,'do_syscall_64')
f(15,411,15,5,'__x64_sys_futex')
f(16,412,14,5,'do_futex')
f(17,413,13,5,'futex_wait')
f(18,414,12,5,'futex_wait_queue_me')
f(19,414,1,5,'rcu_all_qs')
f(19,415,11,5,'schedule')
f(20,415,11,5,'__schedule')
f(21,415,11,5,'finish_task_switch.isra.0')
f(15,426,1,5,'syscall_enter_from_user_mode')
f(15,427,1,5,'syscall_exit_to_user_mode')
f(16,427,1,5,'exit_to_user_mode_prepare')
f(17,427,1,5,'exit_to_user_mode_loop')
f(18,427,1,5,'__rseq_handle_notify_resume')
f(7,428,1,1,'kyo/concurrent/scheduler/Scheduler$.steal')
f(8,428,1,2,'kyo/concurrent/scheduler/Scheduler$.randomWorker',1,0,0)
f(9,428,1,2,'java/util/Random.nextInt',1,0,0)
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" : 16906.439474928342,
"scoreError" : 505.1459015334014,
"scoreConfidence" : [
16401.29357339494,
17411.585376461742
],
"scorePercentiles" : {
"0.0" : 16709.003541420858,
"50.0" : 16957.416351087333,
"90.0" : 17021.280799328466,
"95.0" : 17021.280799328466,
"99.0" : 17021.280799328466,
"99.9" : 17021.280799328466,
"99.99" : 17021.280799328466,
"99.999" : 17021.280799328466,
"99.9999" : 17021.280799328466,
"100.0" : 17021.280799328466
},
"scoreUnit" : "ops/s",
"rawData" : [
[
17004.618945236813,
16839.877737568244,
17021.280799328466,
16957.416351087333,
16709.003541420858
]
]
},
"secondaryMetrics" : {
}
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment