amd-debug-tools 0.2.14__tar.gz → 0.2.16__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {amd_debug_tools-0.2.14/src/amd_debug_tools.egg-info → amd_debug_tools-0.2.16}/PKG-INFO +1 -1
- {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/src/amd_debug/battery.py +23 -11
- {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/src/amd_debug/common.py +13 -1
- {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/src/amd_debug/failures.py +4 -3
- {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/src/amd_debug/prerequisites.py +11 -7
- {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/src/amd_debug/s2idle-hook +5 -1
- {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/src/amd_debug/s2idle.py +12 -6
- {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/src/amd_debug/sleep_report.py +2 -1
- {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/src/amd_debug/templates/html +193 -110
- {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/src/amd_debug/validator.py +2 -4
- {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16/src/amd_debug_tools.egg-info}/PKG-INFO +1 -1
- {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/src/test_batteries.py +66 -7
- {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/src/test_prerequisites.py +4 -4
- {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/src/test_s2idle.py +7 -4
- {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/src/test_sleep_report.py +19 -0
- {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/src/test_validator.py +0 -2
- {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/.github/workflows/ci.yml +0 -0
- {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/.github/workflows/mirror.yml +0 -0
- {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/.gitignore +0 -0
- {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/.pre-commit-config.yaml +0 -0
- {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/.vscode/settings.json +0 -0
- {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/LICENSE +0 -0
- {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/Makefile +0 -0
- {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/README.md +0 -0
- {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/amd_bios.py +0 -0
- {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/amd_pstate.py +0 -0
- {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/amd_s2idle.py +0 -0
- {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/amd_ttm.py +0 -0
- {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/docs/amd-bios.md +0 -0
- {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/docs/amd-pstate.md +0 -0
- {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/docs/amd-s2idle.md +0 -0
- {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/docs/amd-ttm.md +0 -0
- {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/docs/in-tree.md +0 -0
- {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/install_deps.py +0 -0
- {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/psr.py +0 -0
- {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/pyproject.toml +0 -0
- {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/setup.cfg +0 -0
- {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/src/amd_debug/__init__.py +0 -0
- {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/src/amd_debug/acpi.py +0 -0
- {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/src/amd_debug/bash/amd-s2idle +0 -0
- {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/src/amd_debug/bios.py +0 -0
- {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/src/amd_debug/database.py +0 -0
- {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/src/amd_debug/display.py +0 -0
- {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/src/amd_debug/installer.py +0 -0
- {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/src/amd_debug/kernel.py +0 -0
- {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/src/amd_debug/pstate.py +0 -0
- {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/src/amd_debug/templates/md +0 -0
- {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/src/amd_debug/templates/stdout +0 -0
- {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/src/amd_debug/templates/txt +0 -0
- {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/src/amd_debug/ttm.py +0 -0
- {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/src/amd_debug/wake.py +0 -0
- {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/src/amd_debug_tools.egg-info/SOURCES.txt +0 -0
- {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/src/amd_debug_tools.egg-info/dependency_links.txt +0 -0
- {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/src/amd_debug_tools.egg-info/entry_points.txt +0 -0
- {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/src/amd_debug_tools.egg-info/requires.txt +0 -0
- {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/src/amd_debug_tools.egg-info/top_level.txt +0 -0
- {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/src/launcher.py +0 -0
- {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/src/test_acpi.py +0 -0
- {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/src/test_bios.py +0 -0
- {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/src/test_common.py +0 -0
- {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/src/test_database.py +0 -0
- {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/src/test_display.py +0 -0
- {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/src/test_failures.py +0 -0
- {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/src/test_installer.py +0 -0
- {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/src/test_kernel.py +0 -0
- {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/src/test_launcher.py +0 -0
- {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/src/test_pstate.py +0 -0
- {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/src/test_ttm.py +0 -0
- {amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/src/test_wake.py +0 -0
|
@@ -38,15 +38,24 @@ class Batteries:
|
|
|
38
38
|
names.append(_get_property(dev.properties, "POWER_SUPPLY_NAME", "Unknown"))
|
|
39
39
|
return names
|
|
40
40
|
|
|
41
|
-
def
|
|
42
|
-
"""Get the
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
def _get_design_voltage(self, dev) -> str:
|
|
42
|
+
"""Get the design voltage in µV for the given battery"""
|
|
43
|
+
for key in [
|
|
44
|
+
"POWER_SUPPLY_VOLTAGE_MAX_DESIGN",
|
|
45
|
+
"POWER_SUPPLY_VOLTAGE_MIN_DESIGN",
|
|
46
|
+
"POWER_SUPPLY_VOLTAGE_NOW",
|
|
47
|
+
]:
|
|
48
|
+
voltage = _get_property(dev.properties, key)
|
|
49
|
+
if voltage:
|
|
50
|
+
return voltage
|
|
51
|
+
return ""
|
|
52
|
+
|
|
53
|
+
def _charge_to_energy(self, dev, charge):
|
|
54
|
+
"""Convert battery charge in µAh to energy in µWh"""
|
|
55
|
+
voltage = self._get_design_voltage(dev)
|
|
56
|
+
if not charge or not voltage:
|
|
45
57
|
return ""
|
|
46
|
-
|
|
47
|
-
if energy:
|
|
48
|
-
return "µWh"
|
|
49
|
-
return "µAh"
|
|
58
|
+
return str(round(int(charge) * int(voltage) / 1000000))
|
|
50
59
|
|
|
51
60
|
def get_energy(self, name) -> int:
|
|
52
61
|
"""Get the current energy for the given battery name"""
|
|
@@ -55,7 +64,8 @@ class Batteries:
|
|
|
55
64
|
return ""
|
|
56
65
|
energy = _get_property(dev.properties, "POWER_SUPPLY_ENERGY_NOW")
|
|
57
66
|
if not energy:
|
|
58
|
-
|
|
67
|
+
charge = _get_property(dev.properties, "POWER_SUPPLY_CHARGE_NOW")
|
|
68
|
+
energy = self._charge_to_energy(dev, charge)
|
|
59
69
|
return energy
|
|
60
70
|
|
|
61
71
|
def get_energy_full(self, name) -> int:
|
|
@@ -65,7 +75,8 @@ class Batteries:
|
|
|
65
75
|
return ""
|
|
66
76
|
energy = _get_property(dev.properties, "POWER_SUPPLY_ENERGY_FULL")
|
|
67
77
|
if not energy:
|
|
68
|
-
|
|
78
|
+
charge = _get_property(dev.properties, "POWER_SUPPLY_CHARGE_FULL")
|
|
79
|
+
energy = self._charge_to_energy(dev, charge)
|
|
69
80
|
return energy
|
|
70
81
|
|
|
71
82
|
def get_description_string(self, name) -> str:
|
|
@@ -78,9 +89,10 @@ class Batteries:
|
|
|
78
89
|
full = self.get_energy_full(name)
|
|
79
90
|
full_design = _get_property(dev.properties, "POWER_SUPPLY_ENERGY_FULL_DESIGN")
|
|
80
91
|
if not full_design:
|
|
81
|
-
|
|
92
|
+
charge_full_design = _get_property(
|
|
82
93
|
dev.properties, "POWER_SUPPLY_CHARGE_FULL_DESIGN"
|
|
83
94
|
)
|
|
95
|
+
full_design = self._charge_to_energy(dev, charge_full_design)
|
|
84
96
|
|
|
85
97
|
percent = float(full) / int(full_design)
|
|
86
98
|
return f"Battery {name} ({man} {model}) is operating at {percent:.2%} of design"
|
|
@@ -382,7 +382,19 @@ def relaunch_sudo() -> None:
|
|
|
382
382
|
"""Relaunch the script with sudo if not already running as root"""
|
|
383
383
|
if not is_root():
|
|
384
384
|
logging.debug("Relaunching with sudo")
|
|
385
|
-
|
|
385
|
+
env_vars = []
|
|
386
|
+
for var in ["DISPLAY", "WAYLAND_DISPLAY", "XAUTHORITY", "XDG_RUNTIME_DIR",
|
|
387
|
+
"DBUS_SESSION_BUS_ADDRESS", "XDG_SESSION_TYPE"]:
|
|
388
|
+
value = os.environ.get(var)
|
|
389
|
+
if value:
|
|
390
|
+
env_vars.append(f"{var}={value}")
|
|
391
|
+
|
|
392
|
+
if env_vars:
|
|
393
|
+
sudo_cmd = ["sudo"] + [f"--preserve-env={var.split('=')[0]}" for var in env_vars] + sys.argv
|
|
394
|
+
else:
|
|
395
|
+
sudo_cmd = ["sudo"] + sys.argv
|
|
396
|
+
|
|
397
|
+
os.execvp("sudo", sudo_cmd)
|
|
386
398
|
|
|
387
399
|
|
|
388
400
|
def running_ssh():
|
|
@@ -632,9 +632,10 @@ class MissingAmdCaptureModule(S0i3Failure):
|
|
|
632
632
|
super().__init__()
|
|
633
633
|
self.description = "AMD Capture module is missing"
|
|
634
634
|
self.explanation = (
|
|
635
|
-
"The amd_capture module is required for the
|
|
636
|
-
"with the SOC to enter the proper
|
|
637
|
-
"Be sure that the amd_capture
|
|
635
|
+
"The amd_capture/amd_isp4_capture module is required for the "
|
|
636
|
+
"camera interface included with the SOC to enter the proper "
|
|
637
|
+
"power states. Be sure that the amd_capture or amd_isp4_capture "
|
|
638
|
+
"modules are loaded."
|
|
638
639
|
""
|
|
639
640
|
"If the module is not available, disable the camera in the BIOS to prevent issues."
|
|
640
641
|
)
|
|
@@ -353,8 +353,11 @@ class PrerequisiteValidator(AmdTool):
|
|
|
353
353
|
self.failures += [MissingDriver(slot)]
|
|
354
354
|
return False
|
|
355
355
|
p = os.path.join(device.sys_path, "fw_version")
|
|
356
|
-
|
|
357
|
-
|
|
356
|
+
if os.path.exists(p):
|
|
357
|
+
xdna_fw_version = read_file(p)
|
|
358
|
+
self.db.record_prereq(
|
|
359
|
+
f"NPU loaded with firmware {xdna_fw_version}", "✅"
|
|
360
|
+
)
|
|
358
361
|
return True
|
|
359
362
|
|
|
360
363
|
def check_amd_hsmp(self):
|
|
@@ -1025,15 +1028,16 @@ class PrerequisiteValidator(AmdTool):
|
|
|
1025
1028
|
self.db.record_prereq(
|
|
1026
1029
|
f"ISP4 platform camera driver 'amd-isp4' bound to {dev.sys_name}", "✅"
|
|
1027
1030
|
)
|
|
1028
|
-
# check if `amd_capture`
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
+
# check if `amd_capture` or `amd_isp4_capture` modules are loaded
|
|
1032
|
+
p1 = os.path.join("/", "sys", "module", "amd_capture")
|
|
1033
|
+
p2 = os.path.join("/", "sys", "module", "amd_isp4_capture")
|
|
1034
|
+
if not os.path.exists(p1) and not os.path.exists(p2):
|
|
1031
1035
|
self.db.record_prereq(
|
|
1032
|
-
"Camera driver module 'amd_capture' not loaded", "❌"
|
|
1036
|
+
"Camera driver module 'amd_capture'/'amd_isp4_capture' not loaded", "❌"
|
|
1033
1037
|
)
|
|
1034
1038
|
self.failures += [MissingAmdCaptureModule()]
|
|
1035
1039
|
return False
|
|
1036
|
-
self.db.record_prereq("Camera driver module 'amd_capture' loaded", "✅")
|
|
1040
|
+
self.db.record_prereq("Camera driver module 'amd_capture'/'amd_isp4_capture' loaded", "✅")
|
|
1037
1041
|
return True
|
|
1038
1042
|
|
|
1039
1043
|
def map_acpi_path(self):
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
import argparse
|
|
5
5
|
import logging
|
|
6
|
+
import os
|
|
6
7
|
import sys
|
|
7
8
|
|
|
8
9
|
|
|
@@ -59,7 +60,10 @@ def parse_args():
|
|
|
59
60
|
if __name__ == "__main__":
|
|
60
61
|
args = parse_args()
|
|
61
62
|
|
|
62
|
-
if
|
|
63
|
+
if (
|
|
64
|
+
args.mode != "suspend"
|
|
65
|
+
and not os.getenv("SYSTEMD_SLEEP_ACTION", "").startswith("suspend")
|
|
66
|
+
):
|
|
63
67
|
sys.exit(0)
|
|
64
68
|
|
|
65
69
|
if args.path:
|
|
@@ -60,14 +60,20 @@ def display_report_file(fname, fmt) -> None:
|
|
|
60
60
|
return
|
|
61
61
|
user = os.environ.get("SUDO_USER")
|
|
62
62
|
if user:
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
63
|
+
env_vars = []
|
|
64
|
+
for var in ["DISPLAY", "WAYLAND_DISPLAY", "XAUTHORITY", "XDG_RUNTIME_DIR",
|
|
65
|
+
"DBUS_SESSION_BUS_ADDRESS", "XDG_SESSION_TYPE"]:
|
|
66
|
+
value = os.environ.get(var)
|
|
67
|
+
if value:
|
|
68
|
+
env_vars.append(f"{var}={value}")
|
|
69
|
+
|
|
70
|
+
if env_vars:
|
|
71
|
+
cmd = ["sudo", "-u", user] + [f"env"] + env_vars + ["xdg-open", fname]
|
|
72
|
+
subprocess.call(cmd)
|
|
67
73
|
else:
|
|
68
74
|
print(
|
|
69
|
-
"
|
|
70
|
-
|
|
75
|
+
"Unable to detect graphical session environment. "
|
|
76
|
+
"Report saved to: " + fname
|
|
71
77
|
)
|
|
72
78
|
|
|
73
79
|
|
|
@@ -163,7 +163,8 @@ class SleepReport(AmdTool):
|
|
|
163
163
|
(self.df["b1"] - self.df["b0"]) / self.df["full"] * 100
|
|
164
164
|
)
|
|
165
165
|
self.df["Battery Ave Rate"] = (
|
|
166
|
-
(self.df["b1"] - self.df["b0"]) /
|
|
166
|
+
(self.df["b1"] - self.df["b0"]) / 1000000
|
|
167
|
+
/ (self.df["Duration"] / 3600)
|
|
167
168
|
)
|
|
168
169
|
|
|
169
170
|
# Wake sources
|
|
@@ -35,21 +35,49 @@
|
|
|
35
35
|
letter-spacing: 0.02em;
|
|
36
36
|
background-color: #ffffff;
|
|
37
37
|
color: #000000;
|
|
38
|
-
margin:
|
|
38
|
+
margin: 2em auto;
|
|
39
|
+
max-width: 1200px;
|
|
40
|
+
padding: 0 2em;
|
|
39
41
|
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
table,
|
|
43
45
|
th,
|
|
44
46
|
td {
|
|
45
|
-
border
|
|
47
|
+
border: 1px solid #ddd;
|
|
46
48
|
border-collapse: collapse;
|
|
47
49
|
table-layout: fixed;
|
|
48
50
|
font-family: sans-serif;
|
|
49
51
|
letter-spacing: 0.02em;
|
|
50
52
|
color: #000000;
|
|
51
53
|
text-align: left;
|
|
52
|
-
padding:
|
|
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;
|
|
53
81
|
}
|
|
54
82
|
|
|
55
83
|
.○ {
|
|
@@ -74,9 +102,20 @@
|
|
|
74
102
|
|
|
75
103
|
.hidden-by-default {
|
|
76
104
|
display: none;
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
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
|
+
max-height: 2000px; /* Large enough to hold table */
|
|
118
|
+
opacity: 1;
|
|
80
119
|
}
|
|
81
120
|
|
|
82
121
|
.hide-borders {
|
|
@@ -86,47 +125,69 @@
|
|
|
86
125
|
|
|
87
126
|
.row-disabled {
|
|
88
127
|
display: none;
|
|
89
|
-
|
|
90
|
-
border-collapse: collapse;
|
|
128
|
+
opacity: 0;
|
|
91
129
|
}
|
|
92
130
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
.arrow-expanded::before {
|
|
98
|
-
content: "\23F7";
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
.row-low {
|
|
103
|
-
background-color: #ace3ac;
|
|
104
|
-
text-align: center;
|
|
131
|
+
@keyframes fadeIn {
|
|
132
|
+
from { opacity: 0; }
|
|
133
|
+
to { opacity: 1; }
|
|
105
134
|
}
|
|
106
135
|
|
|
107
|
-
.row-
|
|
108
|
-
|
|
109
|
-
|
|
136
|
+
.row-active {
|
|
137
|
+
display: table-row !important;
|
|
138
|
+
animation: fadeIn 0.5s ease forwards;
|
|
110
139
|
}
|
|
111
140
|
|
|
112
|
-
.
|
|
113
|
-
|
|
114
|
-
|
|
141
|
+
.arrow {
|
|
142
|
+
cursor: pointer;
|
|
143
|
+
display: inline-block;
|
|
115
144
|
}
|
|
116
145
|
|
|
117
|
-
.
|
|
118
|
-
|
|
119
|
-
|
|
146
|
+
.arrow::before {
|
|
147
|
+
content: "\23f5";
|
|
148
|
+
margin-right: 5px;
|
|
120
149
|
}
|
|
121
150
|
|
|
122
|
-
.
|
|
123
|
-
|
|
124
|
-
text-align: center;
|
|
151
|
+
.arrow-expanded::before {
|
|
152
|
+
content: "\23F7";
|
|
125
153
|
}
|
|
126
154
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
155
|
+
@media (prefers-color-scheme: dark) {
|
|
156
|
+
body {
|
|
157
|
+
background-color: #121212;
|
|
158
|
+
color: #e0e0e0;
|
|
159
|
+
}
|
|
160
|
+
table, th, td {
|
|
161
|
+
border-color: #333;
|
|
162
|
+
color: #e0e0e0;
|
|
163
|
+
}
|
|
164
|
+
th {
|
|
165
|
+
background-color: #1e1e1e;
|
|
166
|
+
}
|
|
167
|
+
tr:not(.row-low):not(.row-neutral):not(.row-high):nth-child(even) {
|
|
168
|
+
background-color: #1a1a1a;
|
|
169
|
+
}
|
|
170
|
+
tr:hover {
|
|
171
|
+
background-color: #2a2a2a !important;
|
|
172
|
+
}
|
|
173
|
+
.row-low { background-color: #1b4d1b; }
|
|
174
|
+
.row-low:hover { background-color: #266b26; }
|
|
175
|
+
.row-neutral { background-color: #333; }
|
|
176
|
+
.row-neutral:hover { background-color: #444; }
|
|
177
|
+
.row-high { background-color: #611a14; }
|
|
178
|
+
.row-high:hover { background-color: #8a251d; }
|
|
179
|
+
.○ { color: #e0e0e0; }
|
|
180
|
+
.🦟 { color: #aaa; }
|
|
181
|
+
#prereqdebugdata > tbody > tr:hover,
|
|
182
|
+
#cycledata > tbody > tr:hover,
|
|
183
|
+
#failuredata > tbody > tr:hover,
|
|
184
|
+
#debugdata > tbody > tr:hover,
|
|
185
|
+
#prereqdebugdata > tr:hover,
|
|
186
|
+
#cycledata > tr:hover,
|
|
187
|
+
#failuredata > tr:hover,
|
|
188
|
+
#debugdata > tr:hover {
|
|
189
|
+
background-color: transparent !important;
|
|
190
|
+
}
|
|
130
191
|
}
|
|
131
192
|
</style>
|
|
132
193
|
</head>
|
|
@@ -135,13 +196,15 @@
|
|
|
135
196
|
<script>
|
|
136
197
|
function select_changed(selector, row) {
|
|
137
198
|
var x = document.getElementById(selector).value;
|
|
138
|
-
var y;
|
|
139
199
|
var rows = document.querySelectorAll(row + " tr.row-disabled");
|
|
140
200
|
for (var i = 0; i < rows.length; i++) {
|
|
141
|
-
rows[i].
|
|
201
|
+
rows[i].classList.remove("row-active");
|
|
142
202
|
}
|
|
143
203
|
if (x != "0") {
|
|
144
|
-
document.querySelector(row + x)
|
|
204
|
+
var target = document.querySelector(row + x);
|
|
205
|
+
if (target) {
|
|
206
|
+
target.classList.add("row-active");
|
|
207
|
+
}
|
|
145
208
|
if (row == row + x)
|
|
146
209
|
document.getElementById(selector).value = 0;
|
|
147
210
|
}
|
|
@@ -156,22 +219,25 @@
|
|
|
156
219
|
|
|
157
220
|
function debug_data_changed() {
|
|
158
221
|
select_changed("debug", "#debugdata")
|
|
222
|
+
var label = document.getElementById("debug_label");
|
|
159
223
|
if (document.getElementById("debug").value != "0") {
|
|
160
|
-
|
|
224
|
+
label.style.display = "block";
|
|
225
|
+
setTimeout(() => label.style.opacity = "1", 10);
|
|
161
226
|
} else {
|
|
162
|
-
|
|
227
|
+
label.style.opacity = "0";
|
|
228
|
+
setTimeout(() => label.style.display = "none", 300);
|
|
163
229
|
}
|
|
164
230
|
}
|
|
165
231
|
|
|
166
232
|
function prereq_debug_data_changed() {
|
|
167
|
-
var
|
|
168
|
-
var arrow = document.getElementById("prereqdata-arrow")
|
|
169
|
-
if (
|
|
170
|
-
|
|
171
|
-
arrow.
|
|
233
|
+
var wrapper = document.getElementById("prereqdebugdata-wrapper");
|
|
234
|
+
var arrow = document.getElementById("prereqdata-arrow");
|
|
235
|
+
if (wrapper.classList.contains("expanded")) {
|
|
236
|
+
wrapper.classList.remove("expanded");
|
|
237
|
+
arrow.classList.remove("arrow-expanded");
|
|
172
238
|
} else {
|
|
173
|
-
|
|
174
|
-
arrow.
|
|
239
|
+
wrapper.classList.add("expanded");
|
|
240
|
+
arrow.classList.add("arrow-expanded");
|
|
175
241
|
}
|
|
176
242
|
}
|
|
177
243
|
|
|
@@ -199,19 +265,15 @@
|
|
|
199
265
|
{% endif %}
|
|
200
266
|
}
|
|
201
267
|
|
|
202
|
-
function summary_data_changed() {
|
|
268
|
+
function summary_data_changed(ev) {
|
|
203
269
|
var table = document.getElementById("summary");
|
|
204
270
|
const start_select = document.getElementById('start_select');
|
|
205
271
|
const end_select = document.getElementById('end_select');
|
|
272
|
+
|
|
273
|
+
if (!start_select || !end_select) return;
|
|
274
|
+
|
|
206
275
|
var start = parseInt(start_select.value);
|
|
207
276
|
var end = parseInt(end_select.value);
|
|
208
|
-
var min_duration = 0;
|
|
209
|
-
|
|
210
|
-
// if duration filter activated, hide rows that don't match
|
|
211
|
-
if (document.getElementById('med_duration').checked)
|
|
212
|
-
min_duration = document.getElementById("med_duration").value;
|
|
213
|
-
else if (document.getElementById('min_duration').checked)
|
|
214
|
-
min_duration = document.getElementById("min_duration").value;
|
|
215
277
|
|
|
216
278
|
// reset end if start was picked bigger than end
|
|
217
279
|
if (start > end) {
|
|
@@ -219,11 +281,22 @@
|
|
|
219
281
|
end = start;
|
|
220
282
|
}
|
|
221
283
|
|
|
284
|
+
var min_duration = 0;
|
|
285
|
+
if (document.getElementById('med_duration').checked)
|
|
286
|
+
min_duration = document.getElementById("med_duration").value;
|
|
287
|
+
else if (document.getElementById('min_duration').checked)
|
|
288
|
+
min_duration = document.getElementById("min_duration").value;
|
|
289
|
+
|
|
222
290
|
// show all rows between start and end
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
var
|
|
226
|
-
var
|
|
291
|
+
var rows = table.tBodies[0].rows;
|
|
292
|
+
for (var i = 0; i < rows.length; i++) {
|
|
293
|
+
var row = rows[i];
|
|
294
|
+
var index_cell = row.cells[0];
|
|
295
|
+
if (!index_cell) continue;
|
|
296
|
+
|
|
297
|
+
var index = parseInt(index_cell.textContent);
|
|
298
|
+
var duration_cell = row.cells[2];
|
|
299
|
+
var row_duration = duration_cell ? parseTimeToSeconds(duration_cell.textContent) : 0;
|
|
227
300
|
|
|
228
301
|
if (row_duration >= min_duration &&
|
|
229
302
|
index >= start && index <= end) {
|
|
@@ -235,74 +308,83 @@
|
|
|
235
308
|
|
|
236
309
|
// reset other tables if we now show more than one cycle
|
|
237
310
|
if (end - start > 0) {
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
311
|
+
var cycles_select = document.getElementById("cycles");
|
|
312
|
+
if (cycles_select) {
|
|
313
|
+
cycles_select.selectedIndex = 0;
|
|
314
|
+
cycle_data_changed();
|
|
315
|
+
}
|
|
241
316
|
{% if failures %}
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
317
|
+
var failures_select = document.getElementById("failures");
|
|
318
|
+
if (failures_select) {
|
|
319
|
+
failures_select.value = 0;
|
|
320
|
+
failure_data_changed();
|
|
321
|
+
}
|
|
245
322
|
{% endif %}
|
|
246
323
|
{% if debug_data %}
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
324
|
+
var debug_select = document.getElementById("debug");
|
|
325
|
+
if (debug_select) {
|
|
326
|
+
debug_select.selectedIndex = 0;
|
|
327
|
+
debug_data_changed();
|
|
328
|
+
}
|
|
250
329
|
{% endif %}
|
|
251
|
-
} else if (start
|
|
252
|
-
pick_data_for_cycle(start)
|
|
330
|
+
} else if (start == end) {
|
|
331
|
+
pick_data_for_cycle(start);
|
|
332
|
+
}
|
|
253
333
|
}
|
|
254
334
|
|
|
255
335
|
function populate_summary_selectors() {
|
|
256
336
|
const table = document.getElementById('summary');
|
|
257
337
|
const start_select = document.getElementById('start_select');
|
|
258
338
|
const end_select = document.getElementById('end_select');
|
|
339
|
+
|
|
340
|
+
if (!start_select || !end_select || !table || !table.tBodies || !table.tBodies[0]) return;
|
|
259
341
|
|
|
260
|
-
|
|
342
|
+
var rows = table.tBodies[0].rows;
|
|
343
|
+
for (let i = 0; i < rows.length; i++) {
|
|
261
344
|
const start_option = document.createElement('option');
|
|
262
345
|
const end_option = document.createElement('option');
|
|
263
|
-
var columns =
|
|
346
|
+
var columns = rows[i].getElementsByTagName("td");
|
|
264
347
|
|
|
265
348
|
//Populate all start/end selector values
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
//apply coloring to hardware sleep
|
|
276
|
-
if (i != 0) {
|
|
349
|
+
start_option.text = `Cycle ${i}`;
|
|
350
|
+
start_option.value = i;
|
|
351
|
+
end_option.text = `Cycle ${i}`;
|
|
352
|
+
end_option.value = i;
|
|
353
|
+
start_select.add(start_option);
|
|
354
|
+
end_select.add(end_option);
|
|
355
|
+
|
|
356
|
+
if (columns.length > 2) {
|
|
357
|
+
//apply coloring to hardware sleep
|
|
277
358
|
if (parseFloat(columns[2].innerHTML) < 85)
|
|
278
|
-
|
|
359
|
+
rows[i].className = "row-high";
|
|
279
360
|
}
|
|
280
361
|
}
|
|
281
362
|
|
|
282
363
|
// Pick the end selector for last column
|
|
283
|
-
end_select.selectedIndex =
|
|
364
|
+
end_select.selectedIndex = rows.length - 1;
|
|
284
365
|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
366
|
+
summary_data_changed(event);
|
|
367
|
+
|
|
368
|
+
// if we only have one cycle then pick it
|
|
369
|
+
if (rows.length == 1) {
|
|
370
|
+
pick_summary_cycle(0)
|
|
288
371
|
}
|
|
289
372
|
}
|
|
290
373
|
|
|
291
374
|
function pick_summary_cycle(num) {
|
|
292
|
-
//narrow down filter to just the selected cycle
|
|
293
375
|
document.getElementById('start_select').selectedIndex = num;
|
|
294
376
|
document.getElementById('end_select').selectedIndex = num;
|
|
295
|
-
summary_data_changed();
|
|
377
|
+
summary_data_changed(event);
|
|
296
378
|
pick_data_for_cycle(num);
|
|
297
379
|
}
|
|
298
380
|
|
|
299
381
|
function reset_clicked() {
|
|
300
382
|
const table = document.getElementById('summary');
|
|
383
|
+
var rows = table.tBodies[0].rows;
|
|
301
384
|
document.getElementById('start_select').selectedIndex = 0;
|
|
302
|
-
|
|
303
|
-
document.getElementById('end_select').selectedIndex = table.rows.length - 2;
|
|
385
|
+
document.getElementById('end_select').selectedIndex = rows.length - 1;
|
|
304
386
|
document.getElementById('all_time').checked = true;
|
|
305
|
-
summary_data_changed();
|
|
387
|
+
summary_data_changed(event);
|
|
306
388
|
}
|
|
307
389
|
|
|
308
390
|
window.addEventListener('load', populate_summary_selectors);
|
|
@@ -321,18 +403,19 @@
|
|
|
321
403
|
{% endif %}
|
|
322
404
|
{% if prereq_debug_data %}
|
|
323
405
|
<h3>
|
|
324
|
-
<
|
|
325
|
-
class="arrow">Prerequisites</label>
|
|
406
|
+
<span id="prereqdata-arrow" onclick="prereq_debug_data_changed()" class="arrow">Prerequisites</span>
|
|
326
407
|
</h3>
|
|
327
|
-
<
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
<
|
|
331
|
-
<
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
408
|
+
<div id="prereqdebugdata-wrapper" class="collapsible-wrapper">
|
|
409
|
+
<table id="prereqdebugdata" class="hide-borders">
|
|
410
|
+
{% for obj in prereq_debug_data %}
|
|
411
|
+
<TR>
|
|
412
|
+
<TD>
|
|
413
|
+
<pre>{{obj.data}}</pre>
|
|
414
|
+
</TD>
|
|
415
|
+
</TR>
|
|
416
|
+
{% endfor %}
|
|
417
|
+
</table>
|
|
418
|
+
</div>
|
|
336
419
|
{% endif %}
|
|
337
420
|
<h2>Summary</h2>
|
|
338
421
|
{% if battery_svg %}
|
|
@@ -348,16 +431,16 @@
|
|
|
348
431
|
<p>Choose a single cycle to see messages and data for that cycle.</p>
|
|
349
432
|
<button type="button" onclick="reset_clicked()">Reset</button>
|
|
350
433
|
<h4>Filter cycle range</h4>
|
|
351
|
-
<select id="start_select" onchange="summary_data_changed()"></select>
|
|
434
|
+
<select id="start_select" onchange="summary_data_changed(event)"></select>
|
|
352
435
|
and
|
|
353
|
-
<select id="end_select" onchange="summary_data_changed()"></select>
|
|
436
|
+
<select id="end_select" onchange="summary_data_changed(event)"></select>
|
|
354
437
|
<h4>Filter minimum session length</h4>
|
|
355
|
-
<input type="radio" name="session1" id="all_time" value="all_time" onchange="
|
|
438
|
+
<input type="radio" name="session1" id="all_time" value="all_time" onchange="summary_data_changed(event)"
|
|
356
439
|
checked="" />
|
|
357
440
|
<label>All</label>
|
|
358
|
-
<input type="radio" name="session1" id="med_duration" value="600" onchange="
|
|
441
|
+
<input type="radio" name="session1" id="med_duration" value="600" onchange="summary_data_changed(event)" />
|
|
359
442
|
<label>>10 min</label>
|
|
360
|
-
<input type="radio" name="session1" id="min_duration" value="60" onchange="
|
|
443
|
+
<input type="radio" name="session1" id="min_duration" value="60" onchange="summary_data_changed(event)" />
|
|
361
444
|
<label>>1 min</label>
|
|
362
445
|
{% else %}
|
|
363
446
|
<select id="start_select" class="hidden-by-default"></select>
|
|
@@ -403,7 +486,7 @@
|
|
|
403
486
|
</table>
|
|
404
487
|
{% endif %}
|
|
405
488
|
{% if debug_data %}
|
|
406
|
-
<h3 id="debug_label" style="display:none;">Debugging 🦟</h3>
|
|
489
|
+
<h3 id="debug_label" style="display:none; transition: opacity 0.3s ease; opacity: 0;">Debugging 🦟</h3>
|
|
407
490
|
<p><label for="debug" class="hidden-by-default">Choose a cycle:</label>
|
|
408
491
|
<select id="debug" onchange="debug_data_changed()" class="hidden-by-default">
|
|
409
492
|
<option value="0">Disabled</option>
|
|
@@ -160,12 +160,10 @@ class SleepValidator(AmdTool):
|
|
|
160
160
|
def capture_battery(self):
|
|
161
161
|
"""Capture battery energy levels"""
|
|
162
162
|
for name in self.batteries.get_batteries():
|
|
163
|
-
unit = self.batteries.get_energy_unit(name)
|
|
164
163
|
energy = self.batteries.get_energy(name)
|
|
165
164
|
full = self.batteries.get_energy_full(name)
|
|
166
|
-
self.db.record_debug(f"{name} energy level is {energy}
|
|
167
|
-
|
|
168
|
-
self.db.record_battery_energy(name, energy, full, report_unit)
|
|
165
|
+
self.db.record_debug(f"{name} energy level is {energy} µWh")
|
|
166
|
+
self.db.record_battery_energy(name, energy, full, "W")
|
|
169
167
|
|
|
170
168
|
def check_rtc_cmos(self):
|
|
171
169
|
"""Check if the RTC is configured to use ACPI alarm"""
|
|
@@ -35,8 +35,8 @@ class TestBatteries(unittest.TestCase):
|
|
|
35
35
|
result = self.batteries.get_batteries()
|
|
36
36
|
self.assertEqual(result, ["BAT0"])
|
|
37
37
|
|
|
38
|
-
def
|
|
39
|
-
"""Test getting energy
|
|
38
|
+
def test_get_energy(self):
|
|
39
|
+
"""Test getting current energy for a battery"""
|
|
40
40
|
mock_device = MagicMock()
|
|
41
41
|
mock_device.device_path = "/devices/LNXSYSTM:00/device:00/PNP0C0A:00"
|
|
42
42
|
mock_device.properties = {
|
|
@@ -44,20 +44,44 @@ class TestBatteries(unittest.TestCase):
|
|
|
44
44
|
"POWER_SUPPLY_ENERGY_NOW": "50000",
|
|
45
45
|
}
|
|
46
46
|
self.mock_context.list_devices.return_value = [mock_device]
|
|
47
|
-
result = self.batteries.
|
|
48
|
-
self.assertEqual(result, "
|
|
47
|
+
result = self.batteries.get_energy("BAT0")
|
|
48
|
+
self.assertEqual(result, "50000")
|
|
49
49
|
|
|
50
|
-
def
|
|
51
|
-
"""Test
|
|
50
|
+
def test_get_energy_no_attrs(self):
|
|
51
|
+
"""Test graceful failure for a battery with no energy information"""
|
|
52
52
|
mock_device = MagicMock()
|
|
53
53
|
mock_device.device_path = "/devices/LNXSYSTM:00/device:00/PNP0C0A:00"
|
|
54
54
|
mock_device.properties = {
|
|
55
55
|
"POWER_SUPPLY_NAME": "BAT0",
|
|
56
|
-
"POWER_SUPPLY_ENERGY_NOW": "50000",
|
|
57
56
|
}
|
|
58
57
|
self.mock_context.list_devices.return_value = [mock_device]
|
|
59
58
|
result = self.batteries.get_energy("BAT0")
|
|
59
|
+
self.assertEqual(result, "")
|
|
60
|
+
|
|
61
|
+
def test_get_energy_from_charge(self):
|
|
62
|
+
"""Test getting current energy for a battery that only reports charge"""
|
|
63
|
+
mock_device = MagicMock()
|
|
64
|
+
mock_device.device_path = "/devices/LNXSYSTM:00/device:00/PNP0C0A:00"
|
|
65
|
+
mock_device.properties = {
|
|
66
|
+
"POWER_SUPPLY_NAME": "BAT0",
|
|
67
|
+
"POWER_SUPPLY_CHARGE_NOW": "3230",
|
|
68
|
+
}
|
|
69
|
+
self.mock_context.list_devices.return_value = [mock_device]
|
|
70
|
+
|
|
71
|
+
# Confirm graceful handling when no design voltage available
|
|
72
|
+
result = self.batteries.get_energy("BAT0")
|
|
73
|
+
self.assertEqual(result, "")
|
|
74
|
+
|
|
75
|
+
# Confirm precedence among possible battery voltage attributes
|
|
76
|
+
mock_device.properties["POWER_SUPPLY_VOLTAGE_NOW"] = "15480000"
|
|
77
|
+
result = self.batteries.get_energy("BAT0")
|
|
60
78
|
self.assertEqual(result, "50000")
|
|
79
|
+
mock_device.properties["POWER_SUPPLY_VOLTAGE_MIN_DESIGN"] = "15000000"
|
|
80
|
+
result = self.batteries.get_energy("BAT0")
|
|
81
|
+
self.assertEqual(result, "48450")
|
|
82
|
+
mock_device.properties["POWER_SUPPLY_VOLTAGE_MAX_DESIGN"] = "16000000"
|
|
83
|
+
result = self.batteries.get_energy("BAT0")
|
|
84
|
+
self.assertEqual(result, "51680")
|
|
61
85
|
|
|
62
86
|
def test_get_energy_full(self):
|
|
63
87
|
"""Test getting full energy for a battery"""
|
|
@@ -72,6 +96,21 @@ class TestBatteries(unittest.TestCase):
|
|
|
72
96
|
result = self.batteries.get_energy_full("BAT0")
|
|
73
97
|
self.assertEqual(result, "60000")
|
|
74
98
|
|
|
99
|
+
def test_get_energy_full_from_charge(self):
|
|
100
|
+
"""Test getting full energy for a battery that only reports charge"""
|
|
101
|
+
"""Test getting full energy for a battery"""
|
|
102
|
+
mock_device = MagicMock()
|
|
103
|
+
mock_device.device_path = "/devices/LNXSYSTM:00/device:00/PNP0C0A:00"
|
|
104
|
+
mock_device.properties = {
|
|
105
|
+
"POWER_SUPPLY_NAME": "BAT0",
|
|
106
|
+
"POWER_SUPPLY_CHARGE_FULL": "3876",
|
|
107
|
+
"POWER_SUPPLY_VOLTAGE_MIN_DESIGN": "15480000",
|
|
108
|
+
}
|
|
109
|
+
self.mock_context.list_devices.return_value = [mock_device]
|
|
110
|
+
|
|
111
|
+
result = self.batteries.get_energy_full("BAT0")
|
|
112
|
+
self.assertEqual(result, "60000")
|
|
113
|
+
|
|
75
114
|
def test_get_description_string(self):
|
|
76
115
|
"""Test getting description string for a battery"""
|
|
77
116
|
mock_device = MagicMock()
|
|
@@ -90,3 +129,23 @@ class TestBatteries(unittest.TestCase):
|
|
|
90
129
|
result,
|
|
91
130
|
"Battery BAT0 (ACME SuperBattery) is operating at 75.00% of design",
|
|
92
131
|
)
|
|
132
|
+
|
|
133
|
+
def test_get_description_string_from_charge(self):
|
|
134
|
+
"""Test getting description string for a battery that only reports charge"""
|
|
135
|
+
mock_device = MagicMock()
|
|
136
|
+
mock_device.device_path = "/devices/LNXSYSTM:00/device:00/PNP0C0A:00"
|
|
137
|
+
mock_device.properties = {
|
|
138
|
+
"POWER_SUPPLY_NAME": "BAT0",
|
|
139
|
+
"POWER_SUPPLY_MANUFACTURER": "ACME",
|
|
140
|
+
"POWER_SUPPLY_MODEL_NAME": "SuperBattery",
|
|
141
|
+
"POWER_SUPPLY_CHARGE_FULL": "60000",
|
|
142
|
+
"POWER_SUPPLY_CHARGE_FULL_DESIGN": "80000",
|
|
143
|
+
"POWER_SUPPLY_VOLTAGE_MIN_DESIGN": "15480000",
|
|
144
|
+
}
|
|
145
|
+
self.mock_context.list_devices.return_value = [mock_device]
|
|
146
|
+
|
|
147
|
+
result = self.batteries.get_description_string("BAT0")
|
|
148
|
+
self.assertEqual(
|
|
149
|
+
result,
|
|
150
|
+
"Battery BAT0 (ACME SuperBattery) is operating at 75.00% of design",
|
|
151
|
+
)
|
|
@@ -2504,12 +2504,12 @@ class TestPrerequisiteValidator(unittest.TestCase):
|
|
|
2504
2504
|
def test_check_isp4_driver_bound_but_module_not_loaded(
|
|
2505
2505
|
self, _mock_readlink, mock_path_exists
|
|
2506
2506
|
):
|
|
2507
|
-
"""Test check_isp4 when driver is bound but amd_capture
|
|
2507
|
+
"""Test check_isp4 when driver is bound but amd_capture or amd_isp4_capture modules are not loaded"""
|
|
2508
2508
|
|
|
2509
2509
|
def exists_side_effect(path):
|
|
2510
2510
|
if "path" in path or "driver" in path:
|
|
2511
2511
|
return True
|
|
2512
|
-
if "amd_capture" in path:
|
|
2512
|
+
if "amd_capture" in path or "amd_isp4_capture" in path:
|
|
2513
2513
|
return False
|
|
2514
2514
|
return True
|
|
2515
2515
|
|
|
@@ -2523,7 +2523,7 @@ class TestPrerequisiteValidator(unittest.TestCase):
|
|
|
2523
2523
|
"ISP4 platform camera driver 'amd-isp4' bound to OMNI5C10:00", "✅"
|
|
2524
2524
|
)
|
|
2525
2525
|
self.mock_db.record_prereq.assert_any_call(
|
|
2526
|
-
"Camera driver module 'amd_capture' not loaded", "❌"
|
|
2526
|
+
"Camera driver module 'amd_capture'/'amd_isp4_capture' not loaded", "❌"
|
|
2527
2527
|
)
|
|
2528
2528
|
self.assertTrue(
|
|
2529
2529
|
any(isinstance(f, MissingAmdCaptureModule) for f in self.validator.failures)
|
|
@@ -2546,7 +2546,7 @@ class TestPrerequisiteValidator(unittest.TestCase):
|
|
|
2546
2546
|
"ISP4 platform camera driver 'amd-isp4' bound to OMNI5C10:00", "✅"
|
|
2547
2547
|
)
|
|
2548
2548
|
self.mock_db.record_prereq.assert_any_call(
|
|
2549
|
-
"Camera driver module 'amd_capture' loaded", "✅"
|
|
2549
|
+
"Camera driver module 'amd_capture'/'amd_isp4_capture' loaded", "✅"
|
|
2550
2550
|
)
|
|
2551
2551
|
|
|
2552
2552
|
@patch("amd_debug.prerequisites.os.path.exists")
|
|
@@ -614,10 +614,13 @@ class TestDisplayReportFile(unittest.TestCase):
|
|
|
614
614
|
display_report_file("report.html", "html")
|
|
615
615
|
mock_is_root.assert_called_once()
|
|
616
616
|
mock_env_get.assert_any_call("SUDO_USER")
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
617
|
+
call_args = mock_subprocess_call.call_args[0][0]
|
|
618
|
+
assert call_args[0] == "sudo"
|
|
619
|
+
assert call_args[1] == "-u"
|
|
620
|
+
assert call_args[2] == "testuser"
|
|
621
|
+
assert call_args[3] == "env"
|
|
622
|
+
assert "xdg-open" in call_args
|
|
623
|
+
assert "report.html" in call_args
|
|
621
624
|
|
|
622
625
|
@patch("amd_debug.s2idle.is_root", return_value=True)
|
|
623
626
|
@patch("os.environ.get", side_effect=lambda key: None)
|
|
@@ -194,3 +194,22 @@ class TestSleepReport(unittest.TestCase):
|
|
|
194
194
|
self.assertTrue(
|
|
195
195
|
math.isnan(self.report.df["Hardware Sleep"].iloc[0])
|
|
196
196
|
) # Hardware Sleep should be NaN
|
|
197
|
+
|
|
198
|
+
def test_battery_ave_rate(self):
|
|
199
|
+
"""Test the pre_process_dataframe Battery Ave Rate calculation."""
|
|
200
|
+
self.report.df = pd.DataFrame(
|
|
201
|
+
{
|
|
202
|
+
"t0": [datetime(2023, 10, 10, 12, 0, 0).strftime("%Y%m%d%H%M%S")],
|
|
203
|
+
"t1": [datetime(2023, 10, 10, 13, 0, 0).strftime("%Y%m%d%H%M%S")],
|
|
204
|
+
"hw": [50],
|
|
205
|
+
"requested": [1],
|
|
206
|
+
"gpio": ["1, 2"],
|
|
207
|
+
"wake_irq": ["1"],
|
|
208
|
+
"b0": [90000000],
|
|
209
|
+
"b1": [85000000],
|
|
210
|
+
"full": [100000000],
|
|
211
|
+
}
|
|
212
|
+
)
|
|
213
|
+
self.report.pre_process_dataframe()
|
|
214
|
+
batt_ave_rate = self.report.df["Battery Ave Rate"].iloc[0]
|
|
215
|
+
self.assertAlmostEqual(batt_ave_rate, -5, places=3)
|
|
@@ -105,8 +105,6 @@ class TestValidator(unittest.TestCase):
|
|
|
105
105
|
"""Test capture_battery method"""
|
|
106
106
|
with patch.object(
|
|
107
107
|
self.validator.batteries, "get_batteries", return_value=["BAT0"]
|
|
108
|
-
), patch.object(
|
|
109
|
-
self.validator.batteries, "get_energy_unit", return_value="µWh"
|
|
110
108
|
), patch.object(
|
|
111
109
|
self.validator.batteries, "get_energy", return_value=50000
|
|
112
110
|
), patch.object(
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/src/amd_debug_tools.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/src/amd_debug_tools.egg-info/entry_points.txt
RENAMED
|
File without changes
|
|
File without changes
|
{amd_debug_tools-0.2.14 → amd_debug_tools-0.2.16}/src/amd_debug_tools.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|