CPU load generator
Project description
CPU Load Generator
This package allows to generate a fixed CPU load for a finite time period. The script takes in input the desired CPU load, the duration of the experiment and the CPU core or all cores on which the load has to be generated.
Python versions This master branch refers to Python versions 3.x
Dependencies Installment of psutil is required (it is already set as dependency in the setup.py)
Install psutil:
pip install psutil
Other dependencies for unit tests and linters:
pip install mock pytest flake8 tox
Usage To generate 20% of load on core 0 for 20 seconds run:
python -m cpu_load_generator -l 0.2 -d 20 -c 0
To generate 50% of load on all logical cores for 20 seconds run:
python -m cpu_load_generator -l 0.5 -d 20 -c -1
To use the package features from python code:
Install the package from PyPi by issuing the following command:
python -m pip instal cpu-load-generator
To use its features from your code:
from cpu_load_generator import load_single_core, load_all_cores
load_single_core(core_num=0, duration_s=20, target_load=0.4) # generate load on single core (0)
load_all_cores(duration_s=30, target_load=0.2) # generates load on all cores
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for cpu_load_generator-1.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | db1cea76dcd70aa423e35221077bcdf77ff48feb97e4c95a059fed15b1948d9d |
|
MD5 | 4d36a8adae3c90b05c47a561007176a4 |
|
BLAKE2b-256 | 6a68b2d34fc54c87bbf909fc9bb069af4710b58ea464176ba3cd108e611c0fb4 |