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
There is an option to run CPU load based on profile file. An exemplary profile is under load_profiles/default_profile.json. In order to run generator based on a profile issue the following command:
python -m cpu_load_generator -p <path_to_profile_json>
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, from_profile
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
from_profile(path_to_profile_json=r"c:\profiles\profile1.json")
Metadata
Release files for cpu-load-generator 1.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cpu-load-generator-1.2.0.tar.gz | 6.6 kB | Without provenance | Details for cpu-load-generator-1.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cpu_load_generator-1.2.0-py3-none-any.whl | Python 3 | none | any | Details for cpu_load_generator-1.2.0-py3-none-any.whl |
Total release size: 14.4 kB
Release files / cpu-load-generator-1.2.0.tar.gz
| Download URL | cpu-load-generator-1.2.0.tar.gz |
|---|---|
| Size | 6.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
41586edd59e5d9e75a39a0c8c86e8baa8eac0550dc4dab8c0bef9eeac328b8af
|
|
BLAKE2b-256 checksum How to use checksums |
27360c126a072884ebbeced8709b05f314af4243d73149a17e919bf4c881cba2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5
|
Release files / cpu_load_generator-1.2.0-py3-none-any.whl
| Download URL | cpu_load_generator-1.2.0-py3-none-any.whl |
|---|---|
| Size | 7.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e4c64b9eb8ae1044ac3c775541600a9d07c31a146395c89d8c313194a460cca1
|
|
BLAKE2b-256 checksum How to use checksums |
ec57958a1792efbb8a223702de0b61d088c7a64cfcc134a7bf2e0a0be7ab6bf9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5
|
Security for cpu-load-generator 1.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.