Skip to content

Instantly share code, notes, and snippets.

@fwbrasil
Created June 12, 2023 03:13
Show Gist options
  • Save fwbrasil/d33bbb4faec48c2c4075d481984088d6 to your computer and use it in GitHub Desktop.
Save fwbrasil/d33bbb4faec48c2c4075d481984088d6 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: 496px}
</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(31);
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,5427,3,'all')
f(1,0,5426,1,'java/lang/Thread.run')
f(2,0,5426,1,'java/util/concurrent/ThreadPoolExecutor$Worker.run')
f(3,0,5426,1,'java/util/concurrent/ThreadPoolExecutor.runWorker')
f(4,0,770,1,'java/util/concurrent/FutureTask.run')
f(5,0,770,1,'java/util/concurrent/Executors$RunnableAdapter.call')
f(6,0,770,1,'java/util/concurrent/FutureTask.run')
f(7,0,770,1,'org/openjdk/jmh/runner/BenchmarkHandler$BenchmarkTask.call')
f(8,0,770,1,'org/openjdk/jmh/runner/BenchmarkHandler$BenchmarkTask.call')
f(9,0,770,1,'java/lang/reflect/Method.invoke')
f(10,0,770,1,'jdk/internal/reflect/DelegatingMethodAccessorImpl.invoke')
f(11,0,770,1,'jdk/internal/reflect/NativeMethodAccessorImpl.invoke')
f(12,0,770,1,'jdk/internal/reflect/NativeMethodAccessorImpl.invoke0')
f(13,0,770,1,'kyo/bench/jmh_generated/DeepBindBench_forkKyo_jmhTest.forkKyo_Throughput')
f(14,0,769,1,'kyo/bench/jmh_generated/DeepBindBench_forkKyo_jmhTest.forkKyo_thrpt_jmhStub')
f(15,0,769,1,'kyo/bench/Bench.forkKyo')
f(16,0,53,1,'java/lang/invoke/Invokers$Holder.linkToTargetMethod')
f(17,0,53,1,'java/lang/invoke/DirectMethodHandle$Holder.newInvokeSpecial')
f(18,0,53,1,'java/lang/invoke/DirectMethodHandle.allocateInstance')
f(19,0,53,2,'kyo.bench.Bench$$Lambda$37+0x0000000800c3e0d0')
f(16,53,52,1,'kyo/bench/Bench.kyo$bench$Bench$$_$_$transformLoop$1')
f(17,53,52,2,'kyo.bench.Bench$$anon$1')
f(16,105,503,1,'kyo/bench/Bench.runLoop$2')
f(17,105,225,1,'kyo/bench/Bench$$anon$1.apply')
f(18,105,19,1,'kyo/bench/Bench.kyo$bench$Bench$$_$_$transformLoop$1')
f(19,105,19,1,'kyo/bench/Bench$$Lambda$39.0x0000000800c82330.apply')
f(20,105,19,1,'kyo/bench/Bench.$anonfun$2')
f(21,105,19,1,'kyo/concurrent/fibers$Fiber.block')
f(22,105,19,2,'kyo.concurrent.fibers$Fiber$$anon$10')
f(18,124,206,1,'kyo/concurrent/fibers$Fibers$$anon$33.apply')
f(19,124,206,1,'kyo/concurrent/fibers$Fibers.kyo$concurrent$fibers$Fibers$$_$transformLoop$2')
f(20,124,206,1,'kyo/concurrent/fibers$Fibers$$Lambda$38.0x0000000800c3f828.apply')
f(21,124,206,1,'kyo/concurrent/fibers$Fibers.$anonfun$4')
f(22,124,17,2,'kyo.concurrent.fibers$Fibers$$anon$32')
f(22,141,146,2,'kyo.concurrent.scheduler.IOTask')
f(22,287,33,1,'kyo/concurrent/fibers$Fiber$.promise')
f(23,287,33,2,'kyo.concurrent.fibers$Fiber')
f(22,320,10,1,'kyo/concurrent/scheduler/Scheduler$.schedule')
f(23,320,10,1,'kyo/concurrent/scheduler/Scheduler$.submit')
f(24,320,10,1,'kyo/concurrent/scheduler/Worker.enqueue')
f(25,320,10,1,'kyo/concurrent/scheduler/Queue.offer')
f(26,320,10,1,'java/lang/invoke/Invokers$Holder.linkToTargetMethod')
f(27,320,10,1,'java/lang/invoke/DirectMethodHandle$Holder.newInvokeSpecial')
f(28,320,10,1,'java/lang/invoke/DirectMethodHandle.allocateInstance')
f(29,320,10,1,'jdk/internal/misc/Unsafe.allocateInstance')
f(30,320,10,2,'kyo.concurrent.scheduler.Queue$$Lambda$54+0x0000000800d46000')
f(17,330,278,1,'kyo/concurrent/fibers$Fiber$$anon$10.apply')
f(18,330,278,1,'kyo/concurrent/fibers$Fiber$$anon$10.apply')
f(19,330,278,1,'kyo/concurrent/scheduler/IOPromise.block')
f(20,330,278,1,'kyo/concurrent/scheduler/IOPromise.loop$4')
f(21,330,126,1,'java/util/concurrent/locks/AbstractQueuedSynchronizer.acquireSharedInterruptibly')
f(22,330,126,1,'java/util/concurrent/locks/AbstractQueuedSynchronizer.acquire')
f(23,330,46,2,'java.util.concurrent.locks.AbstractQueuedSynchronizer$SharedNode')
f(23,376,80,1,'java/util/concurrent/locks/AbstractQueuedSynchronizer.tryInitializeHead')
f(24,376,80,2,'java.util.concurrent.locks.AbstractQueuedSynchronizer$ExclusiveNode')
f(21,456,73,2,'kyo.concurrent.scheduler.IOPromise$$anon$1')
f(21,529,79,1,'kyo/concurrent/scheduler/IOPromise.loop$5')
f(22,529,79,1,'kyo/concurrent/scheduler/IOPromise$Pending.add')
f(23,529,79,2,'kyo.concurrent.scheduler.IOPromise$Pending$$anon$3')
f(16,608,161,1,'kyo/concurrent/fibers$Fibers.forkFiber')
f(17,608,88,1,'java/lang/invoke/Invokers$Holder.linkToTargetMethod')
f(18,608,88,1,'java/lang/invoke/DirectMethodHandle$Holder.newInvokeSpecial')
f(19,608,88,1,'java/lang/invoke/DirectMethodHandle.allocateInstance')
f(20,608,88,2,'kyo.concurrent.fibers$Fibers$$Lambda$38+0x0000000800c3f828')
f(17,696,57,1,'kyo/concurrent/fibers$Fibers.kyo$concurrent$fibers$Fibers$$_$transformLoop$2')
f(18,696,57,2,'kyo.concurrent.fibers$Fibers$$anon$33')
f(17,753,16,1,'kyo/locals$Locals$.save')
f(18,753,16,2,'kyo.locals$Locals$$anon$3')
f(14,769,1,1,'org/openjdk/jmh/results/BenchmarkTaskResult.add')
f(15,769,1,1,'java/util/ArrayList.add')
f(16,769,1,1,'java/util/ArrayList.add')
f(17,769,1,1,'java/util/ArrayList.grow')
f(18,769,1,1,'java/util/ArrayList.grow')
f(19,769,1,2,'java.lang.Object[]')
f(4,770,3,1,'kyo/concurrent/scheduler/Coordinator$$$Lambda$49.0x0000000800d1baf0.run')
f(5,770,3,1,'kyo/concurrent/scheduler/Coordinator$.$init$$$anonfun$1')
f(6,770,3,1,'kyo/concurrent/scheduler/Coordinator$.update')
f(7,770,3,1,'java/util/concurrent/ThreadPoolExecutor.execute')
f(8,770,3,1,'java/util/concurrent/SynchronousQueue.offer')
f(9,770,3,1,'java/util/concurrent/SynchronousQueue$TransferStack.transfer')
f(10,770,3,1,'java/util/concurrent/SynchronousQueue$TransferStack.snode')
f(11,770,3,2,'java.util.concurrent.SynchronousQueue$TransferStack$SNode')
f(4,773,3,1,'kyo/concurrent/scheduler/Coordinator$$$Lambda$50.0x0000000800d1bd18.run')
f(5,773,3,1,'kyo/concurrent/scheduler/Coordinator$.$init$$$anonfun$2')
f(6,773,3,1,'kyo/concurrent/scheduler/Scheduler$.cycle')
f(7,773,3,1,'java/lang/invoke/Invokers$Holder.linkToTargetMethod')
f(8,773,3,1,'java/lang/invoke/DirectMethodHandle$Holder.newInvokeSpecial')
f(9,773,3,1,'java/lang/invoke/DirectMethodHandle.allocateInstance')
f(10,773,3,1,'jdk/internal/misc/Unsafe.allocateInstance')
f(11,773,3,2,'kyo.concurrent.scheduler.Scheduler$$$Lambda$58+0x0000000800d4c000')
f(4,776,4650,1,'kyo/concurrent/scheduler/Scheduler$$$Lambda$52.0x0000000800d22ac0.run')
f(5,776,4650,1,'kyo/concurrent/scheduler/Scheduler$.startWorkers$$anonfun$1')
f(6,776,4650,1,'kyo/concurrent/scheduler/Worker.runWorker')
f(7,776,4643,1,'kyo/concurrent/scheduler/IOTask.run')
f(8,776,4643,1,'kyo/concurrent/scheduler/IOTask.eval')
f(9,776,4600,1,'kyo/bench/DeepBindBench$$anon$1.apply')
f(10,776,4600,1,'kyo/bench/DeepBindBench$$anon$1.apply')
f(11,776,4600,1,'kyo/bench/DeepBindBench.kyo$bench$DeepBindBench$$_$loop$1')
f(12,776,4600,2,'kyo.bench.DeepBindBench$$anon$1')
f(9,5376,43,1,'kyo/concurrent/fibers$Fibers$$anon$32.apply')
f(10,5376,43,1,'kyo/concurrent/fibers$Fibers$$anon$32.apply')
f(11,5376,43,1,'kyo/bench/Bench$$Lambda$37.0x0000000800c3e0d0.apply')
f(12,5376,43,1,'kyo/bench/Bench.$anonfun$1')
f(13,5376,43,1,'kyo/bench/Bench.kyoBenchFiber')
f(14,5376,43,1,'kyo/bench/DeepBindBench.kyoBench')
f(15,5376,43,1,'kyo/bench/DeepBindBench.kyo$bench$DeepBindBench$$_$loop$1')
f(16,5376,43,2,'kyo.bench.DeepBindBench$$anon$1')
f(7,5419,7,1,'kyo/concurrent/scheduler/Queue.poll')
f(8,5419,7,1,'java/lang/invoke/Invokers$Holder.linkToTargetMethod')
f(9,5419,7,1,'java/lang/invoke/DirectMethodHandle$Holder.newInvokeSpecial')
f(10,5419,7,1,'java/lang/invoke/DirectMethodHandle.allocateInstance')
f(11,5419,7,1,'jdk/internal/misc/Unsafe.allocateInstance')
f(12,5419,7,2,'kyo.concurrent.scheduler.Queue$$Lambda$55+0x0000000800d46a48')
f(1,5426,1,1,'org/openjdk/jmh/runner/ForkedMain.main')
f(2,5426,1,1,'org/openjdk/jmh/runner/ForkedRunner.run')
f(3,5426,1,1,'org/openjdk/jmh/runner/BaseRunner.runBenchmarksForked')
f(4,5426,1,1,'org/openjdk/jmh/runner/BaseRunner.doSingle')
f(5,5426,1,1,'org/openjdk/jmh/runner/BaseRunner.runBenchmark')
f(6,5426,1,1,'org/openjdk/jmh/runner/BaseRunner.runBenchmark')
f(7,5426,1,1,'org/openjdk/jmh/runner/BenchmarkHandler.runIteration')
f(8,5426,1,1,'org/openjdk/jmh/runner/InfraControl.awaitWarmdownReady')
f(9,5426,1,1,'org/openjdk/jmh/runner/InfraControlL2.awaitWarmdownReady')
f(10,5426,1,1,'java/util/concurrent/CountDownLatch.await')
f(11,5426,1,1,'java/util/concurrent/locks/AbstractQueuedSynchronizer.acquireSharedInterruptibly')
f(12,5426,1,1,'java/util/concurrent/locks/AbstractQueuedSynchronizer.acquire')
f(13,5426,1,2,'java.util.concurrent.locks.AbstractQueuedSynchronizer$SharedNode')
search();
</script></body></html>
<!DOCTYPE html>
<html lang='en'>
<head>
<meta charset='utf-8'>
<style>
body {margin: 0; padding: 10px; background-color: #ffffff}
h1 {margin: 5px 0 0 0; font-size: 18px; font-weight: normal; text-align: center}
header {margin: -24px 0 5px 0; line-height: 24px}
button {font: 12px sans-serif; cursor: pointer}
p {margin: 5px 0 5px 0}
a {color: #0366d6}
#hl {position: absolute; display: none; overflow: hidden; white-space: nowrap; pointer-events: none; background-color: #ffffe0; outline: 1px solid #ffc000; height: 15px}
#hl span {padding: 0 3px 0 3px}
#status {overflow: hidden; white-space: nowrap}
#match {overflow: hidden; white-space: nowrap; display: none; float: right; text-align: right}
#reset {cursor: pointer}
#canvas {width: 100%; height: 752px}
</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(47);
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,92,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,6,4,'C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)')
f(8,0,6,4,'Compile::Compile(ciEnv*, ciMethod*, int, bool, bool, bool, bool, bool, DirectiveSet*)')
f(9,0,6,4,'Compile::Code_Gen()')
f(10,0,1,4,'Matcher::match()')
f(11,0,1,4,'Matcher::find_shared(Node*)')
f(10,1,4,4,'PhaseChaitin::Register_Allocate()')
f(11,1,1,4,'PhaseChaitin::build_ifg_physical(ResourceArea*)')
f(12,1,1,4,'PhaseChaitin::add_input_to_liveout(Block*, Node*, IndexSet*, double, PhaseChaitin::Pressure&, PhaseChaitin::Pressure&)')
f(13,1,1,4,'compareAndSwapNNode::rule() const')
f(11,2,1,4,'PhaseChaitin::gather_lrg_masks(bool)')
f(12,2,1,4,'MachNode::bottom_type() const')
f(11,3,1,4,'PhaseChaitin::post_allocate_copy_removal()')
f(12,3,1,4,'PhaseChaitin::elide_copy(Node*, int, Block*, Node_List&, Node_List&, bool)')
f(13,3,1,4,'PhaseChaitin::use_prior_register(Node*, unsigned int, Node*, Block*, Node_List&, Node_List&)')
f(11,4,1,4,'RegMask::is_UP() const')
f(10,5,1,4,'PhaseOutput::Output()')
f(11,5,1,4,'PhaseOutput::init_scratch_buffer_blob(int)')
f(12,5,1,4,'BufferBlob::create(char const*, int)')
f(13,5,1,4,'MemoryService::track_memory_pool_usage(MemoryPool*)')
f(7,6,1,4,'Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)')
f(8,6,1,4,'Compilation::Compilation(AbstractCompiler*, ciEnv*, ciMethod*, int, BufferBlob*, bool, DirectiveSet*)')
f(9,6,1,4,'Compilation::compile_method()')
f(10,6,1,4,'Compilation::compile_java_method()')
f(11,6,1,4,'Compilation::build_hir() [clone .part.0]')
f(12,6,1,4,'IR::IR(Compilation*, ciMethod*, int)')
f(13,6,1,4,'IRScope::IRScope(Compilation*, IRScope*, int, ciMethod*, int, bool)')
f(14,6,1,4,'GraphBuilder::GraphBuilder(Compilation*, IRScope*)')
f(15,6,1,4,'GraphBuilder::iterate_all_blocks(bool)')
f(16,6,1,4,'GraphBuilder::iterate_bytecodes_for_block(int)')
f(17,6,1,4,'GraphBuilder::invoke(Bytecodes::Code)')
f(18,6,1,4,'GraphBuilder::try_inline(ciMethod*, bool, bool, Bytecodes::Code, Instruction*)')
f(19,6,1,4,'GraphBuilder::try_inline_full(ciMethod*, bool, bool, Bytecodes::Code, Instruction*)')
f(20,6,1,4,'GraphBuilder::iterate_all_blocks(bool)')
f(21,6,1,4,'GraphBuilder::iterate_bytecodes_for_block(int)')
f(22,6,1,4,'GraphBuilder::invoke(Bytecodes::Code)')
f(23,6,1,4,'GraphBuilder::try_inline(ciMethod*, bool, bool, Bytecodes::Code, Instruction*)')
f(24,6,1,4,'GraphBuilder::try_inline_full(ciMethod*, bool, bool, Bytecodes::Code, Instruction*)')
f(25,6,1,4,'GraphBuilder::iterate_all_blocks(bool)')
f(26,6,1,4,'GraphBuilder::iterate_bytecodes_for_block(int)')
f(27,6,1,4,'GraphBuilder::invoke(Bytecodes::Code)')
f(28,6,1,4,'GraphBuilder::try_inline(ciMethod*, bool, bool, Bytecodes::Code, Instruction*)')
f(29,6,1,4,'GraphBuilder::try_inline_full(ciMethod*, bool, bool, Bytecodes::Code, Instruction*)')
f(30,6,1,4,'GraphBuilder::iterate_all_blocks(bool)')
f(31,6,1,4,'GraphBuilder::iterate_bytecodes_for_block(int)')
f(32,6,1,4,'GraphBuilder::invoke(Bytecodes::Code)')
f(33,6,1,4,'GraphBuilder::try_inline(ciMethod*, bool, bool, Bytecodes::Code, Instruction*)')
f(34,6,1,4,'GraphBuilder::try_method_handle_inline(ciMethod*, bool)')
f(35,6,1,4,'GraphBuilder::try_inline(ciMethod*, bool, bool, Bytecodes::Code, Instruction*)')
f(36,6,1,4,'GraphBuilder::try_inline_full(ciMethod*, bool, bool, Bytecodes::Code, Instruction*)')
f(37,6,1,4,'GraphBuilder::iterate_all_blocks(bool)')
f(38,6,1,4,'GraphBuilder::iterate_bytecodes_for_block(int)')
f(39,6,1,4,'GraphBuilder::invoke(Bytecodes::Code)')
f(40,6,1,4,'ciBytecodeStream::get_method(bool&, ciSignature**)')
f(41,6,1,4,'ciEnv::get_method_by_index_impl(constantPoolHandle const&, int, Bytecodes::Code, ciInstanceKlass*)')
f(42,6,1,4,'ciObjectFactory::get_metadata(Metadata*)')
f(43,6,1,4,'ciObjectFactory::create_new_metadata(Metadata*)')
f(44,6,1,4,'ciMethod::ciMethod(methodHandle const&, ciInstanceKlass*)')
f(45,6,1,4,'ciSignature::ciSignature(ciKlass*, constantPoolHandle const&, ciSymbol*)')
f(46,6,1,3,'pthread_mutex_unlock')
f(1,7,85,1,'java/lang/Thread.run')
f(2,7,85,1,'java/util/concurrent/ThreadPoolExecutor$Worker.run')
f(3,7,85,1,'java/util/concurrent/ThreadPoolExecutor.runWorker')
f(4,7,10,1,'java/util/concurrent/FutureTask.run')
f(5,7,10,1,'java/util/concurrent/Executors$RunnableAdapter.call')
f(6,7,10,1,'java/util/concurrent/FutureTask.run')
f(7,7,10,1,'org/openjdk/jmh/runner/BenchmarkHandler$BenchmarkTask.call')
f(8,7,10,1,'org/openjdk/jmh/runner/BenchmarkHandler$BenchmarkTask.call')
f(9,7,10,1,'java/lang/reflect/Method.invoke')
f(10,7,10,1,'jdk/internal/reflect/DelegatingMethodAccessorImpl.invoke')
f(11,7,10,1,'jdk/internal/reflect/NativeMethodAccessorImpl.invoke')
f(12,7,10,1,'jdk/internal/reflect/NativeMethodAccessorImpl.invoke0')
f(13,7,10,1,'kyo/bench/jmh_generated/DeepBindBench_forkKyo_jmhTest.forkKyo_Throughput')
f(14,7,10,1,'kyo/bench/jmh_generated/DeepBindBench_forkKyo_jmhTest.forkKyo_thrpt_jmhStub')
f(15,7,10,1,'kyo/bench/Bench.forkKyo')
f(16,7,1,2,'kyo/bench/Bench.kyo$bench$Bench$$_$_$transformLoop$1',1,0,0)
f(16,8,9,1,'kyo/bench/Bench.runLoop$2')
f(17,8,3,1,'kyo/bench/Bench$$anon$1.apply')
f(18,8,3,1,'kyo/concurrent/fibers$Fibers$$anon$33.apply')
f(19,8,3,1,'kyo/concurrent/fibers$Fibers.kyo$concurrent$fibers$Fibers$$_$transformLoop$2')
f(20,8,3,1,'kyo/concurrent/fibers$Fibers$$Lambda$38.0x0000000800c3f828.apply')
f(21,8,3,1,'kyo/concurrent/fibers$Fibers.$anonfun$4')
f(22,8,3,1,'kyo/concurrent/scheduler/Scheduler$.schedule')
f(23,8,3,1,'kyo/concurrent/scheduler/Scheduler$.submit')
f(24,8,3,1,'kyo/concurrent/scheduler/Worker.enqueue')
f(25,8,3,1,'java/util/concurrent/locks/LockSupport.unpark')
f(26,8,3,1,'jdk/internal/misc/Unsafe.unpark')
f(27,8,3,3,'pthread_cond_signal')
f(28,8,3,5,'entry_SYSCALL_64_after_hwframe')
f(29,8,3,5,'do_syscall_64')
f(30,8,3,5,'__x64_sys_futex')
f(31,8,3,5,'do_futex')
f(32,8,3,5,'futex_wake')
f(33,9,2,5,'wake_up_q')
f(34,9,2,5,'_raw_spin_unlock_irqrestore')
f(17,11,6,1,'kyo/concurrent/fibers$Fiber$$anon$10.apply')
f(18,11,6,1,'kyo/concurrent/fibers$Fiber$$anon$10.apply')
f(19,11,6,1,'kyo/concurrent/scheduler/IOPromise.block')
f(20,11,6,1,'kyo/concurrent/scheduler/IOPromise.loop$4')
f(21,11,6,1,'java/util/concurrent/locks/AbstractQueuedSynchronizer.acquireSharedInterruptibly')
f(22,11,6,1,'java/util/concurrent/locks/AbstractQueuedSynchronizer.acquire')
f(23,12,5,1,'java/util/concurrent/locks/LockSupport.park')
f(24,12,5,1,'jdk/internal/misc/Unsafe.park')
f(25,12,1,3,'Unsafe_Park')
f(26,12,1,3,'/usr/lib/x86_64-linux-gnu/libc.so.6')
f(27,12,1,5,'entry_SYSCALL_64_after_hwframe')
f(28,12,1,5,'do_syscall_64')
f(29,12,1,5,'__x64_sys_futex')
f(30,12,1,5,'do_futex')
f(31,12,1,5,'get_futex_key')
f(25,13,4,3,'[unknown]')
f(26,13,3,3,'/usr/lib/x86_64-linux-gnu/libc.so.6')
f(27,13,3,5,'entry_SYSCALL_64_after_hwframe')
f(28,13,3,5,'do_syscall_64')
f(29,13,3,5,'__x64_sys_futex')
f(30,13,3,5,'do_futex')
f(31,13,3,5,'futex_wait')
f(32,13,3,5,'futex_wait_queue_me')
f(33,13,3,5,'schedule')
f(34,13,3,5,'__schedule')
f(35,13,3,5,'finish_task_switch.isra.0')
f(26,16,1,3,'pthread_mutex_trylock')
f(4,17,75,1,'kyo/concurrent/scheduler/Scheduler$$$Lambda$52.0x0000000800d22ac0.run')
f(5,17,75,1,'kyo/concurrent/scheduler/Scheduler$.startWorkers$$anonfun$1')
f(6,17,75,1,'kyo/concurrent/scheduler/Worker.runWorker')
f(7,17,71,1,'kyo/concurrent/scheduler/IOTask.run')
f(8,17,71,2,'kyo/concurrent/scheduler/IOTask.eval',69,0,0)
f(9,71,1,4,'OptoRuntime::new_instance_C(Klass*, JavaThread*)')
f(10,71,1,4,'InstanceKlass::allocate_instance(JavaThread*)')
f(11,71,1,4,'MemAllocator::allocate() const')
f(12,71,1,4,'MemAllocator::allocate_inside_tlab_slow(MemAllocator::Allocation&) const')
f(13,71,1,4,'G1CollectedHeap::allocate_new_tlab(unsigned long, unsigned long, unsigned long*)')
f(14,71,1,4,'G1CollectedHeap::attempt_allocation_slow(unsigned long)')
f(15,71,1,4,'G1AllocRegion::new_alloc_region_and_allocate(unsigned long, bool)')
f(16,71,1,4,'G1CollectedHeap::new_mutator_alloc_region(unsigned long, bool, unsigned int)')
f(17,71,1,4,'HeapRegionManager::allocate_free_region(HeapRegionType, unsigned int)')
f(9,72,13,2,'kyo/bench/DeepBindBench$$anon$1.apply',13,0,0)
f(10,72,13,2,'kyo/bench/DeepBindBench$$anon$1.apply',13,0,0)
f(11,76,9,2,'kyo/bench/DeepBindBench.kyo$bench$DeepBindBench$$_$loop$1',9,0,0)
f(9,85,2,2,'kyo/concurrent/scheduler/IOTask$.kyo$concurrent$scheduler$IOTask$$$avoidUnstableIf',2,0,0)
f(9,87,1,1,'kyo/concurrent/scheduler/IOTask.loop$8')
f(10,87,1,1,'kyo/concurrent/scheduler/IOPromise.kyo$concurrent$scheduler$IOPromise$$inline$complete')
f(11,87,1,1,'kyo/concurrent/scheduler/IOPromise.complete')
f(12,87,1,1,'kyo/concurrent/scheduler/IOPromise$Pending.flush')
f(13,87,1,1,'kyo/concurrent/scheduler/IOPromise$Pending.loop$7')
f(14,87,1,1,'kyo/concurrent/scheduler/IOPromise$Pending$$anon$3.run')
f(15,87,1,1,'kyo/concurrent/scheduler/IOPromise$$anon$1.apply')
f(16,87,1,1,'kyo/concurrent/scheduler/IOPromise$$anon$1.apply')
f(17,87,1,1,'java/util/concurrent/locks/AbstractQueuedSynchronizer.releaseShared')
f(18,87,1,1,'java/util/concurrent/locks/AbstractQueuedSynchronizer.signalNext')
f(19,87,1,1,'java/util/concurrent/locks/LockSupport.unpark')
f(20,87,1,1,'jdk/internal/misc/Unsafe.unpark')
f(21,87,1,3,'pthread_cond_signal')
f(22,87,1,5,'entry_SYSCALL_64_after_hwframe')
f(23,87,1,5,'do_syscall_64')
f(24,87,1,5,'__x64_sys_futex')
f(25,87,1,5,'do_futex')
f(26,87,1,5,'futex_wake')
f(27,87,1,5,'wake_up_q')
f(28,87,1,5,'_raw_spin_unlock_irqrestore')
f(7,88,1,1,'kyo/concurrent/scheduler/Queue.poll')
f(8,88,1,1,'java/lang/invoke/Invokers$Holder.linkToTargetMethod')
f(9,88,1,1,'java/lang/invoke/DirectMethodHandle$Holder.newInvokeSpecial')
f(10,88,1,1,'java/lang/invoke/DirectMethodHandle.allocateInstance')
f(11,88,1,1,'jdk/internal/misc/Unsafe.allocateInstance')
f(12,88,1,3,'Unsafe_AllocateInstance')
f(13,88,1,4,'InstanceKlass::allocate_instance(JavaThread*)')
f(14,88,1,4,'MemAllocator::allocate() const')
f(15,88,1,4,'MemAllocator::Allocation::check_out_of_memory()')
f(7,89,3,1,'kyo/concurrent/scheduler/Scheduler$.idle')
f(8,89,3,1,'kyo/concurrent/scheduler/Worker.park')
f(9,89,3,1,'java/util/concurrent/locks/LockSupport.parkNanos')
f(10,89,3,1,'jdk/internal/misc/Unsafe.park')
f(11,89,3,3,'[unknown]')
f(12,89,3,3,'/usr/lib/x86_64-linux-gnu/libc.so.6')
f(13,90,2,5,'entry_SYSCALL_64_after_hwframe')
f(14,90,2,5,'do_syscall_64')
f(15,90,2,5,'__x64_sys_futex')
f(16,90,2,5,'do_futex')
f(17,90,2,5,'futex_wait')
f(18,90,2,5,'futex_wait_queue_me')
f(19,90,2,5,'schedule')
f(20,90,2,5,'__schedule')
f(21,90,2,5,'finish_task_switch.isra.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" : 1,
"warmupTime" : "1 s",
"warmupBatchSize" : 1,
"measurementIterations" : 1,
"measurementTime" : "1 s",
"measurementBatchSize" : 1,
"primaryMetric" : {
"score" : 21010.119617651017,
"scoreError" : "NaN",
"scoreConfidence" : [
"NaN",
"NaN"
],
"scorePercentiles" : {
"0.0" : 21010.119617651017,
"50.0" : 21010.119617651017,
"90.0" : 21010.119617651017,
"95.0" : 21010.119617651017,
"99.0" : 21010.119617651017,
"99.9" : 21010.119617651017,
"99.99" : 21010.119617651017,
"99.999" : 21010.119617651017,
"99.9999" : 21010.119617651017,
"100.0" : 21010.119617651017
},
"scoreUnit" : "ops/s",
"rawData" : [
[
21010.119617651017
]
]
},
"secondaryMetrics" : {
}
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment