-
-
Notifications
You must be signed in to change notification settings - Fork 281
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Benchmarks refactoring, run local scalapb without publishing
- Loading branch information
Showing
368 changed files
with
263,328 additions
and
235 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
316 changes: 316 additions & 0 deletions
316
...ench/proxyJava/profile/scalapb.perf.EnumBench.proxyJava-SampleTime/flame-cpu-forward.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,316 @@ | ||
<!DOCTYPE html> | ||
<html lang='en'> | ||
<head> | ||
<meta charset='utf-8'> | ||
<style> | ||
body {margin: 0; padding: 10px 10px 22px 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 {position: fixed; bottom: 0; margin: 0; padding: 2px 3px 2px 3px; outline: 1px solid #ffc000; display: none; overflow: hidden; white-space: nowrap; background-color: #ffffe0} | ||
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 {left: 0} | ||
#match {right: 0} | ||
#reset {cursor: pointer} | ||
#canvas {width: 100%; height: 560px} | ||
</style> | ||
</head> | ||
<body style='font: 12px Verdana, sans-serif'> | ||
<h1>CPU profile</h1> | ||
<header style='text-align: left'><button id='reverse' title='Reverse'>🔻</button> <button id='search' title='Search'>🔍</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='status'></p> | ||
<p id='match'>Matched: <span id='matchval'></span> <span id='reset' title='Clear'>❌</span></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(35); | ||
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 ? 'inline-block' : '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; | ||
status.style.display = 'inline-block'; | ||
return; | ||
} | ||
} | ||
canvas.onmouseout(); | ||
} | ||
|
||
canvas.onmouseout = function() { | ||
hl.style.display = 'none'; | ||
status.style.display = 'none'; | ||
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,498,3,'all') | ||
f(1,0,4,3,'[unknown_Java]') | ||
f(2,0,4,1,'java/lang/Object.<init>()V') | ||
f(1,4,494,1,'java/lang/Thread.run()V') | ||
f(2,4,494,1,'java/lang/Thread.runWith(Ljava/lang/Object;Ljava/lang/Runnable;)V') | ||
f(3,4,494,1,'java/util/concurrent/ThreadPoolExecutor$Worker.run()V') | ||
f(4,4,494,1,'java/util/concurrent/ThreadPoolExecutor.runWorker(Ljava/util/concurrent/ThreadPoolExecutor$Worker;)V') | ||
f(5,4,494,1,'java/util/concurrent/FutureTask.run()V') | ||
f(6,4,494,1,'java/util/concurrent/Executors$RunnableAdapter.call()Ljava/lang/Object;') | ||
f(7,4,494,1,'java/util/concurrent/FutureTask.run()V') | ||
f(8,4,494,1,'org/openjdk/jmh/runner/BenchmarkHandler$BenchmarkTask.call()Ljava/lang/Object;') | ||
f(9,4,494,1,'org/openjdk/jmh/runner/BenchmarkHandler$BenchmarkTask.call()Lorg/openjdk/jmh/results/BenchmarkTaskResult;') | ||
f(10,4,494,1,'java/lang/reflect/Method.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;') | ||
f(11,4,494,1,'jdk/internal/reflect/DirectMethodHandleAccessor.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;') | ||
f(12,4,494,1,'jdk/internal/reflect/DirectMethodHandleAccessor.invokeImpl(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;') | ||
f(13,4,494,1,'java/lang/invoke/LambdaForm$MH.0x00007f6ff002e400.invokeExact_MT(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;') | ||
f(14,4,494,1,'java/lang/invoke/LambdaForm$MH.0x00007f6ff002e000.invoke(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;') | ||
f(15,4,494,1,'java/lang/invoke/DirectMethodHandle$Holder.invokeSpecial(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;') | ||
f(16,4,494,1,'scalapb/perf/jmh_generated/EnumBench_proxyJava_jmhTest.proxyJava_SampleTime(Lorg/openjdk/jmh/runner/InfraControl;Lorg/openjdk/jmh/infra/ThreadParams;)Lorg/openjdk/jmh/results/BenchmarkTaskResult;') | ||
f(17,4,494,1,'scalapb/perf/jmh_generated/EnumBench_proxyJava_jmhTest.proxyJava_sample_jmhStub(Lorg/openjdk/jmh/runner/InfraControl;Lorg/openjdk/jmh/results/RawResults;Lorg/openjdk/jmh/infra/BenchmarkParams;Lorg/openjdk/jmh/infra/IterationParams;Lorg/openjdk/jmh/infra/ThreadParams;Lorg/openjdk/jmh/infra/Blackhole;Lorg/openjdk/jmh/infra/Control;ILorg/openjdk/jmh/util/SampleBuffer;IJILscalapb/perf/jmh_generated/EnumBench_jmhType;)V') | ||
f(18,70,1,3,'[vdso]') | ||
f(18,71,8,3,'clock_gettime') | ||
f(19,73,6,3,'[vdso]') | ||
f(18,79,1,4,'os::javaTimeNanos()') | ||
f(18,80,418,2,'scalapb/perf/ProtobufBenchmark.proxyJava()V',405,0,0) | ||
f(19,110,143,2,'com/google/protobuf/AbstractParser.parseFrom([B)Ljava/lang/Object;',130,0,0) | ||
f(20,110,143,2,'com/google/protobuf/AbstractParser.parseFrom([B)Lcom/google/protobuf/MessageLite;',130,0,0) | ||
f(21,110,143,2,'com/google/protobuf/AbstractParser.parseFrom([BLcom/google/protobuf/ExtensionRegistryLite;)Lcom/google/protobuf/MessageLite;',130,0,0) | ||
f(22,111,142,2,'com/google/protobuf/AbstractParser.parseFrom([BIILcom/google/protobuf/ExtensionRegistryLite;)Lcom/google/protobuf/MessageLite;',129,0,0) | ||
f(23,111,142,2,'com/google/protobuf/AbstractParser.parsePartialFrom([BIILcom/google/protobuf/ExtensionRegistryLite;)Lcom/google/protobuf/MessageLite;',129,0,0) | ||
f(24,111,7,2,'com/google/protobuf/CodedInputStream$ArrayDecoder.checkLastTagWas(I)V',7,0,0) | ||
f(24,118,26,2,'com/google/protobuf/CodedInputStream.newInstance([BII)Lcom/google/protobuf/CodedInputStream;',26,0,0) | ||
f(25,118,26,2,'com/google/protobuf/CodedInputStream.newInstance([BIIZ)Lcom/google/protobuf/CodedInputStream;',26,0,0) | ||
f(26,118,26,2,'com/google/protobuf/CodedInputStream$ArrayDecoder.<init>([BIIZLcom/google/protobuf/CodedInputStream$1;)V',26,0,0) | ||
f(27,118,26,2,'com/google/protobuf/CodedInputStream$ArrayDecoder.<init>([BIIZ)V',26,0,0) | ||
f(28,141,3,2,'com/google/protobuf/CodedInputStream.<init>(Lcom/google/protobuf/CodedInputStream$1;)V',3,0,0) | ||
f(29,141,3,2,'com/google/protobuf/CodedInputStream.<init>()V',3,0,0) | ||
f(24,144,109,2,'scalapb/perf/Protos$Enum$1.parsePartialFrom(Lcom/google/protobuf/CodedInputStream;Lcom/google/protobuf/ExtensionRegistryLite;)Ljava/lang/Object;',96,0,0) | ||
f(25,144,109,2,'scalapb/perf/Protos$Enum$1.parsePartialFrom(Lcom/google/protobuf/CodedInputStream;Lcom/google/protobuf/ExtensionRegistryLite;)Lscalapb/perf/Protos$Enum;',96,0,0) | ||
f(26,144,71,2,'scalapb/perf/Protos$Enum$Builder.mergeFrom(Lcom/google/protobuf/CodedInputStream;Lcom/google/protobuf/ExtensionRegistryLite;)Lscalapb/perf/Protos$Enum$Builder;',71,0,0) | ||
f(27,171,11,2,'com/google/protobuf/CodedInputStream$ArrayDecoder.readEnum()I',11,0,0) | ||
f(28,171,11,2,'com/google/protobuf/CodedInputStream$ArrayDecoder.readRawVarint32()I',11,0,0) | ||
f(27,182,23,2,'com/google/protobuf/CodedInputStream$ArrayDecoder.readTag()I',23,0,0) | ||
f(28,191,2,2,'com/google/protobuf/CodedInputStream$ArrayDecoder.isAtEnd()Z',2,0,0) | ||
f(28,193,12,2,'com/google/protobuf/CodedInputStream$ArrayDecoder.readRawVarint32()I',12,0,0) | ||
f(27,205,10,2,'com/google/protobuf/GeneratedMessageV3$Builder.onChanged()V',10,0,0) | ||
f(26,215,38,2,'scalapb/perf/Protos$Enum.newBuilder()Lscalapb/perf/Protos$Enum$Builder;',25,0,0) | ||
f(27,215,38,2,'scalapb/perf/Protos$Enum.toBuilder()Lscalapb/perf/Protos$Enum$Builder;',25,0,0) | ||
f(28,223,1,4,'OptoRuntime::new_instance_C(Klass*, JavaThread*)') | ||
f(29,223,1,4,'InstanceKlass::allocate_instance(JavaThread*)') | ||
f(30,223,1,4,'MemAllocator::allocate() const') | ||
f(31,223,1,4,'MemAllocator::mem_allocate_inside_tlab_slow(MemAllocator::Allocation&) const') | ||
f(32,223,1,3,'/usr/lib/x86_64-linux-gnu/libc.so.6') | ||
f(28,224,29,2,'scalapb/perf/Protos$Enum$Builder.<init>(Lscalapb/perf/Protos$1;)V',17,0,0) | ||
f(29,224,29,2,'scalapb/perf/Protos$Enum$Builder.<init>()V',17,0,0) | ||
f(30,231,22,2,'com/google/protobuf/GeneratedMessageV3$Builder.<init>()V',10,0,0) | ||
f(31,231,22,2,'com/google/protobuf/GeneratedMessageV3$Builder.<init>(Lcom/google/protobuf/GeneratedMessageV3$BuilderParent;)V',10,0,0) | ||
f(32,231,22,2,'com/google/protobuf/AbstractMessage$Builder.<init>()V',10,0,0) | ||
f(33,231,22,2,'com/google/protobuf/AbstractMessageLite$Builder.<init>()V',10,0,0) | ||
f(34,241,12,1,'java/lang/Object.<init>()V') | ||
f(19,253,10,2,'scalapb/perf/ProtobufBenchmark.bytes()[B',10,0,0) | ||
f(19,263,42,2,'scalapb/perf/ProtobufBenchmark.out()Lcom/google/protobuf/CodedOutputStream;',42,0,0) | ||
f(19,305,193,2,'scalapb/perf/Protos$Enum.writeTo(Lcom/google/protobuf/CodedOutputStream;)V',193,0,0) | ||
f(20,315,94,2,'com/google/protobuf/CodedOutputStream.writeEnum(II)V',94,0,0) | ||
f(21,315,94,2,'com/google/protobuf/CodedOutputStream$OutputStreamEncoder.writeInt32(II)V',94,0,0) | ||
f(22,315,11,2,'com/google/protobuf/CodedOutputStream$AbstractBufferedEncoder.bufferInt32NoTag(I)V',11,0,0) | ||
f(23,315,11,2,'com/google/protobuf/CodedOutputStream$AbstractBufferedEncoder.bufferUInt32NoTag(I)V',11,0,0) | ||
f(22,326,59,2,'com/google/protobuf/CodedOutputStream$AbstractBufferedEncoder.bufferTag(II)V',59,0,0) | ||
f(23,326,59,2,'com/google/protobuf/CodedOutputStream$AbstractBufferedEncoder.bufferUInt32NoTag(I)V',59,0,0) | ||
f(24,379,6,2,'com/google/protobuf/UnsafeUtil.putByte([BJB)V',6,0,0) | ||
f(25,379,6,2,'com/google/protobuf/UnsafeUtil$JvmMemoryAccessor.putByte(Ljava/lang/Object;JB)V',6,0,0) | ||
f(26,383,2,2,'sun/misc/Unsafe.putByte(Ljava/lang/Object;JB)V',2,0,0) | ||
f(22,385,24,2,'com/google/protobuf/CodedOutputStream$OutputStreamEncoder.flushIfNotAvailable(I)V',24,0,0) | ||
f(20,409,89,2,'com/google/protobuf/UnknownFieldSet.writeTo(Lcom/google/protobuf/CodedOutputStream;)V',89,0,0) | ||
f(21,425,65,2,'java/util/TreeMap$EntrySet.iterator()Ljava/util/Iterator;',65,0,0) | ||
f(22,428,4,2,'java/util/TreeMap$EntryIterator.<init>(Ljava/util/TreeMap;Ljava/util/TreeMap$Entry;)V',4,0,0) | ||
f(22,432,58,2,'java/util/TreeMap.getFirstEntry()Ljava/util/TreeMap$Entry;',58,0,0) | ||
f(21,490,8,2,'java/util/TreeMap.entrySet()Ljava/util/Set;',8,0,0) | ||
|
||
search(); | ||
</script></body></html> |
Oops, something went wrong.