Use cpufreq to temporarily adjust the CPU clock speed

Source: Internet
Author: User
The modern CPU and motherboard have power-saving technologies, which automatically reduce the frequency when the CPU is low-load. If you need to temporarily set the clock speed and working mode, you can use cpufreq to manually adjust it. This mode will expire after restart. if you need to adjust it for a long time, modify/etc/sysconfig/cpuspeed. 1. check whether the kernel has been loaded by running the lsmod | grep & quot; acpi_cpufreq & quot; SSH command to check whether the kernel has been loaded.

The modern CPU and motherboard have power-saving technologies, which automatically reduce the frequency when the CPU is low-load. If you need to temporarily set the clock speed and working mode, you can use cpufreq to manually adjust it. This mode will expire after restart. if you need to adjust it for a long time, modify/etc/sysconfig/cpuspeed.


I. check Kernel loading
lsmod | grep "acpi_cpufreq"

Run the preceding command in SSH to check whether the acpi_cpufreq module has been loaded in the kernel. For example, it indicates that the file has been loaded.

 


II. install cpufreq
#32-bit system yum install-y cpufreq-utils.i386 #64-bit system yum install-y cpufreq-utils.x86_64

III. view the current CPU operating frequency and status
cpufreq-info

Run the above command by using SSH and output the following results:


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.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
Available cpufreq governors: ondemand, userspace, performance
Current policy: frequency shocould 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 ).


For example, The governor "ondemand" indicates The CPU frequency policy. There are three CPU policies: onemand (indicating that the system can adjust the frequency dynamically to reduce power consumption. the specific adjustment policy is related to the kernel's power consumption management algorithm ), userspace (indicating that the user can set the cpu frequency), performance (indicating that the CPU always works at the highest frequency ).

Current CPU frequency is 1.60 GHz indicates the current running clock speed.


4. adjust the CPU working mode
1. adjust the overall working mode
cpufreq-set -g performance

If you run the above commands through SSH, the CPU will always work at the highest clock speed (no energy saving, but high performance ). After execution, you can run cpufreq-info again to view the CPU policy and current clock speed.


2. specify the maximum and minimum frequencies for the manual No. 0 Core
cpufreq-set -c 0 -g userspace -d 180000 -u 240000

Run the preceding commands by using SSH. set core 0 to user-defined, and set the minimum frequency to 1.8 GHz and the maximum frequency to 2.4 GHz.


V. command usage
Usage: cpufreq-set [options] Options:-c CPU, -- cpu CPU # specifies the CPU core number. pay attention to the analyzing CPU number. -D FREQ, -- min FREQ # manually specify the minimum clock speed. (In the userspace policy)-u FREQ, -- max FREQ # manually specify the maximum clock speed. (Policy in userspace)-g GOV, -- governor GOV # set the working policy-f FREQ, -- freq FREQ # set the specific working frequency (default CPU grade) # Please refer to available frequency steps-h, -- help # output this help information
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.