A tool for generating a set of subsequent CPU utilization levels
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
LICENSE
README.md
cpu-load-generator.py Made the tool accept CPU utilization levels only as numbers in the [1… Oct 18, 2012
install-lookbusy.sh
test.data

README.md

cpu-load-generator – a tool for generating a set of subsequent CPU utilization levels

This tools takes a file as an argument, which lists a set of CPU utilization levels as numbers in the [0, 100] range representing percentages. The numbers in the file should be separated by new lines. The tool accepts another parameter specifying the required time interval between two subsequent CPU utilization levels. Then, cpu-load-generator goes through the sequence of the CPU utilization levels and generates each CPU utilization level for the specified time interval. The tool also accepts an optional parameter that sets the number of CPU cores to utilizes, which defaults to 1.

Internally, to create each CPU utilization level cpu-load-generator calls the lookbusy synthetic load generator developed by Devin Carraway, released under the GPL license, and available from http://www.devin.com/lookbusy/

Installation

To use the tool, it is necessary to install the lookbusy program first. This can be done using the included install-lookbusy.sh script as follows (the installation requires the sudo password):

./install-lookbusy.sh

Usage

Usage: python cpu-load-generator.py [options] INTERVAL SOURCE

  Generates a set of subsequent CPU utilization levels read from a file.
  Copyright (C) 2012 Anton Beloglazov. Released under Apache 2.0 license.

  Options:
    -h, --help          show this help message and exit
    -n NCPUS, --ncpus=NCPUS
                        number of CPU cores to utilize [default: 1]

Positional Arguments:
  INTERVAL  interval between subsequent CPU utilization levels in seconds
  SOURCE    source file containing a new line separated list of CPU
              utilization levels specified as numbers in the [0, 100] range

Examples

To generate a sequence of 20%, 90%, and 50% CPU utilization for 20 seconds each on 2 cores using the test.data file, please run:

python cpu-load-generator.py -n 2 20 test.data

License

The tool is released under the Apache 2.0 license

Copyright (C) 2012 Anton Beloglazov