diff options
Diffstat (limited to 'scripts/lib/build_perf')
| -rw-r--r-- | scripts/lib/build_perf/html/measurement_chart.html | 128 | ||||
| -rw-r--r-- | scripts/lib/build_perf/html/report.html | 71 |
2 files changed, 165 insertions, 34 deletions
diff --git a/scripts/lib/build_perf/html/measurement_chart.html b/scripts/lib/build_perf/html/measurement_chart.html index ad4a93ed02..86435273cf 100644 --- a/scripts/lib/build_perf/html/measurement_chart.html +++ b/scripts/lib/build_perf/html/measurement_chart.html | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | // Get raw data | 2 | // Get raw data |
| 3 | const rawData = [ | 3 | const rawData = [ |
| 4 | {% for sample in measurement.samples %} | 4 | {% 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}}'], |
| 6 | {% endfor %} | 6 | {% endfor %} |
| 7 | ]; | 7 | ]; |
| 8 | 8 | ||
| @@ -26,27 +26,37 @@ | |||
| 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 | valueFormatter: (value) => { | 41 | enterable: true, |
| 34 | const commitNumber = rawData.filter(([commit, dataValue, time]) => updateValue(dataValue) === value) | 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]}` | ||
| 35 | if ('{{ measurement.value_type.quantity }}' == 'time') { | 52 | if ('{{ measurement.value_type.quantity }}' == 'time') { |
| 36 | const hours = Math.floor(value/60) | 53 | const hours = Math.floor(value/60) |
| 37 | const minutes = Math.floor(value % 60) | 54 | const minutes = Math.floor(value % 60) |
| 38 | const seconds = Math.floor((value * 60) % 60) | 55 | const seconds = Math.floor((value * 60) % 60) |
| 39 | return [ | 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}` |
| 40 | hours + ':' + minutes + ':' + seconds + ', ' + | ||
| 41 | 'commit number: ' + commitNumber[0][0] | ||
| 42 | ] | ||
| 43 | } | 57 | } |
| 44 | return [ | 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}` |
| 45 | value.toFixed(2) + ' MB' + ', ' + | 59 | ;} |
| 46 | 'commit number: ' + commitNumber[0][0] | ||
| 47 | ] | ||
| 48 | }, | ||
| 49 | |||
| 50 | }, | 60 | }, |
| 51 | xAxis: { | 61 | xAxis: { |
| 52 | type: 'time', | 62 | type: 'time', |
| @@ -72,29 +82,87 @@ | |||
| 72 | { | 82 | { |
| 73 | name: '{{ measurement.value_type.quantity }}', | 83 | name: '{{ measurement.value_type.quantity }}', |
| 74 | type: 'line', | 84 | type: 'line', |
| 75 | step: 'start', | ||
| 76 | symbol: 'none', | 85 | symbol: 'none', |
| 77 | data: data | 86 | data: data |
| 78 | } | 87 | } |
| 79 | ] | 88 | ] |
| 80 | }; | 89 | }; |
| 81 | 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 | |||
| 82 | // Draw chart | 145 | // Draw chart |
| 83 | const chart_div = document.getElementById('{{ chart_elem_id }}'); | 146 | const draw_chart = (chart_id, option) => { |
| 84 | // Set dark mode | 147 | let chart_name |
| 85 | let measurement_chart | 148 | const chart_div = document.getElementById(chart_id); |
| 86 | if (window.matchMedia('(prefers-color-scheme: dark)').matches) { | 149 | // Set dark mode |
| 87 | measurement_chart= echarts.init(chart_div, 'dark', { | 150 | if (window.matchMedia('(prefers-color-scheme: dark)').matches) { |
| 88 | height: 320 | 151 | chart_name= echarts.init(chart_div, 'dark', { |
| 89 | }); | 152 | height: 320 |
| 90 | } else { | 153 | }); |
| 91 | measurement_chart= echarts.init(chart_div, null, { | 154 | } else { |
| 92 | height: 320 | 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(); | ||
| 93 | }); | 162 | }); |
| 163 | return chart_name.setOption(option); | ||
| 94 | } | 164 | } |
| 95 | // Change chart size with browser resize | 165 | |
| 96 | window.addEventListener('resize', function() { | 166 | draw_chart('{{ chart_elem_start_time_id }}', option_start_time) |
| 97 | measurement_chart.resize(); | 167 | draw_chart('{{ chart_elem_commit_count_id }}', option_commit_count) |
| 98 | }); | ||
| 99 | measurement_chart.setOption(option); | ||
| 100 | </script> | 168 | </script> |
diff --git a/scripts/lib/build_perf/html/report.html b/scripts/lib/build_perf/html/report.html index 537ed3ee52..28cd80e738 100644 --- a/scripts/lib/build_perf/html/report.html +++ b/scripts/lib/build_perf/html/report.html | |||
| @@ -9,7 +9,8 @@ | |||
| 9 | {% for test in test_data %} | 9 | {% for test in test_data %} |
| 10 | {% if test.status == 'SUCCESS' %} | 10 | {% if test.status == 'SUCCESS' %} |
| 11 | {% for measurement in test.measurements %} | 11 | {% for measurement in test.measurements %} |
| 12 | {% set chart_elem_id = test.name + '_' + measurement.name + '_chart' %} | 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' %} | ||
| 13 | {% include 'measurement_chart.html' %} | 14 | {% include 'measurement_chart.html' %} |
| 14 | {% endfor %} | 15 | {% endfor %} |
| 15 | {% endif %} | 16 | {% endif %} |
| @@ -116,6 +117,22 @@ a { | |||
| 116 | a:hover { | 117 | a:hover { |
| 117 | color: #8080ff; | 118 | color: #8080ff; |
| 118 | } | 119 | } |
| 120 | button { | ||
| 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 | } | ||
| 130 | button:hover { | ||
| 131 | background-color: #d6d9e0; | ||
| 132 | } | ||
| 133 | .tab button.active { | ||
| 134 | background-color: #d6d9e0; | ||
| 135 | } | ||
| 119 | @media (prefers-color-scheme: dark) { | 136 | @media (prefers-color-scheme: dark) { |
| 120 | :root { | 137 | :root { |
| 121 | --text: #e9e8fa; | 138 | --text: #e9e8fa; |
| @@ -126,6 +143,16 @@ a:hover { | |||
| 126 | --trborder: #212936; | 143 | --trborder: #212936; |
| 127 | --chartborder: #b1b0bf; | 144 | --chartborder: #b1b0bf; |
| 128 | } | 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 | } | ||
| 129 | } | 156 | } |
| 130 | </style> | 157 | </style> |
| 131 | 158 | ||
| @@ -233,7 +260,18 @@ a:hover { | |||
| 233 | <tr> | 260 | <tr> |
| 234 | <td style="width: 75%"> | 261 | <td style="width: 75%"> |
| 235 | {# Linechart #} | 262 | {# Linechart #} |
| 236 | <div id="{{ test.name }}_{{ measurement.name }}_chart"></div> | 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> | ||
| 237 | </td> | 275 | </td> |
| 238 | <td> | 276 | <td> |
| 239 | {# Measurement statistics #} | 277 | {# Measurement statistics #} |
| @@ -340,6 +378,31 @@ a:hover { | |||
| 340 | <div class="preformatted">{{ test.message }}</div> | 378 | <div class="preformatted">{{ test.message }}</div> |
| 341 | {% endif %} | 379 | {% endif %} |
| 342 | {% endfor %} | 380 | {% endfor %} |
| 343 | </div></body> | 381 | </div> |
| 344 | </html> | ||
| 345 | 382 | ||
| 383 | <script> | ||
| 384 | function 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> | ||
