https://github.com/laspavel/cpu_load
https://github.com/laspavel/cpu_load
cpu-load load-testing python python3
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/laspavel/cpu_load
- Owner: laspavel
- License: mit
- Created: 2023-11-08T07:15:56.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2023-11-08T07:21:05.000Z (almost 2 years ago)
- Last Synced: 2025-01-11T05:19:11.211Z (9 months ago)
- Topics: cpu-load, load-testing, python, python3
- Language: Python
- Homepage:
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CPU Load Generator

A cross-platform CPU load generator for benchmarking and testing
Supports configurable utilization, duration, and number of cores.## ๐ Features
* Generate custom CPU load (1%โ100%)
* Control test duration (in seconds)
* Load specific number of CPU cores
* Clean interruption handling (Ctrl+C)## โ๏ธ Requirements
- Python 3.6 or newer
- Linux, Windows## ๐ Installation & Usage
```bash
git clone https://github.com/laspavel/cpu_load.git
cd cpu_load
chmod +x cpu_load.py
./cpu_load.py [-i INTERVAL] [-u UTILIZATION] [-c CPUS] [-v]
```Python dependencies are only from the standard library, no installation of packages is required.
Parameters:
| Parameters | Description | Default |
| ------------------ | ----------------------------------------------------- | --------------------|
| -i, --interval | Duration in seconds to run the test | 30 |
| -u, --utilization | CPU load percentage per core | 50 |
| -c, --cpus | Number of CPU cores to load (max = physical cores) | all available cores |
| -v, --version | Show program version and exit | |## ๐งฉ Example Usage
```bash
./load_cpu.py -i 60 -u 90 -c 2 # Run for 60 seconds at 90% load on 2 CPU cores
```## ๐ Build Standalone Binary
```bash
./build.sh
```## ๐งช Testing Locally
If you prefer to run the load script directly on your host system:โ
```bash
chmod +x load_cpu.sh
./load_cpu.py
```โ ๏ธ Make sure Python 3 is installed and executable is marked with `chmod +x`.
## ๐ Project Structure
```plaintext
cpu_load/
โโโ cron/ # Example cron tasks for automated stress tests
โโโ src/ # Source code for load generation
โโโ build.sh # Script to build binary file
โโโ Dockerfile.build # Docker image for build binary file
โโโ LICENSE # MIT License
โโโ README.md # Project documentation
```## ๐ License
MIT License.โ## ๐ค Contributions
Suggestions and improvements are welcome! Feel free to open an issue or submit a pull request.
## ๐ฌ Contact
Author: [laspavel](https://github.com/laspavel)
Feel free to reach out with questions or ideas.
---