1: 2010-02-18 (木) 02:57:59 maruo |
2: 2010-02-18 (木) 03:22:15 maruo |
| | | |
| **Linuxカーネル [#bfcc6515] | | **Linuxカーネル [#bfcc6515] |
- | まずは、Linuxカーネル側を設定します。 | + | まずは、Linuxカーネル側を設定します。おなじみmake menuconfigで。 |
| Power management and ACPI options ---> | | Power management and ACPI options ---> |
| [*] ACPI (Advanced Configuration and Power Interface) Support ---> | | [*] ACPI (Advanced Configuration and Power Interface) Support ---> |
| | | |
| を選択します | | を選択します |
| + | **CPU周波数変更用のツール類 [#e06103ea] |
| + | ***cpufrequtils [#n3c8c373] |
| + | こいつらは、CPU周波数情報のモニタツールです。 |
| + | # emerge cpufrequtils |
| + | でインストール。 |
| + | -cpufreq-info |
| + | -cpufreq-set |
| + | |
| + | といったツール群がインストールされます |
| + | ***cpufreqd [#if98113a] |
| + | ユーザーランド常駐型CPU周波数変更用ポリシーを可変させてくれるデーモンです。 |
| + | |
| + | # emerge cpufreqd |
| + | |
| + | でインストール。 /etc cpufreqd.confに設定ファイルがあります。うちではこんな感じ |
| + | # this is a comment |
| + | # see CPUFREQD.CONF(5) manpage for a complete reference |
| + | |
| + | [General] |
| + | pidfile=/var/run/cpufreqd.pid |
| + | poll_interval=2 |
| + | verbosity=4 |
| + | enable_remote=1 |
| + | remote_group=wheel |
| + | [/General] |
| + | |
| + | [Profile] |
| + | name=On Demand High |
| + | minfreq=0% |
| + | maxfreq=100% |
| + | up_threshold=60 |
| + | policy=ondemand |
| + | [/Profile] |
| + | |
| + | [Profile] |
| + | name=Performance High |
| + | minfreq=100% |
| + | maxfreq=100% |
| + | policy=performance |
| + | #exec_post=echo 8 > /proc/acpi/sony/brightness |
| + | [/Profile] |
| + | |
| + | [Profile] |
| + | name=Performance Low |
| + | minfreq=1596000 |
| + | maxfreq=1596000 |
| + | policy=performance |
| + | [/Profile] |
| + | |
| + | [Rule] |
| + | name=Default |
| + | cpu_interval=0-100 |
| + | profile=On Demand High |
| + | [/Rule] |
| + | |
| + | [Rule] |
| + | name=Compile |
| + | programs=gcc |
| + | cpu_interval=0-100 |
| + | profile=Performance High |
| + | [/Rule] |
| + | |
| + | [General]タグには、汎用設定を。~ |
| + | [Profile]タグには、CPU動作変更ポリシーをいくつか並べます。On Demand Highというプロファイルでは、CPUは0%~100%までの範囲でondemand governerを使用して可変。CPU負荷60%を越えたら動作変更という意味。Core2Duo E6600では、1.6Gと2.4Gの2段しかないので、Performance Lowでは下の周波数だけなんですよね。~ |
| + | [Rule]タグには、どういう状態のときに、どのプロファイル動作で動かすかを指定します。Defaultルールでは、CPU負荷0%~100%時は、On Demand Highプロファイルを使用、gccが動くときにはPerformance Highプロファイルを使用します。 |
| + | |
| + | こんな風に、デフォルトはこうだが、ある特定のプログラムが動くときは違うプロファイル、ACPIの状態をみて、ACパワーの時は高いCPUにするけど、バッテリー動作時はCPU抑えめ、バッテリーが減ってきたら最低周波数動作にする、センサー温度が上昇したらCPU周波数を下げるとかっていう設定もできます。 |
| + | 詳細はmanとか見てね~。デフォルトのcpufreqd.confにも設定例のってます。 |
| + | |
| + | 設定できたら |
| + | # rc-update add cpufreqd boot |
| + | 私はboot runlevelへ設定。CPU周波数の変更動作は、起動時から有効でも問題なさそうですしね。 |
| + | |
| + | *動作検証 [#q24ca21d] |
| + | # watch 'grep "cpu MHz" /proc/cpuinfo' |
| + | なんて打ってみると、周期的に現在動作中CPUを出してくれます。で、負荷がかかる処理を動かしてみましょう。ぴょこ、ぴょこと周波数がコア毎に上がったり下がったりします。これは消費電力も下がりそうね!!。来月の電気代はどうなってるのかしら… |
| + | # cpufreq-info |
| + | cpufrequtils 005: cpufreq-info (C) Dominik Brodowski 2004-2006 |
| + | Report errors and bugs to cpufreq@vger.kernel.org, please. |
| + | analyzing CPU 0: |
| + | driver: acpi-cpufreq |
| + | CPUs which need to switch frequency at the same time: 0 |
| + | hardware limits: 1.60 GHz - 2.39 GHz |
| + | available frequency steps: 2.39 GHz, 1.60 GHz |
| + | available cpufreq governors: conservative, ondemand, performance |
| + | current policy: frequency should be within 1.60 GHz and 2.39 GHz. |
| + | The governor "ondemand" may decide which speed to use |
| + | within this range. |
| + | current CPU frequency is 1.60 GHz (asserted by call to hardware). |
| + | analyzing CPU 1: |
| + | driver: acpi-cpufreq |
| + | CPUs which need to switch frequency at the same time: 1 |
| + | hardware limits: 1.60 GHz - 2.39 GHz |
| + | available frequency steps: 2.39 GHz, 1.60 GHz |
| + | available cpufreq governors: conservative, ondemand, performance |
| + | current policy: frequency should be within 1.60 GHz and 2.39 GHz. |
| + | The governor "ondemand" may decide which speed to use |
| + | within this range. |
| + | current CPU frequency is 1.60 GHz (asserted by call to hardware). |
| + | このコマンドで、現在の動作状態を見ることもできます。ん~、ちゃんとondemand governorで動いてるのがわかりますね~ |