Originally posted by jakubo
View Post
Most of the time you're doing things like watching video, browsing web, playing games. The system will be powered on for the same number of hours and execute about the same number of total instructions no matter what the performance is, as long as it's enough to keep up with the monitor refresh rate.
So when you race to sleep, the only power you save is what can be saved by putting the CPU cores/package in a higher C-state.
Originally posted by jakubo
View Post
Maybe that's what you meant? *If* HWP chooses high frequencies, you are probably not data bound?
Originally posted by jakubo
View Post
Originally posted by Linuxxx
View Post
Originally posted by Linuxxx
View Post
But we can use turbostat to measure the energy usage directly, and I wrote a script to do this a while back. You'll want to set the path of $testvid, change $mhz_hi to the turbo clock of your CPU, and probably also s/schedutil/powersave/g because something that new will be using intel_pstate in HWP mode. Dependencies are mpv, stress, and turbostat ("kernel-tools" package in Fedora). Be aware that this needs a completely idle system and will take over your machine for an hour or so.
Code:
#!/bin/bash testvid="/tmp/vid/testvid.webm" mhz_lo=2000 mhz_hi=4200 ncpu=$(grep -c processor /proc/cpuinfo) measure_power () { stress -q -c $ncpu -t 10 # preheat the die/IHS for 10 seconds sudo turbostat \ --quiet --Summary --show PkgWatt --out "/tmp/turbostat.out" \ -- \ mpv \ --no-terminal --ao=null --fs \ --start=00:00:10 --length=60 "$testvid" tail -n1 "/tmp/turbostat.out" sudo rm "/tmp/turbostat.out" } collect () { echo "please make sure screensaver is suspended" sudo -v # preheat the CPU heatsink for 2 minutes sudo cpupower frequency-set -g performance -u 2000MHz stress -c $ncpu -t 120 # clear old results truncate --size 0 results.dat # Test frequencies in random order for mhz in $(seq "$mhz_lo" 100 "$mhz_hi" | shuf); do sudo cpupower frequency-set -g schedutil -u "${mhz}MHz" pow_schedutil="$(measure_power)" sudo cpupower frequency-set -g performance -u "${mhz}MHz" pow_performance="$(measure_power)" printf "%s %s %s\n" "$mhz" "$pow_performance" "$pow_schedutil" \ >>"results.dat" done # put results in frequency order sort -o "results.dat" "results.dat" } plot () { gnuplot <<EOF set terminal pngcairo size 800,600 set output "plot.png" set xlabel "MHz" set ylabel "Watts" set autoscale x noextend set xtics 200 rotate by -45 offset -1 plot "results.dat" using 1:2 with linespoints title "performance", \ "" using 1:3 with linespoints title "schedutil" EOF } collect plot
plot.png
Comment