summaryrefslogtreecommitdiffstats
path: root/scripts/lib/build_perf/html
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/lib/build_perf/html')
-rw-r--r--scripts/lib/build_perf/html/measurement_chart.html168
-rw-r--r--scripts/lib/build_perf/html/report.html408
2 files changed, 0 insertions, 576 deletions
diff --git a/scripts/lib/build_perf/html/measurement_chart.html b/scripts/lib/build_perf/html/measurement_chart.html
deleted file mode 100644
index 86435273cf..0000000000
--- a/scripts/lib/build_perf/html/measurement_chart.html
+++ /dev/null
@@ -1,168 +0,0 @@
1<script type="module">
2 // Get raw data
3 const rawData = [
4 {% for sample in measurement.samples %}
5 [{{ sample.commit_num }}, {{ sample.mean.gv_value() }}, {{ sample.start_time }}, '{{sample.commit}}'],
6 {% endfor %}
7 ];
8
9 const convertToMinute = (time) => {
10 return time[0]*60 + time[1] + time[2]/60 + time[3]/3600;
11 }
12
13 // Update value format to either minutes or leave as size value
14 const updateValue = (value) => {
15 // Assuming the array values are duration in the format [hours, minutes, seconds, milliseconds]
16 return Array.isArray(value) ? convertToMinute(value) : value
17 }
18
19 // Convert raw data to the format: [time, value]
20 const data = rawData.map(([commit, value, time]) => {
21 return [
22 // The Date object takes values in milliseconds rather than seconds. So to use a Unix timestamp we have to multiply it by 1000.
23 new Date(time * 1000).getTime(),
24 // Assuming the array values are duration in the format [hours, minutes, seconds, milliseconds]
25 updateValue(value)
26 ]
27 });
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
37 // Set chart options
38 const option_start_time = {
39 tooltip: {
40 trigger: 'axis',
41 enterable: true,
42 position: function (point, params, dom, rect, size) {
43 return [point[0], '0%'];
44 },
45 formatter: function (param) {
46 const value = param[0].value[1]
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
50 // Add commit hash to the tooltip as a link
51 const commitLink = `https://git.yoctoproject.org/poky/commit/?id=${sample[0][3]}`
52 if ('{{ measurement.value_type.quantity }}' == 'time') {
53 const hours = Math.floor(value/60)
54 const minutes = Math.floor(value % 60)
55 const seconds = Math.floor((value * 60) % 60)
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}`
57 }
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}`
59 ;}
60 },
61 xAxis: {
62 type: 'time',
63 },
64 yAxis: {
65 name: '{{ measurement.value_type.quantity }}' == 'time' ? 'Duration in minutes' : 'Disk size in MB',
66 type: 'value',
67 min: function(value) {
68 return Math.round(value.min - 0.5);
69 },
70 max: function(value) {
71 return Math.round(value.max + 0.5);
72 }
73 },
74 dataZoom: [
75 {
76 type: 'slider',
77 xAxisIndex: 0,
78 filterMode: 'none'
79 },
80 ],
81 series: [
82 {
83 name: '{{ measurement.value_type.quantity }}',
84 type: 'line',
85 symbol: 'none',
86 data: data
87 }
88 ]
89 };
90
91 const option_commit_count = {
92 tooltip: {
93 trigger: 'axis',
94 enterable: true,
95 position: function (point, params, dom, rect, size) {
96 return [point[0], '0%'];
97 },
98 formatter: function (param) {
99 const value = param[0].value
100 const sample = rawData.filter(([commit, dataValue]) => updateValue(dataValue) === value)
101 const formattedDate = new Date(sample[0][2] * 1000).toString().replace(/GMT[+-]\d{4}/, '').replace(/\(.*\)/, '(CEST)');
102 // Add commit hash to the tooltip as a link
103 const commitLink = `https://git.yoctoproject.org/poky/commit/?id=${sample[0][3]}`
104 if ('{{ measurement.value_type.quantity }}' == 'time') {
105 const hours = Math.floor(value/60)
106 const minutes = Math.floor(value % 60)
107 const seconds = Math.floor((value * 60) % 60)
108 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}`
109 }
110 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}`
111 ;}
112 },
113 xAxis: {
114 name: 'Commit count',
115 type: 'category',
116 data: commitCountList
117 },
118 yAxis: {
119 name: '{{ measurement.value_type.quantity }}' == 'time' ? 'Duration in minutes' : 'Disk size in MB',
120 type: 'value',
121 min: function(value) {
122 return Math.round(value.min - 0.5);
123 },
124 max: function(value) {
125 return Math.round(value.max + 0.5);
126 }
127 },
128 dataZoom: [
129 {
130 type: 'slider',
131 xAxisIndex: 0,
132 filterMode: 'none'
133 },
134 ],
135 series: [
136 {
137 name: '{{ measurement.value_type.quantity }}',
138 type: 'line',
139 symbol: 'none',
140 data: commitCountData
141 }
142 ]
143 };
144
145 // Draw chart
146 const draw_chart = (chart_id, option) => {
147 let chart_name
148 const chart_div = document.getElementById(chart_id);
149 // Set dark mode
150 if (window.matchMedia('(prefers-color-scheme: dark)').matches) {
151 chart_name= echarts.init(chart_div, 'dark', {
152 height: 320
153 });
154 } else {
155 chart_name= echarts.init(chart_div, null, {
156 height: 320
157 });
158 }
159 // Change chart size with browser resize
160 window.addEventListener('resize', function() {
161 chart_name.resize();
162 });
163 return chart_name.setOption(option);
164 }
165
166 draw_chart('{{ chart_elem_start_time_id }}', option_start_time)
167 draw_chart('{{ chart_elem_commit_count_id }}', option_commit_count)
168</script>
diff --git a/scripts/lib/build_perf/html/report.html b/scripts/lib/build_perf/html/report.html
deleted file mode 100644
index 28cd80e738..0000000000
--- a/scripts/lib/build_perf/html/report.html
+++ /dev/null
@@ -1,408 +0,0 @@
1<!DOCTYPE html>
2<html lang="en">
3<head>
4{# Scripts, for visualization#}
5<!--START-OF-SCRIPTS-->
6<script src=" https://cdn.jsdelivr.net/npm/echarts@5.5.0/dist/echarts.min.js "></script>
7
8{# Render measurement result charts #}
9{% for test in test_data %}
10 {% if test.status == 'SUCCESS' %}
11 {% for measurement in test.measurements %}
12 {% set chart_elem_start_time_id = test.name + '_' + measurement.name + '_chart_start_time' %}
13 {% set chart_elem_commit_count_id = test.name + '_' + measurement.name + '_chart_commit_count' %}
14 {% include 'measurement_chart.html' %}
15 {% endfor %}
16 {% endif %}
17{% endfor %}
18
19<!--END-OF-SCRIPTS-->
20
21{# Styles #}
22<style>
23:root {
24 --text: #000;
25 --bg: #fff;
26 --h2heading: #707070;
27 --link: #0000EE;
28 --trtopborder: #9ca3af;
29 --trborder: #e5e7eb;
30 --chartborder: #f0f0f0;
31 }
32.meta-table {
33 font-size: 14px;
34 text-align: left;
35 border-collapse: collapse;
36}
37.summary {
38 font-size: 14px;
39 text-align: left;
40 border-collapse: collapse;
41}
42.measurement {
43 padding: 8px 0px 8px 8px;
44 border: 2px solid var(--chartborder);
45 margin: 1.5rem 0;
46}
47.details {
48 margin: 0;
49 font-size: 12px;
50 text-align: left;
51 border-collapse: collapse;
52}
53.details th {
54 padding-right: 8px;
55}
56.details.plain th {
57 font-weight: normal;
58}
59.preformatted {
60 font-family: monospace;
61 white-space: pre-wrap;
62 background-color: #f0f0f0;
63 margin-left: 10px;
64}
65.card-container {
66 border-bottom-width: 1px;
67 padding: 1.25rem 3rem;
68 box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
69 border-radius: 0.25rem;
70}
71body {
72 font-family: 'Helvetica', sans-serif;
73 margin: 3rem 8rem;
74 background-color: var(--bg);
75 color: var(--text);
76}
77h1 {
78 text-align: center;
79}
80h2 {
81 font-size: 1.5rem;
82 margin-bottom: 0px;
83 color: var(--h2heading);
84 padding-top: 1.5rem;
85}
86h3 {
87 font-size: 1.3rem;
88 margin: 0px;
89 color: var(--h2heading);
90 padding: 1.5rem 0;
91}
92h4 {
93 font-size: 14px;
94 font-weight: lighter;
95 line-height: 1.2rem;
96 margin: auto;
97 padding-top: 1rem;
98}
99table {
100 margin-top: 1.5rem;
101 line-height: 2rem;
102}
103tr {
104 border-bottom: 1px solid var(--trborder);
105}
106tr:first-child {
107 border-bottom: 1px solid var(--trtopborder);
108}
109tr:last-child {
110 border-bottom: none;
111}
112a {
113 text-decoration: none;
114 font-weight: bold;
115 color: var(--link);
116}
117a:hover {
118 color: #8080ff;
119}
120button {
121 background-color: #F3F4F6;
122 border: none;
123 outline: none;
124 cursor: pointer;
125 padding: 10px 12px;
126 transition: 0.3s;
127 border-radius: 8px;
128 color: #3A4353;
129}
130button:hover {
131 background-color: #d6d9e0;
132}
133.tab button.active {
134 background-color: #d6d9e0;
135}
136@media (prefers-color-scheme: dark) {
137 :root {
138 --text: #e9e8fa;
139 --bg: #0F0C28;
140 --h2heading: #B8B7CB;
141 --link: #87cefa;
142 --trtopborder: #394150;
143 --trborder: #212936;
144 --chartborder: #b1b0bf;
145 }
146 button {
147 background-color: #28303E;
148 color: #fff;
149 }
150 button:hover {
151 background-color: #545a69;
152 }
153 .tab button.active {
154 background-color: #545a69;
155 }
156}
157</style>
158
159<title>{{ title }}</title>
160</head>
161
162{% macro poky_link(commit) -%}
163 <a href="http://git.yoctoproject.org/cgit/cgit.cgi/poky/log/?id={{ commit }}">{{ commit[0:11] }}</a>
164{%- endmacro %}
165
166<body><div>
167 <h1 style="text-align: center;">Performance Test Report</h1>
168 {# Test metadata #}
169 <h2>General</h2>
170 <h4>The table provides an overview of the comparison between two selected commits from the same branch.</h4>
171 <table class="meta-table" style="width: 100%">
172 <tr>
173 <th></th>
174 <th>Current commit</th>
175 <th>Comparing with</th>
176 </tr>
177 {% for key, item in metadata.items() %}
178 <tr>
179 <th>{{ item.title }}</th>
180 {%if key == 'commit' %}
181 <td>{{ poky_link(item.value) }}</td>
182 <td>{{ poky_link(item.value_old) }}</td>
183 {% else %}
184 <td>{{ item.value }}</td>
185 <td>{{ item.value_old }}</td>
186 {% endif %}
187 </tr>
188 {% endfor %}
189 </table>
190
191 {# Test result summary #}
192 <h2>Test result summary</h2>
193 <h4>The test summary presents a thorough breakdown of each test conducted on the branch, including details such as build time and disk space consumption. Additionally, it gives insights into the average time taken for test execution, along with absolute and relative values for a better understanding.</h4>
194 <table class="summary" style="width: 100%">
195 <tr>
196 <th>Test name</th>
197 <th>Measurement description</th>
198 <th>Mean value</th>
199 <th>Absolute difference</th>
200 <th>Relative difference</th>
201 </tr>
202 {% for test in test_data %}
203 {% if test.status == 'SUCCESS' %}
204 {% for measurement in test.measurements %}
205 <tr {{ row_style }}>
206 {% if loop.index == 1 %}
207 <td><a href=#{{test.name}}>{{ test.name }}: {{ test.description }}</a></td>
208 {% else %}
209 {# add empty cell in place of the test name#}
210 <td></td>
211 {% endif %}
212 {% if measurement.absdiff > 0 %}
213 {% set result_style = "color: red" %}
214 {% elif measurement.absdiff == measurement.absdiff %}
215 {% set result_style = "color: green" %}
216 {% else %}
217 {% set result_style = "color: orange" %}
218 {%endif %}
219 {% if measurement.reldiff|abs > 2 %}
220 {% set result_style = result_style + "; font-weight: bold" %}
221 {% endif %}
222 <td>{{ measurement.description }}</td>
223 <td style="font-weight: bold">{{ measurement.value.mean }}</td>
224 <td style="{{ result_style }}">{{ measurement.absdiff_str }}</td>
225 <td style="{{ result_style }}">{{ measurement.reldiff_str }}</td>
226 </tr>
227 {% endfor %}
228 {% else %}
229 <td style="font-weight: bold; color: red;">{{test.status }}</td>
230 <td></td> <td></td> <td></td> <td></td>
231 {% endif %}
232 {% endfor %}
233 </table>
234
235 {# Detailed test results #}
236 <h2>Test details</h2>
237 <h4>The following section provides details of each test, accompanied by charts representing build time and disk usage over time or by commit number.</h4>
238 {% for test in test_data %}
239 <h3 style="color: #000;" id={{test.name}}>{{ test.name }}: {{ test.description }}</h3>
240 {% if test.status == 'SUCCESS' %}
241 <div class="card-container">
242 {% for measurement in test.measurements %}
243 <div class="measurement">
244 <h3>{{ measurement.description }}</h3>
245 <div style="font-weight:bold;">
246 <span style="font-size: 23px;">{{ measurement.value.mean }}</span>
247 <span style="font-size: 20px; margin-left: 12px">
248 {% if measurement.absdiff > 0 %}
249 <span style="color: red">
250 {% elif measurement.absdiff == measurement.absdiff %}
251 <span style="color: green">
252 {% else %}
253 <span style="color: orange">
254 {% endif %}
255 {{ measurement.absdiff_str }} ({{measurement.reldiff_str}})
256 </span></span>
257 </div>
258 {# Table for trendchart and the statistics #}
259 <table style="width: 100%">
260 <tr>
261 <td style="width: 75%">
262 {# Linechart #}
263 <div class="tab {{ test.name }}_{{ measurement.name }}_tablinks">
264 <button class="tablinks active" onclick="openChart(event, '{{ test.name }}_{{ measurement.name }}_start_time', '{{ test.name }}_{{ measurement.name }}')">Chart with start time</button>
265 <button class="tablinks" onclick="openChart(event, '{{ test.name }}_{{ measurement.name }}_commit_count', '{{ test.name }}_{{ measurement.name }}')">Chart with commit count</button>
266 </div>
267 <div class="{{ test.name }}_{{ measurement.name }}_tabcontent">
268 <div id="{{ test.name }}_{{ measurement.name }}_start_time" class="tabcontent" style="display: block;">
269 <div id="{{ test.name }}_{{ measurement.name }}_chart_start_time"></div>
270 </div>
271 <div id="{{ test.name }}_{{ measurement.name }}_commit_count" class="tabcontent" style="display: none;">
272 <div id="{{ test.name }}_{{ measurement.name }}_chart_commit_count"></div>
273 </div>
274 </div>
275 </td>
276 <td>
277 {# Measurement statistics #}
278 <table class="details plain">
279 <tr>
280 <th>Test runs</th><td>{{ measurement.value.sample_cnt }}</td>
281 </tr><tr>
282 <th>-/+</th><td>-{{ measurement.value.minus }} / +{{ measurement.value.plus }}</td>
283 </tr><tr>
284 <th>Min</th><td>{{ measurement.value.min }}</td>
285 </tr><tr>
286 <th>Max</th><td>{{ measurement.value.max }}</td>
287 </tr><tr>
288 <th>Stdev</th><td>{{ measurement.value.stdev }}</td>
289 </tr><tr>
290 <th><div id="{{ test.name }}_{{ measurement.name }}_chart_png"></div></th>
291 <td></td>
292 </tr>
293 </table>
294 </td>
295 </tr>
296 </table>
297
298 {# Task and recipe summary from buildstats #}
299 {% if 'buildstats' in measurement %}
300 Task resource usage
301 <table class="details" style="width:100%">
302 <tr>
303 <th>Number of tasks</th>
304 <th>Top consumers of cputime</th>
305 </tr>
306 <tr>
307 <td style="vertical-align: top">{{ measurement.buildstats.tasks.count }} ({{ measurement.buildstats.tasks.change }})</td>
308 {# Table of most resource-hungry tasks #}
309 <td>
310 <table class="details plain">
311 {% for diff in measurement.buildstats.top_consumer|reverse %}
312 <tr>
313 <th>{{ diff.pkg }}.{{ diff.task }}</th>
314 <td>{{ '%0.0f' % diff.value2 }} s</td>
315 </tr>
316 {% endfor %}
317 </table>
318 </td>
319 </tr>
320 <tr>
321 <th>Biggest increase in cputime</th>
322 <th>Biggest decrease in cputime</th>
323 </tr>
324 <tr>
325 {# Table biggest increase in resource usage #}
326 <td>
327 <table class="details plain">
328 {% for diff in measurement.buildstats.top_increase|reverse %}
329 <tr>
330 <th>{{ diff.pkg }}.{{ diff.task }}</th>
331 <td>{{ '%+0.0f' % diff.absdiff }} s</td>
332 </tr>
333 {% endfor %}
334 </table>
335 </td>
336 {# Table biggest decrease in resource usage #}
337 <td>
338 <table class="details plain">
339 {% for diff in measurement.buildstats.top_decrease %}
340 <tr>
341 <th>{{ diff.pkg }}.{{ diff.task }}</th>
342 <td>{{ '%+0.0f' % diff.absdiff }} s</td>
343 </tr>
344 {% endfor %}
345 </table>
346 </td>
347 </tr>
348 </table>
349
350 {# Recipe version differences #}
351 {% if measurement.buildstats.ver_diff %}
352 <div style="margin-top: 16px">Recipe version changes</div>
353 <table class="details">
354 {% for head, recipes in measurement.buildstats.ver_diff.items() %}
355 <tr>
356 <th colspan="2">{{ head }}</th>
357 </tr>
358 {% for name, info in recipes|sort %}
359 <tr>
360 <td>{{ name }}</td>
361 <td>{{ info }}</td>
362 </tr>
363 {% endfor %}
364 {% endfor %}
365 </table>
366 {% else %}
367 <div style="margin-top: 16px">No recipe version changes detected</div>
368 {% endif %}
369 {% endif %}
370 </div>
371 {% endfor %}
372 </div>
373 {# Unsuccessful test #}
374 {% else %}
375 <span style="font-size: 150%; font-weight: bold; color: red;">{{ test.status }}
376 {% if test.err_type %}<span style="font-size: 75%; font-weight: normal">({{ test.err_type }})</span>{% endif %}
377 </span>
378 <div class="preformatted">{{ test.message }}</div>
379 {% endif %}
380 {% endfor %}
381</div>
382
383<script>
384function openChart(event, chartType, chartName) {
385 let i, tabcontents, tablinks
386 tabcontents = document.querySelectorAll(`.${chartName}_tabcontent > .tabcontent`);
387 tabcontents.forEach((tabcontent) => {
388 tabcontent.style.display = "none";
389 });
390
391 tablinks = document.querySelectorAll(`.${chartName}_tablinks > .tablinks`);
392 tablinks.forEach((tabLink) => {
393 tabLink.classList.remove('active');
394 });
395
396 const targetTab = document.getElementById(chartType)
397 targetTab.style.display = "block";
398
399 // Call resize on the ECharts instance to redraw the chart
400 const chartContainer = targetTab.querySelector('div')
401 echarts.init(chartContainer).resize();
402
403 event.currentTarget.classList.add('active');
404}
405</script>
406
407</body>
408</html>