xref: /openbmc/openbmc/poky/scripts/lib/build_perf/html/report.html (revision 43a6b7c2a48b0cb1381af4d3192d22a12ead65f0)
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>
409