What is CPU fixed frequency

What is CPU Frequency Scaling?

One of the most important (and obvious) characteristics of mobile computing is that mobile devices use batteries instead of being plugged into an electrical outlet. That means that every part of a mobile system that needs to save as much energy as possible is tuned while offering the best performance available. Usually these two requirements (efficiency and performance) are at odds with each other. The higher the output, the higher the power consumption and the heat generated. On the desktop, this isn't as much of a problem as PCs are plugged into the network and have massive cooling fans. Yet that's not the case on mobile.

There is a direct relationship between the amount of power used by a processor and its clock frequency. In a nutshell, all the faster the transistors (gates) in the chip the more power is turned on. How often are the gates switched on is controlled by the clock frequency. You may think of it as being related to the engine speed in a car, the higher the speed the more fuel is consumed.

That means that the clock frequency is also lowered by lowering the power consumption and that is of crucial importance for mobile computing and especially for smartphones. There is a feature in Android (via the Linux kernel) that allows the processor clock frequency to vary down, when the phone is not used much and booted up when needed.

It turns out that if the clock speed is lower then the chip doesn't need to run as many volts. So there is a correlation between the clock frequency and the volts needed. Hence, these two can be adjusted in tandem. Every time the clock frequency is changed, the voltage can also be changed. Modifying them together is known as dynamic voltage and frequency scaling, or DVFS for short.

What does it mean for users?

The biggest benefit for smartphone users is battery life. Since the CPU is at full power all the time, that means it is not running while you are reading a web page or thinking about your next move in a game, then the CPU frequency can be scaled down to save energy. As soon as the app has more power then the CPU frequency (along with the voltage) must be increased to handle the new requirements. However, this one weakness the DVFS does show it is reactive. The frequency is increased in response to the need for more power. This means that there is always a slight delay from when the extra power is needed to when it is delivered. Fortunately, the delay is almost imperceptible, but developers using profiling tools might see it, but more on that in the section below. To get around this delay, Android did a little trick, if the image of the CPU frequency is touched by one or more cores, in anticipation of some user interface activity will be increased.

If you see DVFS in action then you can download an app like CPU Z. On the SoC register, you can see a lot of information about the processor device including the make, model and number of cores. Also listed is some clock frequency data. Each core is listed next to its current frequency. If you watch closely you will see that each core has a changing clock rate. If some of the cores are paused and the others are running at a low speed (like 300MHz or similar) then touch the screen to see how the cores are responding.

There's one more thing worth mentioning, the scaling governor. It is part of the Linux kernel that controls DVFS scaling. It is called the scaling governor. The default governor is called "interactive". It is in fact the interactive governor who ramps the CPU frequency up when the screen is touched. Once you have rooted your phone it is possible to change the governor with programs like Kernel Adiutor (ROOT) or Root Booster.

There is a lot of information (and sometimes, misinformation) about changing governor to get significantly different performance / battery results from your device. If that sort of thing interests you then you could have fun playing with the governor settings, however you can only change the controls if you have root access. It should also be kept in mind that smartphone OEMs spend a lot of time and money building phones at the highest possible levels of performance while maintaining reasonable battery life. If the governor fine-tuning actually produces better results, then you can be sure that the OEMs would.

What does it mean for developers?

I mentioned that CPU scaling is reactive rather than proactive. this means that there may be a delay when leaving a low frequency state of around 20 ms. If you are using Android System Trace (Systrace) to profile your applications then you can see, at times, that the first image may not be in the 16 ms time frame required for the 60 images per second. There isn't much that you can do as a developer, but knowing that this is the expected behavior will stop you chasing your tail when you see a deleted frame when coming from a low CPU frequency.

Colt McAnlis has a short video on “CPU Frequency Scaling” on Android. In the video he describes how DVFS is one of those harsh realities of mobile development that you can't control, but can have an impact on your app.

There is more ...

In the last few years there have been a number of other advances to improve battery efficiency while increasing performance. The most important of these is probably Heterogeneous Multi-Processing (HMP), as used in the ARM big.LITTLE system. In an HMP processor not all cores are the same (therefore heterogeneous). In a modern 64-bit processor this would mean that a group of Cortex-A57 or Cortex-A72 cores would be used in conjunction with a cluster of Cortex-A53 cores. The A72 is a high performance core, while the A53 has a higher energy efficiency.

That means that if the workload is going to take two lots for the small cores (Cortex-A53 in this example), then the large cores (Cortex-A72). When DVFS is related to the revs of a car engine, that's big.LITTLE like changing gears.

I've written and benchmarks in pretty extensive detail on big.LITTLE processors, if you want to know more about HMP then I can suggest the following articles:

The first implementations of the software part for big.LITTLE used the DVFS system to trigger a switch from the small cores to the large cores. Since then, things have gotten more complex and ARM is currently working on an energy-conscious planner for Android that will enable the Linux kernel to fetch the running cores that perform tasks not only on the feedback from the DVFS system but also from the Intelligent Power Allocation ( IPA) algorithms and idle by the CPU. There are more details in my Energy-Aware Planning for Android article.

So bottom line, CPU frequency scaling is good, it saves battery. In conjunction with big.LITTLE, IPA and energy-conscious scheduling, the battery savings are even greater.

Android Authority
What is CPU Frequency Scaling?
Source: German
February 12, 2016