Skip to content
CPU Load Generator allows you to generate a fixed configurable CPU load for a finite time by means of PID regulator.
Branch: master
Clone or download
gcarlucc
gcarlucc minor changes
Latest commit 537ecaf Jul 2, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
tests changing format Sep 27, 2016
utils minor changes Jul 2, 2018
.gitignore adding gitignore Jan 6, 2016
.travis.yml minor changes Jul 2, 2018
50%-Target-Load.jpg restore fig Apr 6, 2016
CODE_OF_CONDUCT.md Create CODE_OF_CONDUCT.md Jun 20, 2017
CONTRIBUTING.md Create CONTRIBUTING.md Jun 20, 2017
CPULoadGenerator.py minor changes Jul 2, 2018
LICENCE Create LICENCE Jan 18, 2017
README.rst Update README.rst Jun 28, 2018
requirements.txt minor changes Jul 2, 2018

README.rst

CPU Load Generator (Python 2)

travis-badge mit-badge made-with-python

This script allows to generate a fixed CPU load for a finite time period. To the purpose, a PI controller is employed. The script takes in input the desired CPU load, the duration of the experiment and the CPU core on which the load has to be generated. The controller and the CPU monitor are implemented in two different threads.

Python versions

This master branch refers to Python versions 2.7, 3.2, 3.3, 3.4.

Here it is the 3.6 version branch which contains some extended features.

Dependencies

Install matplotlib for real time plot of CPU status:

sudo apt-get install python-matplotlib

Install psutil:

sudo apt-get install python-psutil

Other dependencies:

sudo apt-get install python-twisted

Usage

To generate 20% of load on core 0 for 20 seconds run:

./CPULoadGenerator.py -l 0.2 -d 20 -c 0

To enable real time plot run:

./CPULoadGenerator.py -p 1

To generate 20% of CPU load on core 0 and on core 1 run:

./CPULoadGenerator.py -c 1 -l 0.2 | ./CPULoadGenerator.py -c 0 -l 0.2

Example

Dynamics example: 50% load generated on CPU core 0:

./CPULoadGenerator.py -l 0.5 -d 20 -p 1

Example - 50% load on CPU core 0

You can’t perform that action at this time.