summaryrefslogtreecommitdiffstats
path: root/scripts/lib/build_perf
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/lib/build_perf')
-rw-r--r--scripts/lib/build_perf/html/measurement_chart.html140
-rw-r--r--scripts/lib/build_perf/html/report.html124
-rw-r--r--scripts/lib/build_perf/report.py5
3 files changed, 189 insertions, 80 deletions
diff --git a/scripts/lib/build_perf/html/measurement_chart.html b/scripts/lib/build_perf/html/measurement_chart.html
index 65f1a227ad..05bd84e6ce 100644
--- a/scripts/lib/build_perf/html/measurement_chart.html
+++ b/scripts/lib/build_perf/html/measurement_chart.html
@@ -1,50 +1,100 @@
-<script type="text/javascript">
- chartsDrawing += 1;
- google.charts.setOnLoadCallback(drawChart_{{ chart_elem_id }});
- function drawChart_{{ chart_elem_id }}() {
- var data = new google.visualization.DataTable();
+<script type="module">
+ // Get raw data
+ const rawData = [
+ {% for sample in measurement.samples %}
+ [{{ sample.commit_num }}, {{ sample.mean.gv_value() }}, {{ sample.start_time }}, '{{sample.commit}}'],
+ {% endfor %}
+ ];
- // Chart options
- var options = {
- theme : 'material',
- legend: 'none',
- hAxis: { format: '', title: 'Commit number',
- minValue: {{ chart_opts.haxis.min }},
- maxValue: {{ chart_opts.haxis.max }} },
- {% if measurement.type == 'time' %}
- vAxis: { format: 'h:mm:ss' },
- {% else %}
- vAxis: { format: '' },
- {% endif %}
- pointSize: 5,
- chartArea: { left: 80, right: 15 },
- };
+ const convertToMinute = (time) => {
+ return time[0]*60 + time[1] + time[2]/60 + time[3]/3600;
+ }
- // Define data columns
- data.addColumn('number', 'Commit');
- data.addColumn('{{ measurement.value_type.gv_data_type }}',
- '{{ measurement.value_type.quantity }}');
- // Add data rows
- data.addRows([
- {% for sample in measurement.samples %}
- [{{ sample.commit_num }}, {{ sample.mean.gv_value() }}],
- {% endfor %}
- ]);
+ // Update value format to either minutes or leave as size value
+ const updateValue = (value) => {
+ // Assuming the array values are duration in the format [hours, minutes, seconds, milliseconds]
+ return Array.isArray(value) ? convertToMinute(value) : value
+ }
- // Finally, draw the chart
- chart_div = document.getElementById('{{ chart_elem_id }}');
- var chart = new google.visualization.LineChart(chart_div);
- google.visualization.events.addListener(chart, 'ready', function () {
- //chart_div = document.getElementById('{{ chart_elem_id }}');
- //chart_div.innerHTML = '<img src="' + chart.getImageURI() + '">';
- png_div = document.getElementById('{{ chart_elem_id }}_png');
- png_div.outerHTML = '<a id="{{ chart_elem_id }}_png" href="' + chart.getImageURI() + '">PNG</a>';
- console.log("CHART READY: {{ chart_elem_id }}");
- chartsDrawing -= 1;
- if (chartsDrawing == 0)
- console.log("ALL CHARTS READY");
+ // Convert raw data to the format: [time, value]
+ const data = rawData.map(([commit, value, time]) => {
+ return [
+ // The Date object takes values in milliseconds rather than seconds. So to use a Unix timestamp we have to multiply it by 1000.
+ new Date(time * 1000).getTime(),
+ // Assuming the array values are duration in the format [hours, minutes, seconds, milliseconds]
+ updateValue(value)
+ ]
+ });
+
+ // Set chart options
+ const option = {
+ tooltip: {
+ trigger: 'axis',
+ enterable: true,
+ position: function (point, params, dom, rect, size) {
+ return [point[0]-150, '10%'];
+ },
+ formatter: function (param) {
+ const value = param[0].value[1]
+ const sample = rawData.filter(([commit, dataValue]) => updateValue(dataValue) === value)
+ // Add commit hash to the tooltip as a link
+ const commitLink = `https://git.yoctoproject.org/poky/commit/?id=${sample[0][3]}`
+ if ('{{ measurement.value_type.quantity }}' == 'time') {
+ const hours = Math.floor(value/60)
+ const minutes = Math.floor(value % 60)
+ const seconds = Math.floor((value * 60) % 60)
+ return `<strong>Duration:</strong> ${hours}:${minutes}:${seconds}, <br/> <strong>Commit number:</strong> <a href="${commitLink}" target="_blank" rel="noreferrer noopener">${sample[0][0]}</a>`
+ }
+ 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>`
+ ;}
+ },
+ xAxis: {
+ type: 'time',
+ },
+ yAxis: {
+ name: '{{ measurement.value_type.quantity }}' == 'time' ? 'Duration in minutes' : 'Disk size in MB',
+ type: 'value',
+ min: function(value) {
+ return Math.round(value.min - 0.5);
+ },
+ max: function(value) {
+ return Math.round(value.max + 0.5);
+ }
+ },
+ dataZoom: [
+ {
+ type: 'slider',
+ xAxisIndex: 0,
+ filterMode: 'none'
+ },
+ ],
+ series: [
+ {
+ name: '{{ measurement.value_type.quantity }}',
+ type: 'line',
+ step: 'start',
+ symbol: 'none',
+ data: data
+ }
+ ]
+ };
+
+ // Draw chart
+ const chart_div = document.getElementById('{{ chart_elem_id }}');
+ // Set dark mode
+ let measurement_chart
+ if (window.matchMedia('(prefers-color-scheme: dark)').matches) {
+ measurement_chart= echarts.init(chart_div, 'dark', {
+ height: 320
});
- chart.draw(data, options);
-}
+ } else {
+ measurement_chart= echarts.init(chart_div, null, {
+ height: 320
+ });
+ }
+ // Change chart size with browser resize
+ window.addEventListener('resize', function() {
+ measurement_chart.resize();
+ });
+ measurement_chart.setOption(option);
</script>
-
diff --git a/scripts/lib/build_perf/html/report.html b/scripts/lib/build_perf/html/report.html
index d1ba6f2578..537ed3ee52 100644
--- a/scripts/lib/build_perf/html/report.html
+++ b/scripts/lib/build_perf/html/report.html
@@ -3,11 +3,7 @@
<head>
{# Scripts, for visualization#}
<!--START-OF-SCRIPTS-->
-<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
-<script type="text/javascript">
-google.charts.load('current', {'packages':['corechart']});
-var chartsDrawing = 0;
-</script>
+<script src=" https://cdn.jsdelivr.net/npm/echarts@5.5.0/dist/echarts.min.js "></script>
{# Render measurement result charts #}
{% for test in test_data %}
@@ -23,28 +19,29 @@ var chartsDrawing = 0;
{# Styles #}
<style>
+:root {
+ --text: #000;
+ --bg: #fff;
+ --h2heading: #707070;
+ --link: #0000EE;
+ --trtopborder: #9ca3af;
+ --trborder: #e5e7eb;
+ --chartborder: #f0f0f0;
+ }
.meta-table {
font-size: 14px;
text-align: left;
border-collapse: collapse;
}
-.meta-table tr:nth-child(even){background-color: #f2f2f2}
-meta-table th, .meta-table td {
- padding: 4px;
-}
.summary {
- margin: 0;
font-size: 14px;
text-align: left;
border-collapse: collapse;
}
-summary th, .meta-table td {
- padding: 4px;
-}
.measurement {
padding: 8px 0px 8px 8px;
- border: 2px solid #f0f0f0;
- margin-bottom: 10px;
+ border: 2px solid var(--chartborder);
+ margin: 1.5rem 0;
}
.details {
margin: 0;
@@ -64,18 +61,71 @@ summary th, .meta-table td {
background-color: #f0f0f0;
margin-left: 10px;
}
-hr {
- color: #f0f0f0;
+.card-container {
+ border-bottom-width: 1px;
+ padding: 1.25rem 3rem;
+ box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
+ border-radius: 0.25rem;
+}
+body {
+ font-family: 'Helvetica', sans-serif;
+ margin: 3rem 8rem;
+ background-color: var(--bg);
+ color: var(--text);
+}
+h1 {
+ text-align: center;
}
h2 {
- font-size: 20px;
+ font-size: 1.5rem;
margin-bottom: 0px;
- color: #707070;
+ color: var(--h2heading);
+ padding-top: 1.5rem;
}
h3 {
- font-size: 16px;
+ font-size: 1.3rem;
margin: 0px;
- color: #707070;
+ color: var(--h2heading);
+ padding: 1.5rem 0;
+}
+h4 {
+ font-size: 14px;
+ font-weight: lighter;
+ line-height: 1.2rem;
+ margin: auto;
+ padding-top: 1rem;
+}
+table {
+ margin-top: 1.5rem;
+ line-height: 2rem;
+}
+tr {
+ border-bottom: 1px solid var(--trborder);
+}
+tr:first-child {
+ border-bottom: 1px solid var(--trtopborder);
+}
+tr:last-child {
+ border-bottom: none;
+}
+a {
+ text-decoration: none;
+ font-weight: bold;
+ color: var(--link);
+}
+a:hover {
+ color: #8080ff;
+}
+@media (prefers-color-scheme: dark) {
+ :root {
+ --text: #e9e8fa;
+ --bg: #0F0C28;
+ --h2heading: #B8B7CB;
+ --link: #87cefa;
+ --trtopborder: #394150;
+ --trborder: #212936;
+ --chartborder: #b1b0bf;
+ }
}
</style>
@@ -83,13 +133,14 @@ h3 {
</head>
{% macro poky_link(commit) -%}
- <a href="http://git.yoctoproject.org/cgit/cgit.cgi/poky/log/?id={{ commit }}">{{ commit[0:11] }}</a>
+ <a href="http://git.yoctoproject.org/cgit/cgit.cgi/poky/log/?id={{ commit }}">{{ commit[0:11] }}</a>
{%- endmacro %}
-<body><div style="width: 700px">
+<body><div>
+ <h1 style="text-align: center;">Performance Test Report</h1>
{# Test metadata #}
<h2>General</h2>
- <hr>
+ <h4>The table provides an overview of the comparison between two selected commits from the same branch.</h4>
<table class="meta-table" style="width: 100%">
<tr>
<th></th>
@@ -112,19 +163,21 @@ h3 {
{# Test result summary #}
<h2>Test result summary</h2>
- <hr>
+ <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>
<table class="summary" style="width: 100%">
+ <tr>
+ <th>Test name</th>
+ <th>Measurement description</th>
+ <th>Mean value</th>
+ <th>Absolute difference</th>
+ <th>Relative difference</th>
+ </tr>
{% for test in test_data %}
- {% if loop.index is even %}
- {% set row_style = 'style="background-color: #f2f2f2"' %}
- {% else %}
- {% set row_style = 'style="background-color: #ffffff"' %}
- {% endif %}
{% if test.status == 'SUCCESS' %}
{% for measurement in test.measurements %}
<tr {{ row_style }}>
{% if loop.index == 1 %}
- <td>{{ test.name }}: {{ test.description }}</td>
+ <td><a href=#{{test.name}}>{{ test.name }}: {{ test.description }}</a></td>
{% else %}
{# add empty cell in place of the test name#}
<td></td>
@@ -153,10 +206,12 @@ h3 {
</table>
{# Detailed test results #}
+ <h2>Test details</h2>
+ <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>
{% for test in test_data %}
- <h2>{{ test.name }}: {{ test.description }}</h2>
- <hr>
+ <h3 style="color: #000;" id={{test.name}}>{{ test.name }}: {{ test.description }}</h3>
{% if test.status == 'SUCCESS' %}
+ <div class="card-container">
{% for measurement in test.measurements %}
<div class="measurement">
<h3>{{ measurement.description }}</h3>
@@ -275,7 +330,8 @@ h3 {
{% endif %}
{% endif %}
</div>
- {% endfor %}
+ {% endfor %}
+ </div>
{# Unsuccessful test #}
{% else %}
<span style="font-size: 150%; font-weight: bold; color: red;">{{ test.status }}
diff --git a/scripts/lib/build_perf/report.py b/scripts/lib/build_perf/report.py
index ab77424cc7..f4e6a92e09 100644
--- a/scripts/lib/build_perf/report.py
+++ b/scripts/lib/build_perf/report.py
@@ -294,7 +294,7 @@ class SizeVal(MeasurementVal):
return "null"
return self / 1024
-def measurement_stats(meas, prefix=''):
+def measurement_stats(meas, prefix='', time=0):
"""Get statistics of a measurement"""
if not meas:
return {prefix + 'sample_cnt': 0,
@@ -319,6 +319,8 @@ def measurement_stats(meas, prefix=''):
stats['quantity'] = val_cls.quantity
stats[prefix + 'sample_cnt'] = len(values)
+ # Add start time for both type sysres and disk usage
+ start_time = time
mean_val = val_cls(mean(values))
min_val = val_cls(min(values))
max_val = val_cls(max(values))
@@ -334,6 +336,7 @@ def measurement_stats(meas, prefix=''):
stats[prefix + 'max'] = max_val
stats[prefix + 'minus'] = val_cls(mean_val - min_val)
stats[prefix + 'plus'] = val_cls(max_val - mean_val)
+ stats[prefix + 'start_time'] = start_time
return stats