summaryrefslogtreecommitdiffstats
path: root/scripts/lib/build_perf/html/measurement_chart.html
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/lib/build_perf/html/measurement_chart.html')
-rw-r--r--scripts/lib/build_perf/html/measurement_chart.html108
1 files changed, 89 insertions, 19 deletions
diff --git a/scripts/lib/build_perf/html/measurement_chart.html b/scripts/lib/build_perf/html/measurement_chart.html
index 05bd84e6ce..3cd713a2ee 100644
--- a/scripts/lib/build_perf/html/measurement_chart.html
+++ b/scripts/lib/build_perf/html/measurement_chart.html
@@ -26,26 +26,36 @@
26 ] 26 ]
27 }); 27 });
28 28
29 const commitCountList = rawData.map(([commit, value, time]) => {
30 return commit
31 });
32
33 const commitCountData = rawData.map(([commit, value, time]) => {
34 return updateValue(value)
35 });
36
29 // Set chart options 37 // Set chart options
30 const option = { 38 const option_start_time = {
31 tooltip: { 39 tooltip: {
32 trigger: 'axis', 40 trigger: 'axis',
33 enterable: true, 41 enterable: true,
34 position: function (point, params, dom, rect, size) { 42 position: function (point, params, dom, rect, size) {
35 return [point[0]-150, '10%']; 43 return [point[0]+20, '10%'];
36 }, 44 },
37 formatter: function (param) { 45 formatter: function (param) {
38 const value = param[0].value[1] 46 const value = param[0].value[1]
39 const sample = rawData.filter(([commit, dataValue]) => updateValue(dataValue) === value) 47 const sample = rawData.filter(([commit, dataValue]) => updateValue(dataValue) === value)
48 const formattedDate = new Date(sample[0][2] * 1000).toString().replace(/GMT[+-]\d{4}/, '').replace(/\(.*\)/, '(CEST)');
49
40 // Add commit hash to the tooltip as a link 50 // Add commit hash to the tooltip as a link
41 const commitLink = `https://git.yoctoproject.org/poky/commit/?id=${sample[0][3]}` 51 const commitLink = `https://git.yoctoproject.org/poky/commit/?id=${sample[0][3]}`
42 if ('{{ measurement.value_type.quantity }}' == 'time') { 52 if ('{{ measurement.value_type.quantity }}' == 'time') {
43 const hours = Math.floor(value/60) 53 const hours = Math.floor(value/60)
44 const minutes = Math.floor(value % 60) 54 const minutes = Math.floor(value % 60)
45 const seconds = Math.floor((value * 60) % 60) 55 const seconds = Math.floor((value * 60) % 60)
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>` 56 return `<strong>Duration:</strong> ${hours}:${minutes}:${seconds}, <strong>Commit number:</strong> <a href="${commitLink}" target="_blank" rel="noreferrer noopener">${sample[0][0]}</a>, <br/> <strong>Start time:</strong> ${formattedDate}`
47 } 57 }
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>` 58 return `<strong>Size:</strong> ${value.toFixed(2)} MB, <strong>Commit number:</strong> <a href="${commitLink}" target="_blank" rel="noreferrer noopener">${sample[0][0]}</a>, <br/> <strong>Start time:</strong> ${formattedDate}`
49 ;} 59 ;}
50 }, 60 },
51 xAxis: { 61 xAxis: {
@@ -79,22 +89,82 @@
79 ] 89 ]
80 }; 90 };
81 91
92 const option_commit_count = {
93 tooltip: {
94 trigger: 'axis',
95 enterable: true,
96 position: function (point, params, dom, rect, size) {
97 return [point[0]+20, '10%'];
98 },
99 formatter: function (param) {
100 const value = param[0].value
101 const sample = rawData.filter(([commit, dataValue]) => updateValue(dataValue) === value)
102 const formattedDate = new Date(sample[0][2] * 1000).toString().replace(/GMT[+-]\d{4}/, '').replace(/\(.*\)/, '(CEST)');
103 // Add commit hash to the tooltip as a link
104 const commitLink = `https://git.yoctoproject.org/poky/commit/?id=${sample[0][3]}`
105 if ('{{ measurement.value_type.quantity }}' == 'time') {
106 const hours = Math.floor(value/60)
107 const minutes = Math.floor(value % 60)
108 const seconds = Math.floor((value * 60) % 60)
109 return `<strong>Duration:</strong> ${hours}:${minutes}:${seconds}, <strong>Commit number:</strong> <a href="${commitLink}" target="_blank" rel="noreferrer noopener">${sample[0][0]}</a>, <br/> <strong>Start time:</strong> ${formattedDate}`
110 }
111 return `<strong>Size:</strong> ${value.toFixed(2)} MB, <strong>Commit number:</strong> <a href="${commitLink}" target="_blank" rel="noreferrer noopener">${sample[0][0]}</a>, <br/> <strong>Start time:</strong> ${formattedDate}`
112 ;}
113 },
114 xAxis: {
115 name: 'Commit count',
116 type: 'category',
117 data: commitCountList
118 },
119 yAxis: {
120 name: '{{ measurement.value_type.quantity }}' == 'time' ? 'Duration in minutes' : 'Disk size in MB',
121 type: 'value',
122 min: function(value) {
123 return Math.round(value.min - 0.5);
124 },
125 max: function(value) {
126 return Math.round(value.max + 0.5);
127 }
128 },
129 dataZoom: [
130 {
131 type: 'slider',
132 xAxisIndex: 0,
133 filterMode: 'none'
134 },
135 ],
136 series: [
137 {
138 name: '{{ measurement.value_type.quantity }}',
139 type: 'line',
140 step: 'start',
141 symbol: 'none',
142 data: commitCountData
143 }
144 ]
145 };
146
82 // Draw chart 147 // Draw chart
83 const chart_div = document.getElementById('{{ chart_elem_id }}'); 148 const draw_chart = (chart_id, option) => {
84 // Set dark mode 149 let chart_name
85 let measurement_chart 150 const chart_div = document.getElementById(chart_id);
86 if (window.matchMedia('(prefers-color-scheme: dark)').matches) { 151 // Set dark mode
87 measurement_chart= echarts.init(chart_div, 'dark', { 152 if (window.matchMedia('(prefers-color-scheme: dark)').matches) {
88 height: 320 153 chart_name= echarts.init(chart_div, 'dark', {
89 }); 154 height: 320
90 } else { 155 });
91 measurement_chart= echarts.init(chart_div, null, { 156 } else {
92 height: 320 157 chart_name= echarts.init(chart_div, null, {
158 height: 320
159 });
160 }
161 // Change chart size with browser resize
162 window.addEventListener('resize', function() {
163 chart_name.resize();
93 }); 164 });
165 return chart_name.setOption(option);
94 } 166 }
95 // Change chart size with browser resize 167
96 window.addEventListener('resize', function() { 168 draw_chart('{{ chart_elem_start_time_id }}', option_start_time)
97 measurement_chart.resize(); 169 draw_chart('{{ chart_elem_commit_count_id }}', option_commit_count)
98 });
99 measurement_chart.setOption(option);
100</script> 170</script>