summaryrefslogtreecommitdiffstats
path: root/scripts/lib/build_perf/html/report.html
blob: 537ed3ee529bf8e89a5bea12915781d1157680cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
<!DOCTYPE html>
<html lang="en">
<head>
{# Scripts, for visualization#}
<!--START-OF-SCRIPTS-->
<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 %}
  {% if test.status == 'SUCCESS' %}
    {% for measurement in test.measurements %}
      {% set chart_elem_id = test.name + '_' + measurement.name + '_chart' %}
      {% include 'measurement_chart.html' %}
    {% endfor %}
  {% endif %}
{% endfor %}

<!--END-OF-SCRIPTS-->

{# 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;
}
.summary {
  font-size: 14px;
  text-align: left;
  border-collapse: collapse;
}
.measurement {
  padding: 8px 0px 8px 8px;
  border: 2px solid var(--chartborder);
  margin: 1.5rem 0;
}
.details {
  margin: 0;
  font-size: 12px;
  text-align: left;
  border-collapse: collapse;
}
.details th {
  padding-right: 8px;
}
.details.plain th {
  font-weight: normal;
}
.preformatted {
  font-family: monospace;
  white-space: pre-wrap;
  background-color: #f0f0f0;
  margin-left: 10px;
}
.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: 1.5rem;
  margin-bottom: 0px;
  color: var(--h2heading);
  padding-top: 1.5rem;
}
h3 {
  font-size: 1.3rem;
  margin: 0px;
  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>

<title>{{ title }}</title>
</head>

{% macro poky_link(commit) -%}
  <a href="http://git.yoctoproject.org/cgit/cgit.cgi/poky/log/?id={{ commit }}">{{ commit[0:11] }}</a>
{%- endmacro %}

<body><div>
  <h1 style="text-align: center;">Performance Test Report</h1>
  {# Test metadata #}
  <h2>General</h2>
  <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>
      <th>Current commit</th>
      <th>Comparing with</th>
    </tr>
    {% for key, item in metadata.items() %}
    <tr>
      <th>{{ item.title }}</th>
      {%if key == 'commit' %}
        <td>{{ poky_link(item.value) }}</td>
        <td>{{ poky_link(item.value_old) }}</td>
      {% else %}
        <td>{{ item.value }}</td>
        <td>{{ item.value_old }}</td>
      {% endif %}
    </tr>
    {% endfor %}
  </table>

  {# Test result summary #}
  <h2>Test result summary</h2>
  <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 test.status == 'SUCCESS' %}
        {% for measurement in test.measurements %}
          <tr {{ row_style }}>
            {% if loop.index == 1 %}
              <td><a href=#{{test.name}}>{{ test.name }}: {{ test.description }}</a></td>
            {% else %}
              {# add empty cell in place of the test name#}
              <td></td>
            {% endif %}
            {% if measurement.absdiff > 0 %}
              {% set result_style = "color: red" %}
            {% elif measurement.absdiff == measurement.absdiff %}
              {% set result_style = "color: green" %}
            {% else %}
              {% set result_style = "color: orange" %}
            {%endif %}
            {% if measurement.reldiff|abs > 2 %}
              {% set result_style = result_style + "; font-weight: bold" %}
            {% endif %}
            <td>{{ measurement.description }}</td>
            <td style="font-weight: bold">{{ measurement.value.mean }}</td>
            <td style="{{ result_style }}">{{ measurement.absdiff_str }}</td>
            <td style="{{ result_style }}">{{ measurement.reldiff_str }}</td>
          </tr>
        {% endfor %}
      {% else %}
        <td style="font-weight: bold; color: red;">{{test.status }}</td>
        <td></td> <td></td> <td></td> <td></td>
      {% endif %}
    {% endfor %}
  </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 %}
  <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>
          <div style="font-weight:bold;">
            <span style="font-size: 23px;">{{ measurement.value.mean }}</span>
            <span style="font-size: 20px; margin-left: 12px">
            {% if measurement.absdiff > 0 %}
            <span style="color: red">
            {% elif measurement.absdiff == measurement.absdiff %}
            <span style="color: green">
            {% else %}
            <span style="color: orange">
            {% endif %}
            {{ measurement.absdiff_str }} ({{measurement.reldiff_str}})
            </span></span>
          </div>
          {# Table for trendchart and the statistics #}
          <table style="width: 100%">
            <tr>
              <td style="width: 75%">
                {# Linechart #}
                <div id="{{ test.name }}_{{ measurement.name }}_chart"></div>
              </td>
              <td>
                {# Measurement statistics #}
                <table class="details plain">
                  <tr>
                    <th>Test runs</th><td>{{ measurement.value.sample_cnt }}</td>
                  </tr><tr>
                    <th>-/+</th><td>-{{ measurement.value.minus }} / +{{ measurement.value.plus }}</td>
                  </tr><tr>
                    <th>Min</th><td>{{ measurement.value.min }}</td>
                  </tr><tr>
                    <th>Max</th><td>{{ measurement.value.max }}</td>
                  </tr><tr>
                    <th>Stdev</th><td>{{ measurement.value.stdev }}</td>
                  </tr><tr>
                    <th><div id="{{ test.name }}_{{ measurement.name }}_chart_png"></div></th>
                    <td></td>
                  </tr>
                </table>
              </td>
            </tr>
          </table>

          {# Task and recipe summary from buildstats #}
          {% if 'buildstats' in measurement %}
            Task resource usage
            <table class="details" style="width:100%">
              <tr>
                <th>Number of tasks</th>
                <th>Top consumers of cputime</th>
              </tr>
              <tr>
                <td style="vertical-align: top">{{ measurement.buildstats.tasks.count }} ({{ measurement.buildstats.tasks.change }})</td>
                {# Table of most resource-hungry tasks #}
                <td>
                  <table class="details plain">
                    {% for diff in measurement.buildstats.top_consumer|reverse %}
                    <tr>
                      <th>{{ diff.pkg }}.{{ diff.task }}</th>
                      <td>{{ '%0.0f' % diff.value2 }} s</td>
                    </tr>
                    {% endfor %}
                  </table>
                </td>
              </tr>
              <tr>
                <th>Biggest increase in cputime</th>
                <th>Biggest decrease in cputime</th>
              </tr>
              <tr>
                {# Table biggest increase in resource usage #}
                <td>
                  <table class="details plain">
                    {% for diff in measurement.buildstats.top_increase|reverse %}
                    <tr>
                      <th>{{ diff.pkg }}.{{ diff.task }}</th>
                      <td>{{ '%+0.0f' % diff.absdiff }} s</td>
                    </tr>
                    {% endfor %}
                  </table>
                </td>
                {# Table biggest decrease in resource usage #}
                <td>
                  <table class="details plain">
                    {% for diff in measurement.buildstats.top_decrease %}
                    <tr>
                      <th>{{ diff.pkg }}.{{ diff.task }}</th>
                      <td>{{ '%+0.0f' % diff.absdiff }} s</td>
                    </tr>
                    {% endfor %}
                  </table>
                </td>
              </tr>
            </table>

            {# Recipe version differences #}
            {% if measurement.buildstats.ver_diff %}
              <div style="margin-top: 16px">Recipe version changes</div>
              <table class="details">
                {% for head, recipes in measurement.buildstats.ver_diff.items() %}
                  <tr>
                    <th colspan="2">{{ head }}</th>
                  </tr>
                  {% for name, info in recipes|sort %}
                    <tr>
                      <td>{{ name }}</td>
                      <td>{{ info }}</td>
                    </tr>
                  {% endfor %}
                {% endfor %}
              </table>
            {% else %}
              <div style="margin-top: 16px">No recipe version changes detected</div>
            {% endif %}
          {% endif %}
        </div>
        {% endfor %}
      </div>
    {# Unsuccessful test #}
    {% else %}
      <span style="font-size: 150%; font-weight: bold; color: red;">{{ test.status }}
      {% if test.err_type %}<span style="font-size: 75%; font-weight: normal">({{ test.err_type }})</span>{% endif %}
      </span>
      <div class="preformatted">{{ test.message }}</div>
    {% endif %}
  {% endfor %}
</div></body>
</html>