Skip to content

Commit 1bf40cf

Browse files
Merge pull request #758 from ecstatic-morse/consistent-cache-states
Display "cache-state" names consistently
2 parents c44513f + 1837bd5 commit 1bf40cf

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

site/static/index.html

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,14 @@
7373
</a>
7474

7575
<script>
76-
const seriesColors = ["#7cb5ec", "#434348", "#90ed7d", "#f7a35c", "#8085e9", "#f15c80", "#e4d354", "#2b908f", "#f45b5b", "#91e8e1"];
76+
const commonCacheStateColors = {
77+
"full": "#7cb5ec",
78+
"incr-full": "#434348",
79+
"incr-unchanged": "#f7a35c",
80+
"incr-patched: println": "#90ed7d",
81+
};
82+
83+
const otherCacheStateColors = ["#8085e9", "#f15c80", "#e4d354", "#2b908f", "#f45b5b", "#91e8e1"];
7784
const interpolatedColor = "#fcb0f1";
7885

7986
function tooltipPlugin({onclick, commits, isInterpolated, absoluteMode, shiftX = 10, shiftY = 10}) {
@@ -95,7 +102,7 @@
95102
tooltip.style.top = (tooltipTopOffset + top + shiftX) + "px";
96103
tooltip.style.left = (tooltipLeftOffset + lft + shiftY) + "px";
97104

98-
tooltip.style.borderColor = isInterpolated(dataIdx) ? interpolatedColor : seriesColors[seriesIdx - 1];
105+
tooltip.style.borderColor = isInterpolated(dataIdx) ? interpolatedColor : "#000000";
99106
let trailer = "";
100107
if (absoluteMode) {
101108
let pctSinceStart = (((u.data[seriesIdx][dataIdx] - u.data[seriesIdx][0]) / u.data[seriesIdx][0]) * 100).toFixed(2);
@@ -267,6 +274,8 @@
267274

268275
for (let benchKind in benchKinds) {
269276
let cacheStates = benchKinds[benchKind];
277+
let cacheStateNames = Object.keys(cacheStates);
278+
cacheStateNames.sort();
270279

271280
let yAxis = "Value";
272281
if (state.stat == "instructions:u") {
@@ -294,20 +303,19 @@
294303

295304
let plotData = [xVals];
296305

297-
let j = 0;
306+
let otherColorIdx = 0;
298307

299-
for (let cacheState in cacheStates) {
308+
for (let cacheState of cacheStateNames) {
300309
let yVals = cacheStates[cacheState].points;
310+
let color = commonCacheStateColors[cacheState] || otherCacheStateColors[otherColorIdx++];
301311

302312
plotData.push(yVals);
303313

304314
seriesOpts.push({
305315
label: cacheState,
306316
width: devicePixelRatio,
307-
stroke: seriesColors[j]
317+
stroke: color
308318
});
309-
310-
j++;
311319
}
312320

313321
let plotOpts = genPlotOpts({

0 commit comments

Comments
 (0)