Skip to content

feat: add AmdMobileApuPlugin for Ryzen mobile PL1 power validation#235

Open
Vrinda12-tech wants to merge 2 commits into
amd:developmentfrom
Vrinda12-tech:development
Open

feat: add AmdMobileApuPlugin for Ryzen mobile PL1 power validation#235
Vrinda12-tech wants to merge 2 commits into
amd:developmentfrom
Vrinda12-tech:development

Conversation

@Vrinda12-tech

Copy link
Copy Markdown

Summary

Adds AmdMobileApuPlugin for AMD mobile APUs (Ryzen 5 5600H).

  • Collector: Reads PL1 power limit from /sys/class/powercap/intel-rapl:0/constraint_0_power_limit_uw (converted to mW) and CPU temp from /sys/class/thermal/thermal_zone0/temp.
  • Analyzer: Compares actual PL1 against exp_pl1_power_limit_mw (tolerance: ±1000 mW).
  • Data Model: Pydantic model with pl1_power_limit_mw and cpu_temp_millidegree.

Testing

  • Verified in WSL (gracefully handles missing sysfs files, returns WARN).
  • Pre-commit hooks passed.

Related Issue

Closes #229

Checklist

  • Code follows project structure (InBandDataPlugin pattern).
  • Registered in plugins/__init__.py.
  • Documentation added to docs/PLUGIN_DOC.md.
  • Target branch is development.
  • Plugin moved to platforms/mobile_apu/ per maintainer request.
  • pytest test/functional (if applicable)
  • pre-commit run --all-files

Checklist

  • Added/updated tests (or explained why not)
  • Updated docs/README if behavior changed
  • No secrets or credentials committed

Copilot AI review requested due to automatic review settings June 23, 2026 06:25

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new in-band platform plugin (AmdMobileApuPlugin) intended to collect Ryzen mobile PL1 (powercap) and CPU temperature data from sysfs and validate PL1 against an expected value.

Changes:

  • Introduces AmdMobileApuPlugin and its collector/analyzer/args/data model under nodescraper/plugins/platforms/mobile_apu/.
  • Exports AmdMobileApuPlugin from nodescraper.plugins.
  • Adds PL1 mismatch validation logic with a fixed tolerance.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
nodescraper/plugins/platforms/mobile_apu/amd_mobile_apu_plugin.py Wires the new plugin class to its collector/analyzer/models.
nodescraper/plugins/platforms/mobile_apu/amd_mobile_apu_data_model.py Adds the Pydantic data model for PL1 + CPU temp.
nodescraper/plugins/platforms/mobile_apu/amd_mobile_apu_collector.py Adds sysfs-based collection logic for PL1 and CPU temp.
nodescraper/plugins/platforms/mobile_apu/amd_mobile_apu_analyzer.py Adds PL1 validation logic and maps it to ExecutionStatus.
nodescraper/plugins/platforms/mobile_apu/amd_mobile_apu_analyzer_args.py Adds analyzer args with optional expected PL1 limit.
nodescraper/plugins/platforms/mobile_apu/init.py Declares the mobile_apu package (empty init).
nodescraper/plugins/init.py Exposes AmdMobileApuPlugin at the package root.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +66 to +72
result = self.analyze(data, args)
status_map = {
"PASS": ExecutionStatus.OK,
"WARN": ExecutionStatus.WARNING,
"FAIL": ExecutionStatus.ERROR,
}
return TaskResult(status=status_map[result["status"]], message="; ".join(result["messages"])) No newline at end of file
Comment on lines +26 to +43
from pathlib import Path
from typing import Optional

from nodescraper.base import InBandDataCollector
from nodescraper.enums import ExecutionStatus
from nodescraper.models import TaskResult

from .amd_mobile_apu_data_model import AmdMobileApuDataModel


class AmdMobileApuCollector(InBandDataCollector[AmdMobileApuDataModel, None]):
DATA_MODEL = AmdMobileApuDataModel

def _read_int(self, path: str) -> int | None:
try:
return int(Path(path).read_text().strip())
except (OSError, IOError, ValueError):
return None
Comment on lines +59 to +62
def collect_data(
self, args: Optional[None] = None
) -> tuple[TaskResult, Optional[AmdMobileApuDataModel]]:
return TaskResult(status=ExecutionStatus.OK), self.collect() No newline at end of file
# SOFTWARE.
#
###############################################################################
from pydantic import BaseModel, Field
Comment on lines +1 to +5


###############################################################################
#
# MIT License
Comment on lines +26 to +30
from .platforms.mobile_apu.amd_mobile_apu_plugin import AmdMobileApuPlugin

__all__ = [
"AmdMobileApuPlugin",
]
Comment on lines +39 to +44
def analyze(
self,
data_model: AmdMobileApuDataModel,
analyzer_args: AmdMobileApuAnalyzerArgs | None = None,
):
if data_model.pl1_power_limit_mw is None:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Add AmdMobileApuPlugin to validate PL1 power limits on mobile Ryzen chips

2 participants