summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaley Main <thekjnsn@gmail.com>2019-02-07 10:08:26 +1100
committerRyan Dahl <ry@tinyclouds.org>2019-02-06 18:08:26 -0500
commit39429a261db6199259ad8a34edd31cbdba82250d (patch)
treebf6edf486359b95656375261f37c5cbbcfaa447d
parent2782d03b29daa207528774a5d999241d650c41b4 (diff)
Add log-scale to execution graph (#1694)
-rw-r--r--website/app.js20
1 files changed, 18 insertions, 2 deletions
diff --git a/website/app.js b/website/app.js
index 18d2899df..ed7d4baf2 100644
--- a/website/app.js
+++ b/website/app.js
@@ -1,5 +1,8 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
+// How much to multiply time values in order to process log graphs properly.
+const TimeScaleFactor = 10000;
+
export async function getJson(path) {
return (await fetch(path)).json();
}
@@ -123,13 +126,22 @@ function generate(
) {
const yAxis = {
padding: { bottom: 0 },
- min: 0,
label: yLabel
};
if (yTickFormat) {
yAxis.tick = {
format: yTickFormat
};
+ if (yTickFormat == logScale) {
+ for (let col of columns) {
+ for (let i = 1; i < col.length; i++) {
+ if (col[i] == null) {
+ continue;
+ }
+ col[i] = Math.log10(col[i] * TimeScaleFactor);
+ }
+ }
+ }
}
// @ts-ignore
@@ -150,6 +162,10 @@ function generate(
});
}
+function logScale(t) {
+ return (Math.pow(10, t) / TimeScaleFactor).toFixed(4);
+}
+
function formatSecsAsMins(t) {
// TODO use d3.round()
const a = t % 60;
@@ -204,7 +220,7 @@ export async function drawChartsFromBenchmarkData(dataUrl) {
);
}
- gen("#exec-time-chart", execTimeColumns, "seconds");
+ gen("#exec-time-chart", execTimeColumns, "seconds", logScale);
gen("#throughput-chart", throughputColumns, "seconds");
gen("#req-per-sec-chart", reqPerSecColumns, "1000 req/sec", formatReqSec);
gen("#binary-size-chart", binarySizeColumns, "megabytes", formatMB);