For some benchmarks it can be important to have a system operating on just a specific number of CPU cores. To find out how many you have, just count them by:
$ ls -l /sys/devices/system/cpu/
Switching a core off is just as easy as
echo 0 > /sys/devices/system/cpu/cpu7/online
which would switch off core 7.
For simplification, i got a shell script for activating/deactivating the cores 2 to 7 on the console (file is called “multiCoreSwitch.sh”:
#!/bin/bash
for cpu in $(seq 2 7)
do
echo $1 > /sys/devices/system/cpu/cpu$cpu/online
done
Which then can be called by:
Switch on:
sudo ./multiCoreSwitch.sh 1
Switch off:
sudo ./multiCoreSwitch.sh 0
For checking whether the cores are running or not, run “top” and enter 1, for toggling the cpu view.