Skip to content

Commit 4098f4d

Browse files
authored
[UR][Benchmarks] fix bench charts colors (#18623)
Fixes benchmark results presentation on https://oneapi-src.github.io/unified-runtime/performance/ The same runs now have the same color on subsequent charts Signed-off-by: Mateusz P. Nowak <mateusz.p.nowak@intel.com>
1 parent 12e9a29 commit 4098f4d

1 file changed

Lines changed: 18 additions & 5 deletions

File tree

devops/scripts/benchmarks/html/scripts.js

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,17 @@ const colorPalette = [
3636
'rgb(210, 190, 0)',
3737
];
3838

39+
const nameColorMap = {};
40+
let colorIndex = 0;
41+
42+
function getColorForName(name) {
43+
if (!(name in nameColorMap)) {
44+
nameColorMap[name] = colorPalette[colorIndex % colorPalette.length];
45+
colorIndex++;
46+
}
47+
return nameColorMap[name];
48+
}
49+
3950
// Run selector functions
4051
function updateSelectedRuns(forceUpdate = true) {
4152
selectedRunsDiv.innerHTML = '';
@@ -557,7 +568,7 @@ function processTimeseriesData(benchmarkRuns) {
557568
runs: {}
558569
};
559570
}
560-
addRunDataPoint(resultsByLabel[result.label], run, result, run.name);
571+
addRunDataPoint(resultsByLabel[result.label], run, result, false, run.name);
561572
});
562573
});
563574

@@ -686,14 +697,14 @@ function processLayerComparisonsData(benchmarkRuns) {
686697
group.benchmarkLabels.push(result.label);
687698
}
688699

689-
addRunDataPoint(group, run, result, name);
700+
addRunDataPoint(group, run, result, true, name);
690701
});
691702
});
692703

693704
return Object.values(groupedResults);
694705
}
695706

696-
function addRunDataPoint(group, run, result, name = null) {
707+
function addRunDataPoint(group, run, result, comparison, name = null) {
697708
const runKey = name || result.label + ' (' + run.name + ')';
698709

699710
if (!group.runs[runKey]) {
@@ -702,8 +713,10 @@ function addRunDataPoint(group, run, result, name = null) {
702713
label: runKey,
703714
runName: run.name,
704715
data: [],
705-
borderColor: colorPalette[datasetIndex % colorPalette.length],
706-
backgroundColor: colorPalette[datasetIndex % colorPalette.length],
716+
borderColor:
717+
comparison ? colorPalette[datasetIndex % colorPalette.length] : getColorForName(run.name),
718+
backgroundColor:
719+
comparison ? colorPalette[datasetIndex % colorPalette.length] : getColorForName(run.name),
707720
borderWidth: 1,
708721
pointRadius: 3,
709722
pointStyle: 'circle',

0 commit comments

Comments
 (0)