From: W. Trevor King Date: Thu, 11 Nov 2010 20:24:25 +0000 (-0500) Subject: Add CPU frequency post. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=952845031b36ec9ed2a4d8f2710b9518ddca191e;p=mw2txt.git Add CPU frequency post. --- diff --git a/posts/CPU_frequency.mdwn b/posts/CPU_frequency.mdwn new file mode 100644 index 0000000..77a8521 --- /dev/null +++ b/posts/CPU_frequency.mdwn @@ -0,0 +1,56 @@ +I usuall optimize my code for clean *code* and don't spend much time +worrying about optimizing for particular hardware, or really worrying +about hardware at all. This is why I was surprised when I ran this on +our deparment computer lab: + + wking@xphy1:~$ grep MHz /proc/cpuinfo + cpu MHz : 2000.000 + cpu MHz : 3166.000 + +What! Why is the CPU speed changing for a dual-core chip? Some +searching around lead me to [cpufrequtils][] (Debian: `cpufrequtils`, +Gentoo: `sys-power/cpufrequtils`) and `cpufreq-info`: + + wking@xphy1$ cpufreq-info + cpufrequtils 006: cpufreq-info (C) Dominik Brodowski 2004-2009 + Report errors and bugs to cpufreq@vger.kernel.org, please. + analyzing CPU 0: + driver: acpi-cpufreq + CPUs which run at the same hardware frequency: 0 + CPUs which need to have their frequency coordinated by software: 0 + maximum transition latency: 10.0 us. + hardware limits: 2.00 GHz - 3.17 GHz + available frequency steps: 3.17 GHz, 2.67 GHz, 2.33 GHz, 2.00 GHz + available cpufreq governors: conservative, ondemand, userspace, + powersave, performance + current policy: frequency should be within 2.00 GHz and 3.17 GHz. + The governor "ondemand" may decide which speed to use + within this range. + current CPU frequency is 2.00 GHz (asserted by call to hardware). + cpufreq stats: 3.17 GHz:4.40%, 2.67 GHz:0.05%, 2.33 GHz:0.05%, + 2.00 GHz:95.49% (3538) + analyzing CPU 1: + driver: acpi-cpufreq + CPUs which run at the same hardware frequency: 1 + CPUs which need to have their frequency coordinated by software: 1 + maximum transition latency: 10.0 us. + hardware limits: 2.00 GHz - 3.17 GHz + available frequency steps: 3.17 GHz, 2.67 GHz, 2.33 GHz, 2.00 GHz + available cpufreq governors: conservative, ondemand, userspace, + powersave, performance + current policy: frequency should be within 2.00 GHz and 3.17 GHz. + The governor "ondemand" may decide which speed to use + within this range. + current CPU frequency is 2.00 GHz (asserted by call to hardware). + cpufreq stats: 3.17 GHz:4.03%, 2.67 GHz:0.77%, 2.33 GHz:0.03%, + 2.00 GHz:95.17% (3743) + +Now it makes sense ;). Apparently the current (possibly throttled) +frequency is listed in `/proc/cpuinfo`, not the maximum frequency. + +Also, the computer lab computers don't seem to be working very hard ;). + +[cpufrequtils]: http://www.kernel.org/pub/linux/utils/kernel/cpufreq/cpufrequtils.html + +[[!tag tags/linux]] +[[!tag tags/programming]]