Skip to content

Instantly share code, notes, and snippets.

@jfriedly
Created August 28, 2014 02:10
Show Gist options
  • Save jfriedly/0da6b16f9c16bc5392d7 to your computer and use it in GitHub Desktop.
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
#! /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()
@jfriedly
Copy link
Author

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