CPU policy learning: CPU policy-related nodes, CPU load viewing methods, CPU information viewing

Source: Internet
Author: User

Here, I will summarize my development experience and be familiar with kernel device nodes, which is helpful for Kernel-related driver learning and development.

1. View CPU Information

On the android application settings page, you can view information about the mobile phone or tablet Android devices in the menu. This information is an interface reserved by the kernel.

As a kernel developer, you can view this information directly in serial port debugging.

# Cd/sys/devices/system/CPU/

There is all CPU information in this directory. If it is a dual-core device, there will be cpu0 cpu1, CD in, you can see a lot of information.

2. View CPU load

Here is a link. I think it is better when I study it.


The first command is # uptime

PM up 2 days, 2 users, load average: 8.13, 5.90, 4.94

The final content of the command output indicates the average number of processes in the queue during the past 1, 5, and 15 minutes.

The second command is cat/proc/loadavg.

You can use these commands to find out what the information is.

3 CPU policy related nodes


This link is not very good, but it is quite good if you don't need to explain it, but you need to look at the code.

# Cd/sys/devices/system/CPU/

Similarly, in this directory, the CPU policy is part of the CPU information. Of course, it is the same as the CPU Information viewed in a large directory.

The subdirectories are separated.

In/sys/devices/system/CPU/cpufreq/, the related device nodes with the current policy are created during policy initialization.

For example, in the interactive policy, there will be a Directory Interactive and Cd, and you will see many sub-directory interfaces of this policy, each of which is useful

It can be viewed in combination with the code, or every CD, or cat echo.

Under/sys/devices/system/CPU/cpu0/cpufreq/, the stats node is displayed. When the CD goes in, there will be two subnodes, one being the total number of CPU Switching frequencies, one is the CPU frequency modulation process. The frequency distribution of the Frequency Modulation results can be performed under CAT

These nodes are used by some apks to display many applications related to CPU operations, such as viewing the pie chart of CPU frequency distribution percentage.

Or change the power-saving mode, change the CPU policy, set the load threshold, and so on.

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.