| 1 |
<!DOCTYPE html> |
| 2 |
<html lang="en"> |
| 3 |
|
| 4 |
<head> |
| 5 |
<meta charset="utf-8"> |
| 6 |
<title>Linux s2idle Power Report</title> |
| 7 |
<style> |
| 8 |
h1 { |
| 9 |
color: #00b0f0; |
| 10 |
font-family: sans-serif; |
| 11 |
font-size: 42pt; |
| 12 |
} |
| 13 |
|
| 14 |
h2 { |
| 15 |
font-size: 15pt; |
| 16 |
font-family: sans-serif; |
| 17 |
color: #00b0f0; |
| 18 |
margin-top: 2em; |
| 19 |
margin-bottom: 0em; |
| 20 |
letter-spacing: 0.08em; |
| 21 |
} |
| 22 |
|
| 23 |
h3, |
| 24 |
h4, |
| 25 |
h5 { |
| 26 |
font-family: sans-serif; |
| 27 |
margin-top: 1em; |
| 28 |
margin-bottom: 0em; |
| 29 |
letter-spacing: 0.08em; |
| 30 |
} |
| 31 |
|
| 32 |
body { |
| 33 |
|
| 34 |
font-family: sans-serif; |
| 35 |
letter-spacing: 0.02em; |
| 36 |
background-color: #ffffff; |
| 37 |
color: #000000; |
| 38 |
margin: 2em auto; |
| 39 |
max-width: 1200px; |
| 40 |
padding: 0 2em; |
| 41 |
|
| 42 |
} |
| 43 |
|
| 44 |
table, |
| 45 |
th, |
| 46 |
td { |
| 47 |
border: 1px solid #ddd; |
| 48 |
border-collapse: collapse; |
| 49 |
table-layout: fixed; |
| 50 |
font-family: sans-serif; |
| 51 |
letter-spacing: 0.02em; |
| 52 |
color: #000000; |
| 53 |
text-align: left; |
| 54 |
padding: 8px; |
| 55 |
} |
| 56 |
|
| 57 |
th { |
| 58 |
background-color: #f8f9fa; |
| 59 |
position: sticky; |
| 60 |
top: 0; |
| 61 |
z-index: 10; |
| 62 |
} |
| 63 |
|
| 64 |
tr:not(.row-low):not(.row-neutral):not(.row-high):nth-child(even) { |
| 65 |
background-color: #f9f9f9; |
| 66 |
} |
| 67 |
|
| 68 |
tr:hover { |
| 69 |
background-color: #f2f2f2 !important; |
| 70 |
} |
| 71 |
|
| 72 |
#prereqdebugdata > tbody > tr:hover, |
| 73 |
#cycledata > tbody > tr:hover, |
| 74 |
#failuredata > tbody > tr:hover, |
| 75 |
#debugdata > tbody > tr:hover, |
| 76 |
#prereqdebugdata > tr:hover, |
| 77 |
#cycledata > tr:hover, |
| 78 |
#failuredata > tr:hover, |
| 79 |
#debugdata > tr:hover { |
| 80 |
background-color: transparent !important; |
| 81 |
} |
| 82 |
|
| 83 |
.○ { |
| 84 |
font-family: "Fira Code", monospace; |
| 85 |
color: #000000; |
| 86 |
} |
| 87 |
|
| 88 |
.❌ { |
| 89 |
color: #ff0000; |
| 90 |
font-family: "Fira Code", monospace; |
| 91 |
} |
| 92 |
|
| 93 |
.🚦 { |
| 94 |
color: #a4a100; |
| 95 |
font-family: "Fira Code", monospace; |
| 96 |
} |
| 97 |
|
| 98 |
.🦟 { |
| 99 |
color: #848484; |
| 100 |
font-family: "Fira Code", monospace; |
| 101 |
} |
| 102 |
|
| 103 |
.hidden-by-default { |
| 104 |
display: none; |
| 105 |
opacity: 0; |
| 106 |
transition: opacity 0.3s ease; |
| 107 |
} |
| 108 |
|
| 109 |
.collapsible-wrapper { |
| 110 |
overflow: hidden; |
| 111 |
max-height: 0; |
| 112 |
opacity: 0; |
| 113 |
transition: max-height 0.4s ease-out, opacity 0.3s ease; |
| 114 |
} |
| 115 |
|
| 116 |
.collapsible-wrapper.expanded { |
| 117 |
opacity: 1; |
| 118 |
} |
| 119 |
|
| 120 |
.hide-borders { |
| 121 |
border: 0px; |
| 122 |
border-collapse: collapse; |
| 123 |
} |
| 124 |
|
| 125 |
.row-disabled { |
| 126 |
display: none; |
| 127 |
opacity: 0; |
| 128 |
} |
| 129 |
|
| 130 |
@keyframes fadeIn { |
| 131 |
from { opacity: 0; } |
| 132 |
to { opacity: 1; } |
| 133 |
} |
| 134 |
|
| 135 |
.row-active { |
| 136 |
display: table-row !important; |
| 137 |
animation: fadeIn 0.5s ease forwards; |
| 138 |
} |
| 139 |
|
| 140 |
.arrow { |
| 141 |
cursor: pointer; |
| 142 |
display: inline-block; |
| 143 |
} |
| 144 |
|
| 145 |
.arrow::before { |
| 146 |
content: "\23f5"; |
| 147 |
margin-right: 5px; |
| 148 |
} |
| 149 |
|
| 150 |
.arrow-expanded::before { |
| 151 |
content: "\23F7"; |
| 152 |
} |
| 153 |
|
| 154 |
@media (prefers-color-scheme: dark) { |
| 155 |
body { |
| 156 |
background-color: #121212; |
| 157 |
color: #e0e0e0; |
| 158 |
} |
| 159 |
table, th, td { |
| 160 |
border-color: #333; |
| 161 |
color: #e0e0e0; |
| 162 |
} |
| 163 |
th { |
| 164 |
background-color: #1e1e1e; |
| 165 |
} |
| 166 |
tr:not(.row-low):not(.row-neutral):not(.row-high):nth-child(even) { |
| 167 |
background-color: #1a1a1a; |
| 168 |
} |
| 169 |
tr:hover { |
| 170 |
background-color: #2a2a2a !important; |
| 171 |
} |
| 172 |
.row-low { background-color: #1b4d1b; } |
| 173 |
.row-low:hover { background-color: #266b26; } |
| 174 |
.row-neutral { background-color: #333; } |
| 175 |
.row-neutral:hover { background-color: #444; } |
| 176 |
.row-high { background-color: #611a14; } |
| 177 |
.row-high:hover { background-color: #8a251d; } |
| 178 |
.○ { color: #e0e0e0; } |
| 179 |
.🦟 { color: #aaa; } |
| 180 |
#prereqdebugdata > tbody > tr:hover, |
| 181 |
#cycledata > tbody > tr:hover, |
| 182 |
#failuredata > tbody > tr:hover, |
| 183 |
#debugdata > tbody > tr:hover, |
| 184 |
#prereqdebugdata > tr:hover, |
| 185 |
#cycledata > tr:hover, |
| 186 |
#failuredata > tr:hover, |
| 187 |
#debugdata > tr:hover { |
| 188 |
background-color: transparent !important; |
| 189 |
} |
| 190 |
} |
| 191 |
</style> |
| 192 |
</head> |
| 193 |
|
| 194 |
<body> |
| 195 |
<script> |
| 196 |
function select_changed(selector, row) { |
| 197 |
var x = document.getElementById(selector).value; |
| 198 |
var rows = document.querySelectorAll(row + " tr.row-disabled"); |
| 199 |
for (var i = 0; i < rows.length; i++) { |
| 200 |
rows[i].classList.remove("row-active"); |
| 201 |
} |
| 202 |
if (x != "0") { |
| 203 |
var target = document.querySelector(row + x); |
| 204 |
if (target) { |
| 205 |
target.classList.add("row-active"); |
| 206 |
} |
| 207 |
if (row == row + x) |
| 208 |
document.getElementById(selector).value = 0; |
| 209 |
} |
| 210 |
} |
| 211 |
function cycle_data_changed() { |
| 212 |
select_changed("cycles", "#cycledata") |
| 213 |
} |
| 214 |
|
| 215 |
function failure_data_changed() { |
| 216 |
select_changed("failures", "#failuredata") |
| 217 |
} |
| 218 |
|
| 219 |
function debug_data_changed() { |
| 220 |
select_changed("debug", "#debugdata") |
| 221 |
var label = document.getElementById("debug_label"); |
| 222 |
if (document.getElementById("debug").value != "0") { |
| 223 |
label.style.display = "block"; |
| 224 |
setTimeout(() => label.style.opacity = "1", 10); |
| 225 |
} else { |
| 226 |
label.style.opacity = "0"; |
| 227 |
setTimeout(() => label.style.display = "none", 300); |
| 228 |
} |
| 229 |
} |
| 230 |
|
| 231 |
function prereq_debug_data_changed() { |
| 232 |
var wrapper = document.getElementById("prereqdebugdata-wrapper"); |
| 233 |
var arrow = document.getElementById("prereqdata-arrow"); |
| 234 |
if (wrapper.classList.contains("expanded")) { |
| 235 |
wrapper.classList.remove("expanded"); |
| 236 |
arrow.classList.remove("arrow-expanded"); |
| 237 |
wrapper.style.maxHeight = "0px"; |
| 238 |
} else { |
| 239 |
wrapper.classList.add("expanded"); |
| 240 |
arrow.classList.add("arrow-expanded"); |
| 241 |
wrapper.style.maxHeight = wrapper.scrollHeight + "px"; |
| 242 |
} |
| 243 |
} |
| 244 |
|
| 245 |
function sync_prereq_wrapper_height() { |
| 246 |
var wrapper = document.getElementById("prereqdebugdata-wrapper"); |
| 247 |
if (wrapper && wrapper.classList.contains("expanded")) { |
| 248 |
wrapper.style.maxHeight = wrapper.scrollHeight + "px"; |
| 249 |
} |
| 250 |
} |
| 251 |
|
| 252 |
function parseTimeToSeconds(timeString) { |
| 253 |
var timeParts = timeString.split(":"); |
| 254 |
var hours = parseInt(timeParts[0]); |
| 255 |
var minutes = parseInt(timeParts[1]); |
| 256 |
var seconds = parseInt(timeParts[2]); |
| 257 |
return (hours * 3600) + (minutes * 60) + seconds; |
| 258 |
} |
| 259 |
|
| 260 |
function pick_data_for_cycle(num) { |
| 261 |
//show cycles messages for this cycle |
| 262 |
document.getElementById("cycles").selectedIndex = num + 1; |
| 263 |
cycle_data_changed(); |
| 264 |
{% if failures %} |
| 265 |
//show failures messages for this cycle |
| 266 |
document.getElementById("failures").value = num + 1; |
| 267 |
failure_data_changed(); |
| 268 |
{% endif %} |
| 269 |
{% if debug_data %} |
| 270 |
//show debug data for this cycle |
| 271 |
document.getElementById("debug").selectedIndex = num + 1; |
| 272 |
debug_data_changed(); |
| 273 |
{% endif %} |
| 274 |
} |
| 275 |
|
| 276 |
function summary_data_changed(ev) { |
| 277 |
var table = document.getElementById("summary"); |
| 278 |
const start_select = document.getElementById('start_select'); |
| 279 |
const end_select = document.getElementById('end_select'); |
| 280 |
|
| 281 |
if (!start_select || !end_select) return; |
| 282 |
|
| 283 |
var start = parseInt(start_select.value); |
| 284 |
var end = parseInt(end_select.value); |
| 285 |
|
| 286 |
// reset end if start was picked bigger than end |
| 287 |
if (start > end) { |
| 288 |
end_select.selectedIndex = start; |
| 289 |
end = start; |
| 290 |
} |
| 291 |
|
| 292 |
var min_duration = 0; |
| 293 |
if (document.getElementById('med_duration').checked) |
| 294 |
min_duration = document.getElementById("med_duration").value; |
| 295 |
else if (document.getElementById('min_duration').checked) |
| 296 |
min_duration = document.getElementById("min_duration").value; |
| 297 |
|
| 298 |
// show all rows between start and end |
| 299 |
var rows = table.tBodies[0].rows; |
| 300 |
for (var i = 0; i < rows.length; i++) { |
| 301 |
var row = rows[i]; |
| 302 |
var index_cell = row.cells[0]; |
| 303 |
if (!index_cell) continue; |
| 304 |
|
| 305 |
var index = parseInt(index_cell.textContent); |
| 306 |
var duration_cell = row.cells[2]; |
| 307 |
var row_duration = duration_cell ? parseTimeToSeconds(duration_cell.textContent) : 0; |
| 308 |
|
| 309 |
if (row_duration >= min_duration && |
| 310 |
index >= start && index <= end) { |
| 311 |
row.style.display = ""; |
| 312 |
} else { |
| 313 |
row.style.display = "none"; |
| 314 |
} |
| 315 |
} |
| 316 |
|
| 317 |
// reset other tables if we now show more than one cycle |
| 318 |
if (end - start > 0) { |
| 319 |
var cycles_select = document.getElementById("cycles"); |
| 320 |
if (cycles_select) { |
| 321 |
cycles_select.selectedIndex = 0; |
| 322 |
cycle_data_changed(); |
| 323 |
} |
| 324 |
{% if failures %} |
| 325 |
var failures_select = document.getElementById("failures"); |
| 326 |
if (failures_select) { |
| 327 |
failures_select.value = 0; |
| 328 |
failure_data_changed(); |
| 329 |
} |
| 330 |
{% endif %} |
| 331 |
{% if debug_data %} |
| 332 |
var debug_select = document.getElementById("debug"); |
| 333 |
if (debug_select) { |
| 334 |
debug_select.selectedIndex = 0; |
| 335 |
debug_data_changed(); |
| 336 |
} |
| 337 |
{% endif %} |
| 338 |
} else if (start == end) { |
| 339 |
pick_data_for_cycle(start); |
| 340 |
} |
| 341 |
} |
| 342 |
|
| 343 |
function populate_summary_selectors() { |
| 344 |
const table = document.getElementById('summary'); |
| 345 |
const start_select = document.getElementById('start_select'); |
| 346 |
const end_select = document.getElementById('end_select'); |
| 347 |
|
| 348 |
if (!start_select || !end_select || !table || !table.tBodies || !table.tBodies[0]) return; |
| 349 |
|
| 350 |
var rows = table.tBodies[0].rows; |
| 351 |
for (let i = 0; i < rows.length; i++) { |
| 352 |
const start_option = document.createElement('option'); |
| 353 |
const end_option = document.createElement('option'); |
| 354 |
var columns = rows[i].getElementsByTagName("td"); |
| 355 |
|
| 356 |
//Populate all start/end selector values |
| 357 |
start_option.text = `Cycle ${i}`; |
| 358 |
start_option.value = i; |
| 359 |
end_option.text = `Cycle ${i}`; |
| 360 |
end_option.value = i; |
| 361 |
start_select.add(start_option); |
| 362 |
end_select.add(end_option); |
| 363 |
|
| 364 |
if (columns.length > 2) { |
| 365 |
//apply coloring to hardware sleep |
| 366 |
if (parseFloat(columns[2].innerHTML) < 85) |
| 367 |
rows[i].className = "row-high"; |
| 368 |
} |
| 369 |
} |
| 370 |
|
| 371 |
// Pick the end selector for last column |
| 372 |
end_select.selectedIndex = rows.length - 1; |
| 373 |
|
| 374 |
summary_data_changed(event); |
| 375 |
|
| 376 |
// if we only have one cycle then pick it |
| 377 |
if (rows.length == 1) { |
| 378 |
pick_summary_cycle(0) |
| 379 |
} |
| 380 |
} |
| 381 |
|
| 382 |
function pick_summary_cycle(num) { |
| 383 |
document.getElementById('start_select').selectedIndex = num; |
| 384 |
document.getElementById('end_select').selectedIndex = num; |
| 385 |
summary_data_changed(event); |
| 386 |
pick_data_for_cycle(num); |
| 387 |
} |
| 388 |
|
| 389 |
function reset_clicked() { |
| 390 |
const table = document.getElementById('summary'); |
| 391 |
var rows = table.tBodies[0].rows; |
| 392 |
document.getElementById('start_select').selectedIndex = 0; |
| 393 |
document.getElementById('end_select').selectedIndex = rows.length - 1; |
| 394 |
document.getElementById('all_time').checked = true; |
| 395 |
summary_data_changed(event); |
| 396 |
} |
| 397 |
|
| 398 |
window.addEventListener('load', populate_summary_selectors); |
| 399 |
window.addEventListener('resize', sync_prereq_wrapper_height); |
| 400 |
</script> |
| 401 |
<h1>Linux s2idle Power Report</h1> |
| 402 |
<p>s2idle report created {{ date }} using amd-s2idle {{version}}</p> |
| 403 |
{% if prereq %} |
| 404 |
<table class="hide-borders"> |
| 405 |
{% for obj in prereq %} |
| 406 |
<TR> |
| 407 |
<TD>{{obj.symbol}}</TD> |
| 408 |
<TD>{{obj.text}}</TD> |
| 409 |
</TR> |
| 410 |
{% endfor %} |
| 411 |
</table> |
| 412 |
{% endif %} |
| 413 |
{% if prereq_debug_data %} |
| 414 |
<h3> |
| 415 |
<span id="prereqdata-arrow" onclick="prereq_debug_data_changed()" class="arrow">Prerequisites</span> |
| 416 |
</h3> |
| 417 |
<div id="prereqdebugdata-wrapper" class="collapsible-wrapper"> |
| 418 |
<table id="prereqdebugdata" class="hide-borders"> |
| 419 |
{% for obj in prereq_debug_data %} |
| 420 |
<TR> |
| 421 |
<TD> |
| 422 |
<pre>{{obj.data}}</pre> |
| 423 |
</TD> |
| 424 |
</TR> |
| 425 |
{% endfor %} |
| 426 |
</table> |
| 427 |
</div> |
| 428 |
{% endif %} |
| 429 |
<h2>Summary</h2> |
| 430 |
{% if battery_svg %} |
| 431 |
<h3>Battery</h3> |
| 432 |
{{ battery_svg | safe }} |
| 433 |
{% endif %} |
| 434 |
{% if hwsleep_svg %} |
| 435 |
<h3>Low power state residency</h3> |
| 436 |
{{ hwsleep_svg | safe }} |
| 437 |
{% endif %} |
| 438 |
{% if cycle_data|length > 1 %} |
| 439 |
<h3>Cycle data</h3> |
| 440 |
<p>Choose a single cycle to see messages and data for that cycle.</p> |
| 441 |
<button type="button" onclick="reset_clicked()">Reset</button> |
| 442 |
<h4>Filter cycle range</h4> |
| 443 |
<select id="start_select" onchange="summary_data_changed(event)"></select> |
| 444 |
and |
| 445 |
<select id="end_select" onchange="summary_data_changed(event)"></select> |
| 446 |
<h4>Filter minimum session length</h4> |
| 447 |
<input type="radio" name="session1" id="all_time" value="all_time" onchange="summary_data_changed(event)" |
| 448 |
checked="" /> |
| 449 |
<label>All</label> |
| 450 |
<input type="radio" name="session1" id="med_duration" value="600" onchange="summary_data_changed(event)" /> |
| 451 |
<label>>10 min</label> |
| 452 |
<input type="radio" name="session1" id="min_duration" value="60" onchange="summary_data_changed(event)" /> |
| 453 |
<label>>1 min</label> |
| 454 |
{% else %} |
| 455 |
<select id="start_select" class="hidden-by-default"></select> |
| 456 |
<select id="end_select" class="hidden-by-default"></select> |
| 457 |
<input type="radio" name="session1" id="all_time" value="all_time" checked="" class="hidden-by-default" /> |
| 458 |
<input type="radio" name="session1" id="med_duration" value="600" class="hidden-by-default" /> |
| 459 |
<input type="radio" name="session1" id="min_duration" value="60" class="hidden-by-default" /> |
| 460 |
{% endif %} |
| 461 |
{{ summary | safe }} |
| 462 |
{% if cycle_data %} |
| 463 |
<p><label for="cycle" class="hidden-by-default">Choose a cycle:</label> |
| 464 |
<select id="cycles" onchange="cycle_data_changed()" class="hidden-by-default"> |
| 465 |
<option value="0">Disabled</option> |
| 466 |
{% for obj in cycle_data %} |
| 467 |
<option value="{{obj.cycle_num + 1}}">Cycle {{obj.cycle_num}}</option> |
| 468 |
{% endfor %} |
| 469 |
</select> |
| 470 |
</p> |
| 471 |
<table id="cycledata" class="hide-borders"> |
| 472 |
{% for obj in cycle_data %} |
| 473 |
<TR class="row-disabled" id="cycledata{{obj.cycle_num + 1}}"> |
| 474 |
<TD>{{obj.data}}</TD> |
| 475 |
</TR> |
| 476 |
{% endfor %} |
| 477 |
</table> |
| 478 |
{% endif %} |
| 479 |
{% if failures %} |
| 480 |
<p><label for="failure" class="hidden-by-default">Choose a cycle:</label> |
| 481 |
<select id="failures" onchange="failure_data_changed()" class="hidden-by-default"> |
| 482 |
<option value="0">Disabled</option> |
| 483 |
{% for obj in failures %} |
| 484 |
<option value="{{obj.cycle_num + 1}}">Cycle {{obj.cycle_num}}</option> |
| 485 |
{% endfor %} |
| 486 |
</select> |
| 487 |
</p> |
| 488 |
<table id="failuredata" class="hide-borders"> |
| 489 |
{% for obj in failures %} |
| 490 |
<TR class="row-disabled" id="failuredata{{obj.cycle_num + 1}}"> |
| 491 |
<TD>{{obj.problem}}</TD> |
| 492 |
<TD>{{obj.data}}</TD> |
| 493 |
</TR> |
| 494 |
{% endfor %} |
| 495 |
</table> |
| 496 |
{% endif %} |
| 497 |
{% if debug_data %} |
| 498 |
<h3 id="debug_label" style="display:none; transition: opacity 0.3s ease; opacity: 0;">Debugging 🦟</h3> |
| 499 |
<p><label for="debug" class="hidden-by-default">Choose a cycle:</label> |
| 500 |
<select id="debug" onchange="debug_data_changed()" class="hidden-by-default"> |
| 501 |
<option value="0">Disabled</option> |
| 502 |
{% for obj in debug_data %} |
| 503 |
<option value="{{obj.cycle_num + 1}}">Cycle {{obj.cycle_num}}</option> |
| 504 |
{% endfor %} |
| 505 |
</select> |
| 506 |
</p> |
| 507 |
<table id="debugdata" class="hide-borders"> |
| 508 |
{% for obj in debug_data %} |
| 509 |
<TR class="row-disabled" id="debugdata{{obj.cycle_num + 1}}"> |
| 510 |
<TD> |
| 511 |
{% for index in range(obj.messages | length) %} |
| 512 |
<div class="{{obj.priorities[index]}}">{{obj.messages[index]}}</div> |
| 513 |
{% endfor %} |
| 514 |
</TD> |
| 515 |
</TR> |
| 516 |
{% endfor %} |
| 517 |
</table> |
| 518 |
{% endif %} |
| 519 |
</body> |
| 520 |
|
| 521 |
</html> |