歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> 關於Linux >> 使用cpufreq工具給CPU臨時調整主頻

使用cpufreq工具給CPU臨時調整主頻

日期:2017/3/1 17:02:38   编辑:關於Linux

使用cpufreq工具給CPU臨時調整主頻 現代的CPU和主板都有節電技術,在CPU低負荷工作的會自動降頻。如果需要臨時設置主頻和工作模式,可使用cpufreq手動調整。這個模式將在重啟後失效,如果需要長期調整請修改/etc/sysconfig/cpuspeed。 www.2cto.com lsmod | grep "acpi_cpufreq" 執行上面的命令檢查是否加載acpi_cpufreq模塊,若是沒有加載則可以使用yum去安裝此模塊 yum install -y cpufreq-utils.x86_64 modprobe acpi_cpufreq #經過試驗此模塊不支持intel xeon處理器,只有只有P4-clockmod這個模塊支持xeon處理器,但是前提要自己動手編譯內核。。。 查看當前CPU工作頻率和狀態: www.2cto.com cpufreq-info 執行以上命令,輸出如下結果: cpufrequtils 005: cpufreq-info (C) Dominik Brodowski 2004-2006 Report errors and bugs to [email protected], please. analyzing CPU 0: driver: acpi-cpufreq CPUs which need to switch frequency at the same time: 0 hardware limits: 1.60 GHz - 2.60 GHz available frequency steps: 2.60 GHz, 2.50 GHz, 2.40 GHz, 2.30 GHz, 2.20 GHz, 2.10 GHz, 2.00 GHz, 1.90 GHz, 1.80 GHz, 1.70 GHz, 1.60 GHz available cpufreq governors: ondemand, userspace, performance current policy: frequency should be within 1.60 GHz and 2.60 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). The governor "ondemand" 表示CPU頻率的策略。CPU有三種策略,onemand(表示系統可以通過動態調整頻率,降低功耗,具體的調整策略和內核的功耗管理算法有關),userspace(表示用戶可以自己設定cpu的頻率),performance(表示CPU總是在最高主頻下工作)。 www.2cto.com current CPU frequency is 1.60 GHz 表示當前正在運行的主頻。 調整CPU工作模式: 1、調整整體工作模式 cpufreq-set -g performance 執行以上命令,表示讓CPU總是在最高主頻下工作(不節能,但高性能)。執行完畢後,可再次執行cpufreq-info查看CPU的工作策略和當前主頻。 2、手工0號核心的指定最大頻率和最小頻率 cpufreq-set -c 0 -g userspace -d 180000 -u 240000 執行以上命令,設定 0號核心 為 用戶自定義,並設置最小頻率為1.8GHz,最大頻率2.4GHz
Copyright © Linux教程網 All Rights Reserved