Skip to content

Commit 1d5e7db

Browse files
oe-build-perf-report: Add commit hash link to chart tooltip"
Signed-off-by: Ninette Adhikari <ninette@thehoodiefirm.com>
1 parent 9416803 commit 1d5e7db

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

scripts/lib/build_perf/html/measurement_chart.html

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Get raw data
33
const rawData = [
44
{% for sample in measurement.samples %}
5-
[{{ sample.commit_num }}, {{ sample.mean.gv_value() }}, {{ sample.start_time }}],
5+
[{{ sample.commit_num }}, {{ sample.mean.gv_value() }}, {{ sample.start_time }}, '{{sample.commit}}'],
66
{% endfor %}
77
];
88

@@ -30,23 +30,23 @@
3030
const option = {
3131
tooltip: {
3232
trigger: 'axis',
33-
valueFormatter: (value) => {
34-
const commitNumber = rawData.filter(([commit, dataValue, time]) => updateValue(dataValue) === value)
33+
enterable: true,
34+
position: function (point, params, dom, rect, size) {
35+
return [point[0]-150, '10%'];
36+
},
37+
formatter: function (param) {
38+
const value = param[0].value[1]
39+
const sample = rawData.filter(([commit, dataValue]) => updateValue(dataValue) === value)
40+
// Add commit hash to the tooltip as a link
41+
const commitLink = `https://git.yoctoproject.org/poky/commit/?id=${sample[0][3]}`
3542
if ('{{ measurement.value_type.quantity }}' == 'time') {
3643
const hours = Math.floor(value/60)
3744
const minutes = Math.floor(value % 60)
3845
const seconds = Math.floor((value * 60) % 60)
39-
return [
40-
hours + ':' + minutes + ':' + seconds + ', ' +
41-
'commit number: ' + commitNumber[0][0]
42-
]
46+
return `<strong>Duration:</strong> ${hours}:${minutes}:${seconds}, <br/> <strong>Commit number:</strong> <a href="${commitLink}" target="_blank" rel="noreferrer noopener">${sample[0][0]}</a>`
4347
}
44-
return [
45-
value.toFixed(2) + ' MB' + ', ' +
46-
'commit number: ' + commitNumber[0][0]
47-
]
48-
},
49-
48+
return `<strong>Size:</strong> ${value.toFixed(2)} MB, <br/> <strong>Commit number:</strong> <a href="${commitLink}" target="_blank" rel="noreferrer noopener">${sample[0][0]}</a>`
49+
;}
5050
},
5151
xAxis: {
5252
type: 'time',

scripts/oe-build-perf-report

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,10 +336,12 @@ def print_html_report(data, id_comp, buildstats):
336336
test_i = test_data['tests'][test]
337337
meas_i = test_i['measurements'][meas]
338338
commit_num = get_data_item(meta, 'layers.meta.commit_count')
339+
commit = get_data_item(meta, 'layers.meta.commit')
339340
# Add start_time for both test measurement types of sysres and disk usage
340341
start_time = test_i['start_time'][0]
341342
samples.append(measurement_stats(meas_i, '', start_time))
342343
samples[-1]['commit_num'] = commit_num
344+
samples[-1]['commit'] = commit
343345

344346
absdiff = samples[-1]['val_cls'](samples[-1]['mean'] - samples[id_comp]['mean'])
345347
reldiff = absdiff * 100 / samples[id_comp]['mean']

0 commit comments

Comments
 (0)