#! /usr/bin/python
import time
x = 0
last = time.time()
while True:
x += 1
if x % 10000 == 0:
now = time.time()
print now - last
time.sleep(0.100)
last = time.time()
Created
August 28, 2014 02:10
-
-
Save jfriedly/0da6b16f9c16bc5392d7 to your computer and use it in GitHub Desktop.
Use this script to demonstrate the effect of setting all CPUs on a machine to their maximum frequency
Note to self: I think you can set the governors by echoing "performance" or "ondemand" to /sys/devices/system/cpu/cpuX/cpufreq/scaling_governor
(replacing X with the CPU number). This way you don't have to install cpufrequtils
.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use this script to demonstrate the effect of changing the Linux CPU governor from
ondemand
toperformance
. While the script is running, set all CPU governors toperformance
and watch the time drop!Start by checking the frequencies of all your processors. Note that hyperthreads count as separate processors for this demonstration:
To set processors 0-7 to performance mode, use the command below (requires the
cpufrequtils
package).Then watch the time for the script to hit 10000 each round, and check your processor frequencies again! The script will run faster and your frequencies will all be higher!