engines/cpu: Adding qsort capabilities
authorErwan Velu <e.velu@criteo.com>
Wed, 6 Jan 2021 23:34:06 +0000 (00:34 +0100)
committerErwan Velu <e.velu@criteo.com>
Thu, 7 Jan 2021 23:36:41 +0000 (00:36 +0100)
commit9de473a8c2ca5256a47e245c057a495b7ba9f193
tree41625dc8e9eb53f2a78539673b7e0e60c03fb9dd
parent59f94d26f98e9c0bc18d4e013f3361c51a2c6b25
engines/cpu: Adding qsort capabilities

This commit adds cpumode option into the cpuio engine.
By default, cpumode=noop to keep the current behavior.

If cpumode is set to qsort, fio will use a qsort algorithm
instead of the noop instructions to load the processor.
This mode will consume more cpu power and will be useful to
increase the pressure on the thermal and electrical components.

The expected cpu load is selected as per noop via the cpuload option.
qsort() consumes a lot of energy so the duration
of every loop will vary over time as the power management & cpu clock
changes. To ensure a proper calibration, the thinktime is adjusted after every
qsort() computation to be as precise as possible.

To give an order of magnitude, on an AMD 7502P (TDP=180W) :
cpuload=30, numjobs=64: packagewatt = 134W
cpuload=50, numjobs=64: packagewatt = 167W
cpuload=70, numjobs=64: packagewatt = 180W

The example file is updated to reflect this new capabilities.

The qsort code is coming from stress-qsort.c from stress-ng tool.
This software is also GPLv2 but author was informed and agreed with this usage.

Signed-off-by: Erwan Velu <e.velu@criteo.com>
HOWTO
engines/cpu.c
examples/cpuio.fio
fio.1