A Self-Contained Python Framework for Firmware Performance Analysis and Scenario-Based Reporting.
This repository, firmware_monitor, provides a comprehensive, self-contained solution for monitoring, analyzing, and tracking performance changes within firmware images. It processes structured log data against defined thresholds and generates detailed, scenario-based analysis reports in both TXT and HTML formats.
This project is designed for automation, using GitHub Actions and a Jenkins Declarative Pipeline to ensure consistent analysis and image publishing.
- The pipeline is triggered on a
pushorpull_requestto themainbranch. - The core command,
python firmware_monitor.py, executes the analysis, evaluates metrics against thresholds, and generates thereport.htmlandreport_history.htmlfiles in thereports/directory.
- The
Dockerfiledefines a consistent container environment. - The Jenkins pipeline builds the Docker image and, on the
mainbranch, tags and pushes it to a private registry. - The GitHub Actions workflow similarly builds and pushes the image to GitHub Container Registry (GHCR).
- The Jenkins pipeline includes an optional
Deploystage where steps can be added to trigger a final deployment to a target environment (e.g., Kubernetes or an Ansible playbook).
This framework processes structured log data to analyze the performance and stability of firmware under various scenarios (e.g., "Low Load Boot," "Thermal Stress," "Power Dip").
| Component | Technology | Role |
|---|---|---|
| Analysis Engine | Python (firmware_monitor.py) | Evaluates metrics against pre-defined thresholds (e.g., 80% CPU, 5000μs Latency). |
| Input Data | MOCK_LOG_DATA (JSON/Dict) | Structured data for CPU, Memory, Latency, Power, Temperature, and Boot Timestamps. |
| Reporting | HTML/TXT Generation | Creates human-readable reports with scenario status labels (PASS, FAIL, MIXED, SKIP). |
| Automation | Jenkins / GitHub Actions | Automates the entire analysis and containerization process. |
The analysis tool tracks key system domains to ensure the firmware remains within acceptable performance limits:
- CPU (%): Max 80.0%.
- Memory (KB): Max 900.0 KB.
- Latency (us): Max 5000.0 μs.
- Boot Timestamps (ms): Max 5000.0 ms.
- Power (mW): Max 100.0 mW.
- Temperature (°C): Max 85.0 °C.
- 🐍 Python 3.x
- 🐳 Docker
- ⚙️ Git
Clone the repository and run the setup command:
git clone https://github.com/luckyjoy/firmware_monitor.git
cd firmware_monitor
# Install any required dependencies (if requirements.txt were present)
# pip install -r requirements.txt Execute the main script directly. This will generate the analysis reports in the local reports/ directory.
python firmware_monitor.pyUse Docker to ensure the monitoring environment is consistent and reproducible.
Replace v1.0.0 with your desired tag:
docker build -t firmware-monitor:v1.0.0 .Run the container, mapping the internal /app/reports output directory to a local directory (local_reports) to retrieve the generated HTML and TXT files.
docker run -d \
--name fm_production \
-v $(pwd)/local_reports:/app/reports \
firmware-monitor:v1.0.0firmware_monitor/
├── .github/ # GitHub Actions workflow definitions
│ └── workflows/
│ └── ci.yml
├── config/ # Configuration files (Placeholder)
├── Dockerfile # Defines the container image
├── Jenkinsfile # Jenkins Declarative Pipeline
├── README.md
├── requirements.txt # (Inferred)
├── firmware_monitor.py # Main analysis script (self-contained)
└── reports/ # Generated HTML and TXT reports
├── report.html # Latest report
├── report_history.html # List of unique reports
└── firmware_analysis_report_*.html # Uniquely named reports
- Fork the repository
- Create a feature branch
- Implement new scenarios, metrics, or reporting features
- Run
python firmware_monitor.pylocally and verify results - Submit a Pull Request with a clear description
Code Style:
- Follow PEP8 conventions
- Ensure HTML/TXT reports generate without errors
- Document new logic and metrics within the code
Released under the MIT License — free to use, modify, and distribute.
📬 Contact: Bang Thien Nguyen ontario1998@gmail.com
“Measure performance before you optimize — know your hardware before you test your code.”