A CPU frequency tuning method and electronic device

By comprehensively calculating the load of the CPU, cluster, and SoC, the target frequency of the CPU is determined, which solves the problem that existing technologies cannot adapt to different CPU architectures and achieves more accurate CPU frequency tuning that is compatible with performance and power consumption requirements.

CN114579508BActive Publication Date: 2026-02-06HUAWEI TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202110143656.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Priority Date
2020-11-30
Filing Date
2021-02-02
Publication Date
2026-02-06
Estimated Expiration
2041-02-02

AI Technical Summary

Technical Problem

Existing technologies only consider the load of a single CPU when calculating CPU frequency, which cannot adapt to different CPU architectures. This results in the inability to meet different performance and power consumption requirements, and may even lead to performance lag.

Method used

By comprehensively calculating the load of the CPU, cluster, and SoC, the target frequency of the CPU is determined, including the CPU-level, cluster-level, and SoC-level frequencies, enabling more accurate CPU frequency tuning.

Benefits of technology

It can better adapt to changes in CPU computing tasks and different CPU architectures, and is compatible with performance and power consumption requirements, thus achieving more accurate CPU frequency tuning.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114579508B_ABST
    Figure CN114579508B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a CPU frequency adjusting method and an electronic device, to improve the accuracy of CPU frequency adjustment and meet different performance and power consumption requirements. In the CPU frequency adjusting method, the electronic device determines a target frequency of a first central processing unit (CPU) to be adjusted according to at least two of a frequency of the first CPU, a frequency of a cluster to which the first CPU belongs, and a frequency of a system on chip (SoC) to which the first CPU belongs; and adjusts the frequency of the first CPU according to the target frequency.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] Cross Reference to Related Applications

[0002] This application claims priority to the Chinese patent application No. 202011380562.5, filed on November 30, 2020, and entitled "CPU frequency tuning method and electronic device", the whole content of which is incorporated herein by reference. TECHNICAL FIELD

[0003] The present application relates to the technical field, and particularly relates to a CPU frequency tuning method and an electronic device. BACKGROUND

[0004] The central processing unit (CPU) frequency determines the running speed of the CPU, and is one of the indexes affecting the performance of the CPU. Generally, the higher the CPU frequency, the faster the running speed of the CPU, and the better the performance.

[0005] The electronic device can calculate the frequency of the CPU according to the load of the CPU, and tune the frequency of the CPU by using the calculated frequency of the CPU, so as to meet the use demand of the user.

[0006] However, when calculating the frequency of a single CPU, only the load of the single CPU is considered, which cannot adapt to different CPU architectures in the electronic device, cannot meet different performance and power consumption demands, and even causes performance lag. SUMMARY

[0007] The embodiments of the present application provide a central processing unit (CPU) frequency tuning method and an electronic device, which can improve the accuracy of CPU frequency tuning and meet different performance and power consumption demands.

[0008] In a first aspect, the embodiments of the present application provide a CPU frequency tuning method, which comprises: determining a target frequency of a first central processing unit (CPU) to be tuned according to at least two of the frequency of the first CPU, the frequency of a cluster to which the first CPU belongs, and the frequency of a system on chip (SoC) to which the first CPU belongs; and tuning the first CPU according to the target frequency.

[0009] Through the above method, the electronic device can calculate the final frequency of the CPU by comprehensively calculating the CPU-level frequency, the cluster-level frequency and the SoC-level frequency, so as to ensure that the CPU frequency tuning can be compatible with the performance and power consumption demands of the CPU, can better adapt to the change of the CPU computing task and adapt to large, medium and small core architectures, and realize more accurate CPU frequency tuning.

[0010] In a possible implementation, the cluster includes at least one CPU, and the at least one CPU includes the first CPU; and the SoC includes at least one cluster, and the at least one cluster includes the cluster to which the first CPU belongs. The CPU frequency adjustment method can be applied to a multi-core CPU architecture, thereby adapting to CPU architectures of different combinations of large, medium, and small cores, and achieving more accurate CPU frequency adjustment.

[0011] Optionally, the first CPU can be a large-core CPU, or a medium-core CPU, or a small-core CPU.

[0012] In a possible implementation, when the target frequency of the first CPU is determined according to at least two of the frequency of the first CPU to be adjusted, the frequency of the cluster to which the first CPU belongs, and the frequency of the SoC to which the first CPU belongs, the target frequency of the first CPU can be determined according to at least two of the frequency of the first CPU to be adjusted, the frequency of the cluster to which the first CPU belongs, and the frequency of the SoC to which the first CPU belongs, and performance requirements and power consumption requirements. Thereby, the change of a CPU computing task can be adapted, the performance and power consumption requirements of the CPU can be compatible, and more accurate frequency adjustment can be achieved.

[0013] Optionally, when performance is sensitive, the power consumption of the first CPU is maximum; and when performance is not sensitive, the power consumption of the first CPU is minimum.

[0014] Optionally, when the operation of a user is detected, the power consumption of the first CPU is maximum; and when the operation of the user is not detected, the power consumption of the first CPU is minimum.

[0015] In a possible implementation, the frequency of the CPU is determined according to the load of the CPU and / or the usage rate of the CPU. For example, the frequency of the CPU is determined according to the load of the CPU; or the frequency of the CPU is determined according to the load of the CPU and the usage rate of the CPU. By calculating the load at the CPU level, the performance and power consumption requirements of the CPU can be compatible, and more accurate CPU frequency adjustment can be achieved.

[0016] In a possible implementation, the frequency of the cluster to which the CPU belongs is determined according to the load of the cluster and / or the usage rate of the cluster. For example, the frequency of the cluster to which the CPU belongs is determined according to the load of the cluster; or the frequency of the cluster to which the CPU belongs is determined according to the load of the cluster and the usage rate of the cluster. When calculating the final frequency of the CPU, the load at the cluster level is considered, the performance and power consumption requirements of the CPU are compatible, and more accurate CPU frequency adjustment is achieved.

[0017] In a possible implementation, the load of the cluster is determined according to the load of at least one CPU belonging to the cluster; and the usage rate of the cluster is determined according to the usage rate of at least one CPU belonging to the cluster.

[0018] In a possible implementation, the frequency of the SoC to which the CPU belongs is determined according to the load of the SoC and / or the usage rate of the SoC. For example, the frequency of the SoC to which the CPU belongs is determined according to the load of the SoC; or the frequency of the SoC to which the CPU belongs is determined according to the load of the SoC and the usage rate of the SoC. When calculating the final frequency of the CPU, the load at the SoC level is considered, the performance and power consumption requirements of the CPU are compatible, and more accurate CPU frequency adjustment is achieved.

[0019] In a possible implementation, the load of the SoC is determined according to the load of at least one cluster belonging to the SoC; and the usage rate of the SoC is determined according to the usage rate of at least one cluster belonging to the SoC.

[0020] It can be seen that by comprehensively calculating the CPU-level load, the cluster-level load, and the SoC-level load, the frequency of the CPU is calculated, and when the CPU frequency is adjusted, the performance and power consumption requirements of the CPU are compatible, the change of the CPU computing task can be better adapted to, and the large, medium, and small core architectures can be better adapted to, so that more accurate CPU frequency adjustment is achieved.

[0021] In a second aspect, the embodiments of the present application further provide an electronic device, including: one or more processors; one or more memories; wherein the one or more memories store one or more computer programs, and the one or more computer programs include instructions, when the instructions are executed by the one or more processors, the electronic device performs the technical solutions of the first aspect and any possible implementation of the first aspect.

[0022] In a third aspect, the embodiments of the present application further provide an electronic device, which includes modules / units for performing the method of the first aspect or any possible implementation of the first aspect; these modules / units can be implemented by hardware, or by hardware executing corresponding software.

[0023] In a fourth aspect, the embodiments of the present application further provide a chip, which is coupled with a memory in an electronic device, and performs the technical solutions of the first aspect and any possible implementation of the first aspect of the embodiments of the present application; in the embodiments of the present application, "coupled" means that two components are directly or indirectly combined with each other.

[0024] In a fifth aspect, the embodiments of the present application further provide a computer readable storage medium, which includes a computer program, and when the computer program is running on an electronic device, the electronic device is caused to perform the technical solutions of the first aspect and any possible implementation of the first aspect of the embodiments of the present application.

[0025] In a sixth aspect, the embodiments of the present application further provide a computer program product, and when the computer program product is running on an electronic device, the electronic device is caused to perform the technical solutions of the first aspect and any possible implementation of the first aspect of the embodiments of the present application.

[0026] The technical effects that can be achieved by any one of the above-mentioned second aspect to sixth aspect and any possible implementation of any one of the aspects can refer to the technical effect descriptions of the corresponding designs in the first aspect and the first aspect, which will not be repeated here. BRIEF DESCRIPTION OF DRAWINGS

[0027] Figure 1 A hardware structure schematic diagram of an electronic device provided by the embodiments of the present application;

[0028] Figure 2 A schematic diagram of a CPU frequency adjustment module provided by the embodiments of the present application;

[0029] Figure 3 A schematic diagram of a CPU frequency adjustment strategy provided by the embodiments of the present application;

[0030] Figure 4 、 Figure 5 、 Figure 6 、 Figure 8 、 Figure 10 、 Figure 11 A schematic diagram of CPU frequency adjustment provided by the embodiments of the present application;

[0031] Figure 7 、 Figure 13 A schematic diagram of a CPU frequency adjustment method flow provided by the embodiments of the present application;

[0032] Figure 9, Figure 12 A schematic diagram illustrating a CPU frequency modulation scenario provided in an embodiment of this application;

[0033] Figure 14 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0034] To improve the accuracy of CPU frequency modulation and meet different performance and power consumption requirements, this application provides a CPU frequency modulation method. The method and electronic device are based on the same technical concept. Since the method and electronic device solve problems in similar principles, the embodiments of the electronic device and the method can be referred to each other, and repeated parts will not be described again.

[0035] The business scenarios described in the embodiments of this application are for the purpose of more clearly illustrating the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions provided in the embodiments of this application. As those skilled in the art will know, with the emergence of new business scenarios, the technical solutions provided in the embodiments of this application are also applicable to similar technical problems.

[0036] The following explanations of some terms used in the embodiments of this application are provided to facilitate understanding by those skilled in the art.

[0037] 1) Electronic device: The embodiments of this application can be applied to electronic devices. In the embodiments of this application, the electronic device can be a terminal. For example, the terminal can be a portable electronic device, such as a mobile phone, tablet computer, wearable device with wireless communication function (such as a smartwatch), in-vehicle device, etc. Exemplary embodiments of the portable electronic device include, but are not limited to, carrying... Or portable electronic devices with other operating systems.

[0038] For example, such as Figure 1 The diagram shown is a hardware structure schematic of an electronic device according to an embodiment of this application. Specifically, the electronic device 100 may include a processor 110, internal memory 121, external memory interface 122, audio module 130, speaker 130A, receiver 130B, microphone 130C, headphone jack 130D, display screen 141, camera 151, buttons 152, universal serial bus (USB) interface 160, charging management module 170, power management module 171, and battery 172. In some embodiments, the electronic device 100 may also include an indicator.

[0039] The processor 110 can include one or more processing units. For example, the processor 110 can include a CPU, an application processor (AP), a graphics processing unit (GPU), a baseband processor, and / or the like. Different processing units can be independent devices or integrated in one or more processors.

[0040] In the embodiments of the present application, the processor 110 includes one or more CPUs, each of which corresponds to a CPU frequency modulation module, and each CPU frequency modulation module is configured to modulate the frequency of the CPU to which it corresponds. Optionally, the CPU frequency modulation module can be located inside or outside the CPU. A possible structure of the CPU frequency modulation module is described below Figure 2 Further details are not discussed here.

[0041] The one or more CPU frequency modulation modules included in the electronic device 100 are not shown in Figure 1 .

[0042] In some embodiments, the processor 110 can also be provided with a memory for storing instructions and data.

[0043] The internal memory 121 can be used to store computer executable program codes, which include instructions. The processor 110 executes various functions of the electronic device and data processing by running the instructions stored in the internal memory 121. The internal memory 121 can include a program storage area and a data storage area. The program storage area can store an operating system, at least one application program required for a function (such as a sound playing function, an image capturing function, etc.), and the like. The data storage area can store data created during the use of the electronic device 100 (such as audio data, a phonebook, parameters required for taking pictures, etc.), and the like. In addition, the internal memory 121 can include a high-speed random access memory, and can also include a non-volatile memory such as at least one magnetic disk storage device, a flash memory device, a universal flash storage (UFS), and the like.

[0044] The external memory interface 122 can be used to connect an external memory card (for example, a Micro SD card), to realize the expansion of the storage capacity of the electronic device 100.

[0045] The electronic device 100 can realize audio functions through an audio module 130, a speaker 130A, a receiver 130B, a microphone 130C, a headphone interface 130D, an application processor, and the like. For example, music playing, recording, and the like.

[0046] The electronic device 100 can implement a display function through a GPU, the display screen 141, and an application processor, etc. The GPU is a microprocessor for image processing, connecting the display screen 141 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 can include one or more GPUs that execute program instructions to generate or change display information.

[0047] The display screen 141 can be used to display images, videos, etc. In some embodiments, the electronic device 100 can include 1 or N display screens 141, N being a positive integer greater than 1.

[0048] The electronic device 100 can also implement a shooting function through the camera 151, a video codec, the GPU, the display screen 141, and the application processor, etc.

[0049] The camera 151 can be used to capture still images or videos. An object generates an optical image through a lens and projects it to a photosensitive element. In some embodiments, the electronic device 100 can include 1 or N cameras 151, N being a positive integer greater than 1. The processor 110 or a processing unit (such as a GPU) included in the processor 110 can run or execute software programs and / or modules stored in the internal memory 121, and display the images on the display screen 141.

[0050] The key 152 can include a power-on key, a volume key, etc. The key 152 can be a mechanical key or a touch key. The electronic device 100 can receive a key input and generate a key signal input related to user settings and function control of the electronic device 100.

[0051] In other embodiments, the processor 110 can also include one or more interfaces. For example, the interface can be a SIM card interface. For another example, the interface can also be a USB interface 160. It can be understood that the embodiments of the present application can connect different modules of the electronic device 100 through the interface, so that the electronic device 100 can implement different functions. It should be noted that the embodiments of the present application do not limit the connection mode of the interface in the electronic device 100.

[0052] The USB interface 160 is an interface conforming to the USB standard specification. For example, the USB interface 160 can include a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 160 can be used to connect a charger to charge the electronic device 100, and can also be used to transmit data between the electronic device 100 and a peripheral device. It can also be used to connect earphones to play audio through the earphones. The USB interface 160 can also be used to connect other electronic devices.

[0053] The charging management module 170 is configured to receive charging input from a charger. The charger can be a wireless charger or a wired charger. In some embodiments of wired charging, the charging management module 170 can receive charging input from a wired charger through the USB interface 160. In some embodiments of wireless charging, the charging management module 170 can receive wireless charging input through a wireless charging coil of the electronic device 100. The charging management module 170 can supply power to the electronic device 100 through the power management module 171 while charging the battery 172.

[0054] The power management module 171 is configured to connect the battery 172, the charging management module 170, and the processor 110. The power management module 171 receives input from the battery 172 and / or the charging management module 170 to supply power to the processor 110, the internal memory 121, the external memory 122, the display 141, and the camera 151. The power management module 171 can also be configured to monitor parameters such as battery capacity, battery cycle count, battery health status (leakage, impedance), and the like. In some other embodiments, the power management module 171 can also be disposed in the processor 110. In some other embodiments, the power management module 171 and the charging management module 170 can also be disposed in the same device.

[0055] It should be understood that Figure 1 The hardware structure of the electronic device 100 shown is only an example. The electronic device 100 of the embodiments of the present application can have more or fewer components than those shown in the figure, can combine two or more components, or can have a different component configuration. The various components shown in the figure can be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing and / or application-specific integrated circuits.

[0056] In addition, it should be understood that the electronic device 100 in the embodiments of the present application can implement different functions by installing different applications, where the applications can be native applications such as settings, phone, camera, and the like, and can also be third-party applications downloaded from an application store, such as , and the like.

[0057] 2) CPU, which is the operation and control core of the electronic device, is mainly used to implement information processing and program running. The CPU can include one or more of a large-core CPU (which can also be referred to as a large core), a medium-core CPU (which can also be referred to as a medium core), or a small-core CPU (which can also be referred to as a small core), where the large core has the highest processing capability and the strongest performance, the medium core has the second highest processing capability and the second strongest performance, and the small core has the lowest processing capability and the weakest performance.

[0058] The CPU is part of a system on chip (SoC). For example, one or more CPUs can constitute a cluster, and the SoC of the electronic device includes multiple clusters, which facilitate scheduling of the CPUs and achieve a better energy ratio. Optionally, each cluster includes only large cores, medium cores, or small cores.

[0059] It is worth noting that each CPU (or the CPU frequency module corresponding to each CPU) can separately calculate the frequency of each CPU, and each CPU (or the CPU frequency module corresponding to each CPU) uses the frequency calculated by itself to perform frequency adjustment; or the cluster can calculate the frequency of the CPUs in the cluster, and each CPU in the cluster uses the frequency calculated by the cluster to perform frequency adjustment. In the embodiments of the present application, the subject of calculating the CPU frequency is not limited. That is, in the embodiments of the present application, the subject of calculating the CPU frequency is not limited.

[0060] If each CPU (or the CPU frequency module corresponding to each CPU) separately calculates the frequency of each CPU, the calculated frequency of each CPU can be the same or different, and the voltage of each CPU can also be the same or different; if the cluster can calculate the frequency of the CPUs in the cluster, the calculated frequency of each CPU in the cluster is generally the same, and the voltage of each CPU in the cluster is also the same.

[0061] It can be understood that, in order to simplify the description, the embodiments of the present application separately calculate the frequency of each CPU by the CPU frequency module corresponding to each CPU, and separately adjust the frequency of each CPU by using the calculated frequency.

[0062] 3) CPU frequency, also known as CPU main frequency, or simply frequency, is the clock frequency of the CPU, which refers to the working frequency of the CPU when operating, and the unit is hertz (Hz). The CPU frequency determines the running speed of the CPU and is one of the indicators that affect the performance of the CPU. Generally, the higher the CPU frequency, the faster the running speed of the CPU and the better the performance.

[0063] Here, the working principle of adjusting the frequency of a CPU is briefly described. First, the hardware characteristics of a CPU determine the maximum frequency and the minimum frequency of the CPU, i.e., a range cpuinfo_freq of CPU frequency adjustment, and all frequency adjustment values must be within this range. Then, a software adjustment range scaling_freq can be defined within this range, and a frequency table also needs to be provided according to different hardware platforms, which specifies the frequency values at which the CPU can work, and of course these frequency values must be within the cpuinfo_freq range. With these frequency information, a suitable frequency can be reasonably selected from the frequency table for the CPU to use according to the current load of the CPU. As for how to select the frequency in the frequency table, different governors are used to achieve this. The process of adjusting the frequency through the governor will be described in detail below.

[0064] 4) CPU voltage, referred to as voltage, is the voltage required for the normal operation of the CPU, and the unit is volt (V). Generally, the higher the CPU frequency, the higher the operating voltage required for the CPU.

[0065] There is a corresponding relationship between frequency and voltage. By adjusting the frequency, the voltage can be adjusted, and by adjusting the voltage, the frequency can also be adjusted. By adjusting the voltage and the frequency, the balance between the performance and the power consumption of the CPU can be achieved to meet different performance and power consumption requirements. For example, when high performance is not required or low power consumption is required, the frequency and the voltage can be reduced, or when high performance is required, the voltage and the frequency can be increased.

[0066] 5) CPU frequency adjustment module, each CPU corresponds to a CPU frequency adjustment module, and each CPU frequency adjustment module is used to adjust the frequency of the CPU it corresponds to. Optionally, the CPU frequency adjustment module can be located inside or outside the CPU.

[0067] As shown in Figure 2 , the CPU frequency adjustment module at least includes a CPU frequency (frequency, Freq) core module, a CPU Freq driver, and a CPU Freq governor. The CPU Freq core is connected with the CPU Freq driver and the CPU Freq governor, respectively.

[0068] The CPUFreq core is used to provide a common application programming interface (API) and encapsulate various logic internally to achieve the required functionality.

[0069] The CPUFreq driver is used to handle platform-specific logic to complete the control of CPU frequency and voltage. The platform refers to different types of processors, such as x86 or advanced RISC machine (ARM), or such as Qualcomm Snapdragon or Kirin and the like.

[0070] The CPUFreq governor can also be regarded as a frequency controller, which is responsible for detecting the usage of the CPU and selecting a suitable frequency within the available range according to different usage scenarios.

[0071] Each CPU corresponds to an independent CPU frequency policy (cpufreq_policy), such as Figure 3 shown in FIG. 1, CPU_0 corresponds to policy_0, CPU_1 corresponds to policy_1, …, and CPU_7 corresponds to policy_7. Each cpufreq_policy contains a CPUFreq governor to adjust the frequency, and the CPUFreq driver controls the CPU frequency according to the frequency selected by the CPUFreq governor. The optional CPUFreq governor can include, but is not limited to, at least one of the following: performance, powersave, conservative, ondemand, interactive, userspace, and / or schedutil.

[0072] Performance: runs at the highest frequency within a set range, which can be cpuinfo_freq or the adjustment range of scaling_freq.

[0073] Powersave: runs at the lowest frequency within a set range.

[0074] Conservative: dynamically adjusts the CPU frequency on demand, gradually increases the frequency when there is high demand, and quickly reduces the frequency when there is low demand.

[0075] Ondemand: When the electronic device is not operated by the user, the CPU is controlled at the lowest frequency. Once there is a task for the CPU (such as user operation such as sliding screen or opening application), the CPU is quickly raised to the highest working frequency.

[0076] Interactive: Focus on response speed and performance. When there is high demand, quickly adjust to high frequency. When the demand is low, gradually reduce the frequency.

[0077] Userspace: Run at a user-specified frequency. The user-specified frequency does not exceed the configured frequency range, such as the adjustment range of cpuinfo_freq or scaling_freq.

[0078] Schedutil: Adjust the CPU frequency based on scheduling, for example, when the user plays online games, the CPU frequency is higher, and when the user uses chat software to chat, the CPU frequency is lower.

[0079] In the ARM platform CPU frequency adjustment, the cluster is managed as a whole, and the CPUs in the same cluster have the same cpufreq_policy. When adjusting the CPU frequency, the CPUs in the same cluster are adjusted.

[0080] It should be noted that in this application, "at least one" means one or more, and more means two or more. In the description of the present application, "first", "second", etc. are used only for the purpose of distinguishing the description, and cannot be understood as indicating or implying relative importance. Also cannot be understood as indicating or implying order.

[0081] The CPU frequency adjustment process in the related art will be briefly described below:

[0082] In the related art, the electronic device 100 (or the CPU frequency adjustment module in the electronic device 100) calculates the frequency of the CPU according to the load of the CPU, as shown in the following formula 1:

[0083] cpu_freq = f1(cpu_util) Formula 1

[0084] Wherein, cpu_freq is the frequency of the CPU, cpu_util is the load of the CPU, and f1 is an algorithm for calculating the frequency of the CPU, which is not limited here. It can be seen that when calculating the frequency of a single CPU, only the load of a single CPU is considered, which cannot adapt to the CPU architecture of large, medium and small cores, and therefore performance lag problems may occur.

[0085] The above problems will be described below. A possible formula based on formula 1 is shown in formula 2:

[0086]

[0087] wherein cpu_cap is the usage rate of the CPU, and cpu_max_freq is the highest working frequency of the CPU.

[0088] When the electronic device 100 is a big-little architecture (i.e., a SoC including big cores and little cores), such as including 2 little cores and 2 big cores, referring to (a) of FIG. 1, the SoC includes cluster0 and cluster1, cluster0 includes 2 little cores, CPU0 and CPU1 respectively, and cluster1 includes 2 big cores, CPU2 and CPU3 respectively. Assume that 4 tasks are added, one of which is a critical task (such as the black box shown in (a) of FIG. 1) and one is a non-critical task (such as the white box shown in (a) of FIG. 1) running on CPU0, and the remaining two non-critical tasks run on CPU1. According to formula 2, the frequency of each little core CPU is calculated to be 1.8 gigahertz (GHz), and the completion time of the critical task is 0.5 seconds (s). Figure 4 Figure 4 Figure 4

[0089] When the same 4 tasks as in (a) of FIG. 1 run on a SoC with 4 big cores and 2 little cores, referring to (b) of FIG. 1, the SoC includes cluster0 and cluster1, cluster0 includes 4 little cores, CPU0, CPU1, CPU2 and CPU3 respectively, and cluster1 includes 2 big cores, CPU4 and CPU5 respectively. The critical task of the 4 tasks runs on CPU0, and the remaining three non-critical tasks run on CPU1, CPU2 and CPU3 respectively. According to formula 2, the frequency of each little core CPU is calculated to be 0.9 GHz, and the completion time of the critical task is 1 s, which can be seen that the completion time of the task is lengthened, and the performance of the CPU is obviously decreased. Figure 4 Figure 4 In order to shorten the completion time of the task and improve the performance of the CPU, one way is to add a factor to formula 2 to obtain formula 3:

[0090]

[0091] When factor1 = 1, the SoC architecture shown in (a) of FIG. 1 remains unchanged, and the tasks remain unchanged, referring to (a) of FIG. 2, according to formula 3, the frequency of each little core CPU is calculated to be 1.8 GHz, and the completion time of the critical task is 0.5 s, and the power consumption and performance remain unchanged.

[0092] Figure 4 Figure 5 ​​​​​​

[0093] When factor1 = 2, Figure 4 When the SoC architecture shown in (b) of FIG. 1 is unchanged and the tasks are unchanged, referring to (a) of FIG. 2, Figure 5 According to formula 3, the frequency of each small core CPU is calculated as 1.8 GHz, the completion time of the key task is 0.5 s, and the power consumption and performance remain unchanged.

[0094] However, in actual electronic device 100, the computing tasks of the CPU change when the electronic device 100 is working. Referring to (a) of FIG. 3, Figure 6 When factor1 = 1, Figure 4 When the SoC architecture shown in (a) of FIG. 1 is unchanged but the tasks change, it is assumed that there are five tasks, one key task and one non-key task running on CPU0, and the remaining three non-key tasks running on CPU1. According to formula 3, the frequency of each small core CPU is calculated as 1.8 GHz, the completion time of the key task is 0.5 s, and the power consumption and performance remain unchanged.

[0095] When factor1 = 2, Figure 4 When the SoC architecture shown in (b) of FIG. 1 is unchanged but the tasks change, referring to (b) of FIG. 4, Figure 6 As shown in (b) of FIG. 4, among the same five tasks as in (a) of FIG. 1, one key task and one non-key task run on CPU0, and the remaining three non-key tasks run on CPU1, CPU2, and CPU3, respectively. According to formula 3, the frequency of each small core CPU is calculated as 3.6 GHz, and the completion time of the key task is 0.25 s. It can be seen that the power consumption of the CPU doubles and significantly increases. Figure 6

[0096] In summary, when the computing tasks of the CPU change, the frequency of the CPU is adjusted according to the frequency calculated in the related art, which may cause the power consumption of the CPU to increase. That is, the related art cannot meet the performance and power consumption requirements of the CPU, cannot adapt to different CPU architectures, and cannot adapt to changes in the computing tasks of the CPU, and cannot accurately adjust the frequency of the CPU.

[0097] In order to improve the accuracy of CPU frequency adjustment and meet the performance and power consumption requirements of the CPU, the embodiments of the present application provide a CPU frequency adjustment method and device. In the CPU frequency adjustment method, the frequency of the CPU is determined based on the load of the CPU, cluster, and SoC, which can better adapt to changes in large, medium, and small core architectures and computing tasks, and ensure the accuracy of CPU frequency adjustment. The CPU frequency adjustment method provided by the embodiments of the present application is described in detail below in combination with the hardware structure of electronic device 100 shown in FIG. 5. Referring to FIG. 5, Figure 1 The CPU frequency adjustment method provided by the embodiments of the present application is described in detail below in combination with the hardware structure of electronic device 100 shown in FIG. 5. Referring to FIG. 5, Figure 7 The CPU frequency adjustment method provided by the embodiments of the present application is described in detail below in combination with the hardware structure of electronic device 100 shown in FIG. 5. Referring to FIG. 5, ​

[0098] Optionally, S701: The electronic device 100 determines that the timer is expired.

[0099] The CPU frequency adjusting method provided by the embodiments of the present application can be implemented by the electronic device 100, more specifically, can be implemented by a CPU frequency adjusting module or a kernel scheduling module in the electronic device 100. Optionally, the kernel scheduling module comprises the CPU frequency adjusting module.

[0100] The electronic device 100 can store a timer, which can be a positive counting timer or a countdown timer, and the duration of the timer can be any value, which is not limited herein.

[0101] The step of S701 can be considered as that the electronic device 100 periodically adjusts the CPU frequency.

[0102] S702: The electronic device 100 calculates the load of each CPU, the load of the cluster to which the CPU belongs, and the load of the SoC to which the CPU belongs.

[0103] Taking the SoC architecture shown in (a) of FIG. 1 as an example, referring to (b) of FIG. 1, the electronic device 100 calculates the load cpu0_util of CPU0, the load cpu1_util of CPU1, the load cpu2_util of CPU2, and the load cpu3_util of CPU3, and the electronic device 100 calculates the load cluster0_util of the cluster0 to which CPU0 and CPU1 belong, the load cluster1_util of the cluster1 to which CPU2 and CPU3 belong, and the electronic device 100 calculates the load soc_util of the SoC to which the cluster0 and the cluster1 belong. Figure 4 Figure 8

[0104] The load of a CPU can be determined according to the number of tasks running on the CPU in a unit time. The duration of the unit time can be any value, which is not limited herein. The duration of the unit time can be the same as or different from the duration of the timer.

[0105] The load of a cluster can be determined according to the load of the CPU belonging to the cluster. For example, the load of the cluster satisfies the following formula 4:

[0106]

[0107] Wherein, cluster_util is the load of the cluster, i is the i-th CPU, m is the number of CPUs, m is a positive integer, i is a positive integer and i is less than or equal to m. ​​

[0108] The load of the SoC can be determined according to the load of the cluster belonging to the SoC. For example, the load of the SoC satisfies the following formula 5:

[0109]

[0110] wherein, soc_util is the load of the SoC, j is the jth cluster, n is the number of clusters, n is a positive integer, j is a positive integer and j is less than or equal to n.

[0111] Optionally, the electronic device 100 can also calculate, for each CPU, the usage rate of each CPU, the usage rate of the cluster to which the CPU belongs, and the usage rate of the SoC to which the CPU belongs.

[0112] The usage rate of the CPU can be determined according to the CPU resources occupied by the task running on the CPU.

[0113] The usage rate of the cluster can be determined according to the usage rate of the CPU belonging to the cluster. For example, the usage rate of the cluster satisfies the following formula 6:

[0114]

[0115] wherein, cluster_cap is the usage rate of the cluster, i is the ith CPU, m is the number of CPUs, m is a positive integer, i is a positive integer and i is less than or equal to m.

[0116] The usage rate of the SoC can be determined according to the usage rate of the cluster belonging to the SoC. For example, the usage rate of the SoC satisfies the following formula 7:

[0117]

[0118] wherein, soc_cap is the usage rate of the SoC, j is the jth cluster, n is the number of clusters, n is a positive integer, j is a positive integer and j is less than or equal to n.

[0119] S703: The electronic device 100 determines to trigger CPU frequency adjustment.

[0120] In S703, the electronic device 100 can determine, for each CPU, whether the current frequency of each CPU matches the load of each CPU calculated in S702. If it matches, the electronic device 100 can determine to trigger CPU frequency adjustment, and if it does not match, the electronic device 100 can determine not to trigger CPU frequency adjustment.

[0121] In one possible example, the electronic device 100 can count the current frequency of each CPU, calculate the load of each CPU that can be processed by the current frequency of each CPU, and then determine whether the load of each CPU calculated in S702 is not too high or too low compared to the load of each CPU that can be processed by the current frequency of each CPU. If not too high and not too low, it is determined to match, and if too high or too low, it is determined to not match.

[0122] When the electronic device 100 determines to trigger the CPU frequency adjustment, the electronic device 100 performs S704. When the electronic device 100 does not determine to trigger the CPU frequency adjustment, the electronic device 100 optionally returns to perform S701.

[0123] S704: The electronic device 100 calculates the frequency of each CPU according to the load of each CPU, the load of the cluster to which each CPU belongs, and the load of the SoC to which each CPU belongs.

[0124] In S704, the electronic device 100 can calculate the CPU-level frequency of each CPU according to the load of each CPU, calculate the cluster-level frequency according to the load of the cluster to which each CPU belongs, calculate the SoC-level frequency according to the load of the SoC to which each CPU belongs, and then determine the final frequency of each CPU according to the CPU-level frequency of each CPU, the cluster-level frequency corresponding to each CPU, and the SoC-level frequency.

[0125] The CPU-level frequency is determined according to the load of the CPU. For example, the CPU-level frequency satisfies the following formula 8:

[0126] cpu_freq = f2(cpu_util, cpu_max_freq) Formula 8

[0127] Where f2 is an algorithm for calculating the CPU-level frequency, which is not limited here.

[0128] Optionally, the CPU-level frequency can be determined according to the load of the CPU and the usage rate of the CPU. For example, the CPU-level frequency satisfies the following formula 9:

[0129] cpu_freq = f3(cpu_util, cpu_cap, cpu_max_freq) Formula 9

[0130] Where f3 is an algorithm for calculating the CPU-level frequency, which is not limited here.

[0131] The cluster-level frequency can be determined according to the load of the cluster. For example, the cluster-level frequency satisfies the following formula 10:

[0132] cluster_freq = f4(cluster_util, cpu_max_freq) Formula 10

[0133] Wherein, f4 is an algorithm for calculating the cluster-level frequency, which is not limited here. cpu_max_freq can be the highest working frequency among all CPUs belonging to the cluster.

[0134] Optionally, the cluster-level frequency can be determined according to the load of the cluster and the usage of the cluster. For example, the cluster-level frequency satisfies the following formula 11:

[0135] cluster_freq = f5(cluster_util, cluster_cap, cpu_max_freq) Formula 11

[0136] Wherein, f5 is an algorithm for calculating the CPU-level frequency, which is not limited here.

[0137] The SoC-level frequency can be determined according to the load of the SoC. For example, the SoC-level frequency satisfies the following formula 12:

[0138] soc_freq = f6(soc_util, cpu_max_freq) Formula 12

[0139] Wherein, f6 is an algorithm for calculating the SoC-level frequency, which is not limited here. cpu_max_freq can be the highest working frequency among all CPUs belonging to the SoC.

[0140] Optionally, the SoC-level frequency can be determined according to the frequency of the SoC and the usage of the SoC. For example, the SoC-level frequency satisfies the following formula 13:

[0141] soc_freq = f7(soc_util, soc_cap, cpu_max_freq) Formula 13

[0142] Wherein, f7 is an algorithm for calculating the SoC-level frequency, which is not limited here.

[0143] The final frequency of the CPU can be determined according to the CPU-level frequency of the CPU, the cluster-level frequency corresponding to the CPU, and the SoC-level frequency corresponding to the CPU. For example, the CPU-level frequency satisfies the following formula 14:

[0144] target_freq = f8(cpu_freq, cluster_freq, soc_freq) Equation 14

[0145] Wherein, target_freq is the final frequency of the CPU, f8 is an algorithm for calculating the final frequency of the CPU, which is not limited here. cpu_freq is the CPU-level frequency of the CPU, cluster_freq is the cluster-level frequency corresponding to the CPU, and soc_freq is the SoC-level frequency corresponding to the CPU.

[0146] For example, f8 can be a maximum value algorithm or a minimum value algorithm or an average value algorithm, or alternatively, the algorithm of f8 can be determined according to the power consumption and performance conditions, such as f8 being a maximum value algorithm in a time period in which the user operates the electronic device 100, and f8 being an average value algorithm or a minimum value algorithm in other time periods.

[0147] In a possible implementation, the display screen 141 of the electronic device 100 can provide a setting interface, and the setting interface provides performance mode, power saving mode, automatic adjustment mode and balance mode for the user to select, and then the electronic device 100 calculates the final frequency of the CPU according to the mode selected by the user, and then selects the f8 corresponding to the mode to calculate the final frequency of the CPU. The process can be specifically referred to in the following Figure 9 .

[0148] S705: The electronic device 100 adjusts the frequency of each CPU according to the final frequency of each CPU.

[0149] Specifically, in the S705, the CPUFreq governor in the electronic device 100 calls the CPUFreq driver in the electronic device 100 to enable CPU frequency and adjust the frequency of the CPU.

[0150] Optionally, the electronic device 100 can also adjust the voltage of each CPU.

[0151] It can be understood that each formula involved in the embodiments of the present application is an example, and does not limit the actual calculation process.

[0152] In the CPU frequency adjustment method provided by the embodiments of the present application, the CPU-level load, the cluster-level load and the SoC-level load are comprehensively calculated to calculate the frequency of the CPU, so that when the CPU is adjusted in frequency, the performance and power consumption requirements of the CPU can be compatible, the change of the CPU computing task can be better adapted, and the large, medium and small core architectures can be adapted, and more accurate CPU frequency adjustment can be achieved.

[0153] The hardware structure of the electronic device 100 shown below, and Figure 1 The CPU frequency adjustment process shown below further illustrates the CPU frequency adjustment method provided by the embodiments of the present application. Figure 7

[0154] Referring to Figure 9 As shown, the display screen 141 of the electronic device 100 displays a user interface 900. The user interface 900 includes an icon 901 of a settings application. In addition, the user interface 900 can also include icons of other applications, such as an icon of a camera application, an icon of a gallery, an icon of a phone, and the like. In some embodiments, the user interface 900 can also include a status bar 902, a hideable navigation bar 903, and a Dock bar 904. The status bar 902 can also include the name of an operator (such as China Mobile, etc.), a mobile network (such as 4G), a Bluetooth icon, time, and remaining power. In addition, it can be understood that in other embodiments, the status bar 902 can also include a Wi-Fi icon, an external device icon, and the like. The navigation bar 903 can include a back button, a home button, and a history task viewing button. The Dock bar 904 can include icons of commonly used applications, such as an icon of a phone, an icon of information, and an icon of a camera. It should be noted that the icons in the Dock bar 904 can be set according to the needs of the user.

[0155] The electronic device 100 can display a user interface 910 on the display screen 141 in response to a first operation. The first operation can be an operation on the icon 901 of the settings application, an operation on a voice instruction of the user (such as “open the settings interface”), or a shortcut gesture operation (such as a three-finger downward swipe, etc.). For example, in the case of a touch operation on the icon 901 of the settings application, the electronic device 100 can respond to the operation on the icon 901 of the settings application in the following manner: after the touch sensor of the electronic device 100 detects the operation on the icon 901 of the settings application, it sends a touch event to the processor 110 (such as an application processor), the processor 110 receives the touch event, determines that the type of the touch event is an operation to open the settings application, and then notifies the display screen 141 to display the user interface 910. The user interface 910 includes a battery setting button 911. In other embodiments, the user interface 910 can also include a WLAN setting button, a Bluetooth setting button, a mobile network setting button, and the like.

[0156] ​The electronic device 100 can display the user interface 920 on the display screen 141 in response to a second operation. The second operation can be an operation on the battery setting button 911, an operation on a voice instruction of the user (e.g., "open the battery setting interface"), or a shortcut gesture operation. The user interface 920 includes a performance mode button 921, a power saving mode button 922, an automatic adjustment mode button 923, and a balance mode button 924. In some other embodiments, the user interface 920 can further include other mode buttons.

[0157] The processor 110 in the electronic device 100 can perform CPU frequency adjustment according to different mode buttons selected by the user.

[0158] For example, when the user selects the performance mode button 921, the CPU is adjusted by the CPUFreq governor of performance, and the frequency of the CPU is adjusted to the highest frequency in the set range. For example, the formula 14 is adapted to obtain the formula 15: Figure 8

[0159] target_freq = max(cpu_freq, cluster_freq, soc_freq) Formula 15

[0160] In the formula 15, f8 is the maximum value algorithm max, so the frequency of the CPU can be as high as possible to meet the performance requirements of the user.

[0161] For example, when the user selects the power saving mode button 922, the CPU is adjusted by the CPUFreq governor of powersave, and the frequency of the CPU is adjusted to the lowest frequency in the set range. For example, the formula 14 is adapted to obtain the formula 16: Figure 8

[0162] target_freq = min(cpu_freq, cluster_freq, soc_freq) Formula 16

[0163] In the formula 16, f8 is the minimum value algorithm min, so the frequency of the CPU can be as low as possible to meet the power consumption requirements of the user.

[0164] For example, when the user selects the automatic adjustment mode button 923, the CPU is adjusted by the CPUFreq governor of conservative or ondemand.

[0165] ​​For example, the user selects the equalization adjustment mode button 924, and the interactive CPUFreq governor is used to adjust the frequency of the CPU.

[0166] For example, the user selects the equalization adjustment mode button 924, and the interactive CPUFreq governor is used to adjust the frequency of the CPU. Figure 8 For example, the user selects the equalization adjustment mode button 924, and the interactive CPUFreq governor is used to adjust the frequency of the CPU.

[0167] target_freq = avg (cpu_freq, cluster_freq, soc_freq) Formula 17

[0168] f8 in Formula 17 is an average algorithm avg, so that the power consumption requirement and the performance requirement of the user can be balanced.

[0169] In one possible mode, a factor can be added to the formula involved in the embodiments of the present application to further optimize the CPU frequency adjustment effect. For example, a factor factor2 is added to Formula 11 to obtain Formula 18:

[0170]

[0171] For example, a factor factor3 is added to Formula 13 to obtain Formula 19:

[0172]

[0173] In order to more intuitively illustrate the performance and power consumption effect of the CPU frequency adjustment method provided by the embodiments of the present application. Figure 10 and Figure 11 The CPU frequency adjustment result applied to the small core CPU for the computing task.

[0174] When factor2 = 1 and factor3 = 1, Figure 4 The SoC architecture shown in (a) of FIG. 10 is unchanged, and the task is unchanged, as shown in (a) of FIG. 10. Figure 10 According to Formula 18 and Formula 19, the frequency of each small core CPU is calculated as 1.8 GHz, the completion time of the key task is 0.5 s, and the power consumption and performance remain unchanged. When factor2 = 2 and factor3 = 1, Figure 4 The SoC architecture shown in (b) of FIG. 10 is unchanged, and the task is unchanged, as shown in (b) of FIG. 10. Figure 10 According to Formula 18 and Formula 19, the frequency of each small core CPU is calculated as 1.8 GHz, the completion time of the key task is 0.5 s, and the power consumption and performance remain unchanged.

[0175] When factor2 = 1 and factor3 = 1, Figure 6 The SoC architecture shown in (a) of FIG. 10 is unchanged, and the task is unchanged, as shown in (a) of FIG. 10.Figure 11 As shown in (a) of FIG. 13, according to the formula 18 and the formula 19, the frequency of each small core CPU is calculated as 1.8 GHz, the completion time of the key task is 0.5 s, and the power consumption and the performance remain unchanged. When factor2 = 2 and factor3 = 1, Figure 6 As shown in (b) of FIG. 13, the SoC architecture and the task remain unchanged, and as shown in (b) of FIG. 13, according to the formula 18 and the formula 19, the frequency of each small core CPU is calculated as 2.25 GHz, the completion time of the key task is 0.4 s, and the power consumption and the performance remain unchanged. Figure 11 As shown in (b) of FIG. 13, the SoC architecture and the task remain unchanged, and as shown in (b) of FIG. 13, according to the formula 18 and the formula 19, the frequency of each small core CPU is calculated as 2.25 GHz, the completion time of the key task is 0.4 s, and the power consumption and the performance remain unchanged.

[0176] It can be seen that the CPU frequency adjustment method provided in the embodiments of the present application can better adapt to the change of the CPU computing task and adapt to the large core, medium core and small core architecture, and is compatible with the performance and power consumption requirements of the CPU, and can achieve more accurate CPU frequency adjustment. It can be understood that when the computing task runs in the architecture of the medium core CPU, the large core CPU, the combination of the large core and the medium core, the combination of the large core and the small core, the combination of the medium core and the small core, and the combination of the large core, the medium core and the small core, the performance and the power consumption can also be guaranteed to be flat, which is not specifically illustrated here.

[0177] Of course, the user interface 900 can also place a CPU frequency adjustment button 905, and the user can operate the CPU frequency adjustment button 905 to perform corresponding CPU frequency adjustment. As shown in Figure 12 The electronic device 100 responds to the user's operation of the CPU frequency adjustment button 905. The display screen 141 of the electronic device 100 displays a user interface 1200, and the user interface 1200 includes a performance mode button 1201, a power saving mode button 1202, an automatic adjustment mode button 1203 and a balance mode button 1204. In other embodiments, the user interface 1200 can also include other mode buttons.

[0178] Based on Figure 2 to Figure 12 The embodiments of the present application provide a CPU frequency adjustment method, as shown in Figure 13 The method is applicable to an electronic device.

[0179] S1301: The electronic device 100 determines the target frequency of the first CPU according to at least two of the frequency of the first CPU to be adjusted, the frequency of the cluster to which the first CPU belongs, and the frequency of the SoC to which the first CPU belongs.

[0180] Specifically, the CPU frequency adjustment method can be implemented by a CPU frequency adjustment module or a kernel scheduling module in the electronic device 100. Optionally, the kernel scheduling module includes the CPU frequency adjustment module.

[0181] The electronic device 100 includes one or more CPUs. The CPU in the electronic device 100 can be a large-core CPU, a medium-core CPU, or a small-core CPU. Alternatively, in the CPU architecture of the electronic device 100, the SoC includes at least one cluster, and the at least one cluster includes a cluster to which the first CPU belongs. The cluster includes at least one CPU, and the at least one CPU includes the first CPU.

[0182] In a possible implementation, the electronic device 100 can determine to perform CPU frequency adjustment in the following scenarios:

[0183] The CPU computing task of the electronic device 100 changes; or

[0184] The electronic device 100 detects a user operation; or

[0185] The electronic device 100 determines that the current frequency of the CPU does not match the calculated frequency, for example, the frequency of the first CPU does not match the target frequency of the first CPU.

[0186] It can be understood that when the electronic device 100 includes multiple CPUs, the CPU frequency adjustment method provided in the embodiments of the present application can be performed for each CPU.

[0187] In the S1301, the electronic device 100 can determine the target frequency of the first CPU according to at least two of the frequency of the first CPU to be adjusted, the frequency of the cluster to which the first CPU belongs, and the frequency of the SoC to which the first CPU belongs, and the performance requirement and the power consumption requirement. For example, when performance is sensitive, the power consumption of the first CPU is maximum; when performance is not sensitive, the power consumption of the first CPU is minimum. For another example, when a user operation is detected, the power consumption of the first CPU is maximum; when no user operation is detected, the power consumption of the first CPU is minimum.

[0188] The frequency of the CPU is determined according to the load of the CPU and / or the usage rate of the CPU. The frequency of the cluster to which the CPU belongs is determined according to the load of the cluster and / or the usage rate of the cluster. The frequency of the SoC to which the CPU belongs is determined according to the load of the SoC and / or the usage rate of the SoC.

[0189] The specific implementation process of the S1301 can be referred to the description in the above embodiments, which is not repeated here.

[0190] S1302: The electronic device 100 adjusts the frequency of the first CPU according to the target frequency.

[0191] Optionally, the electronic device 100 can also adjust the voltage of the first CPU.

[0192] In the embodiments of the present application, the CPU frequency is calculated by comprehensively calculating the CPU level load, the cluster level load and the SoC level load, so that when the CPU frequency is adjusted, the performance and power consumption requirements of the CPU can be compatible, the change of the CPU computing task can be better adapted, and the large, medium and small core architectures can be adapted, and more accurate CPU frequency adjustment can be realized.

[0193] In some other embodiments of the present application, an electronic device is disclosed, which can include: Figure 14 As shown, the electronic device can include one or more processors 1401, one or more memories 1402, one or more application programs (not shown), and one or more computer programs 1403, which can be connected through one or more communication buses 1404. The one or more computer programs 1403 are stored in the memory 1402 and configured to be executed by the one or more processors 1401, and the one or more computer programs 1403 include instructions that can be used to execute the steps of the corresponding embodiments. Figure 13 The steps of the corresponding embodiments.

[0194] The embodiments of the present application also provide a computer storage medium, which stores computer instructions, when the computer instructions are run on a foldable screen device, the foldable screen device executes the related method steps to realize the CPU frequency adjustment method in the above embodiments.

[0195] The embodiments of the present application also provide a computer program product, when the computer program product is run on a computer, the computer executes the related steps to realize the CPU frequency adjustment method in the above embodiments.

[0196] In addition, the embodiments of the present application also provide a device, which can be a chip, a component or a module, and the device can include a processor and a memory connected thereto; wherein the memory is used to store computer execution instructions, and when the device is running, the processor can execute the computer execution instructions stored in the memory to make the chip execute the CPU frequency adjustment method in the above method embodiments.

[0197] The electronic device, computer storage medium, computer program product or chip provided by the embodiments of the present application are used to execute the corresponding methods provided above, and thus the beneficial effects that can be achieved are referred to the beneficial effects in the corresponding methods provided above, which will not be repeated here.

[0198] Through the description of the above embodiments, those skilled in the art can understand that, for the convenience and brevity of description, only the division of the above functional modules is exemplified, and in actual application, the above functions can be completed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above.

[0199] In several embodiments provided in the present application, it should be understood that the disclosed device and method can be implemented in other ways. For example, the device embodiment described above is only illustrative, for example, the division of the module or unit is only a logical function division, and actual implementation can have another division mode, for example, a plurality of units or components can be combined or integrated into another device, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed can be indirect coupling or communication connection of some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0200] The unit described as a separate component can or can not be physically separated, and the component shown as a unit can be one physical unit or a plurality of physical units, that is, it can be located in one place or distributed to a plurality of different places. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment scheme.

[0201] In addition, the functional units in each embodiment of the present application can be integrated in one processing unit, or each unit can exist physically, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software functional unit.

[0202] If the integrated unit is realized in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on such understanding, the technical scheme of the embodiment of the present application essentially or the part that contributes to the prior art or the whole or part of the technical scheme can be embodied in the form of a software product, which is stored in a storage medium and includes a plurality of instructions for causing an apparatus (which can be a single chip microcomputer, a chip, etc.) or a processor to execute all or part of the steps of the method of each embodiment of the present application. The foregoing storage medium includes: a U disk, a mobile hard disk, a read only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various storage medium that can store program codes.

[0203] The above merely provides the specific implementation of the present application, but the protection scope of the present application is not limited to this. Any person skilled in the art can easily think of the changes or replacements within the technical range disclosed by the present application, which should be covered in the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims

1. A CPU frequency modulation method, characterized in that, include: The target frequency of the first CPU is determined based on the frequency of the first central processing unit (CPU) to be frequency-tuned, the frequency of the cluster to which the first CPU belongs, the frequency of the system-on-a-chip (SoC) to which the first CPU belongs, and a first algorithm; the first algorithm is a maximum value algorithm, a minimum value algorithm, or an average value algorithm. The first CPU is frequency-adjusted according to the target frequency.

2. The method as described in claim 1, characterized in that, The cluster includes at least one CPU, and the at least one CPU includes the first CPU; The SoC includes at least one cluster, and the at least one cluster includes the cluster to which the first CPU belongs.

3. The method as described in claim 1 or 2, characterized in that, The step of determining the target frequency of the first CPU based on the frequency of the first CPU to be frequency-tuned, the frequency of the cluster to which the first CPU belongs, the frequency of the SoC to which the first CPU belongs, and the first algorithm includes: The target frequency of the first CPU is determined based on the frequency of the first CPU to be frequency-tuned, the frequency of the cluster to which the first CPU belongs, the frequency of the SoC to which the first CPU belongs, the first algorithm, and the performance and power consumption requirements.

4. The method as described in claim 3, characterized in that, Also includes: When performance is a sensitive factor, the first CPU consumes the most power; When performance is not a concern, the first CPU consumes the least power.

5. The method according to any one of claims 1-4, characterized in that, The frequency of the first CPU is determined based on the load on the first CPU; or, The frequency of the first CPU is determined based on the load and utilization rate of the first CPU.

6. The method according to any one of claims 1-5, characterized in that, The frequency of the cluster to which the first CPU belongs is determined based on the cluster's load; or, The frequency of the cluster to which the first CPU belongs is determined based on the cluster's load and utilization rate.

7. The method as described in claim 6, characterized in that, The load of the cluster is determined based on the load of at least one CPU belonging to the cluster; The utilization rate of the cluster is determined based on the utilization rate of at least one CPU belonging to the cluster.

8. The method according to any one of claims 1-7, characterized in that, The frequency of the SoC to which the first CPU belongs is determined based on the load of the SoC; or The frequency of the SoC to which the first CPU belongs is determined based on the load and utilization rate of the SoC.

9. The method as described in claim 8, characterized in that, The load of the SoC is determined based on the load of at least one cluster belonging to the SoC; The utilization rate of the SoC is determined based on the utilization rate of at least one cluster belonging to the SoC.

10. The method according to any one of claims 1-9, characterized in that, The first CPU is a large-core CPU, a medium-core CPU, or a small-core CPU.

11. An electronic device, characterized in that, include: One or more processors; One or more memory units; The one or more memories store one or more computer programs, the one or more computer programs including instructions that, when executed by the one or more processors, cause the electronic device to perform the following steps: The target frequency of the first CPU is determined based on the frequency of the first central processing unit (CPU) to be frequency-tuned, the frequency of the cluster to which the first CPU belongs, the frequency of the system-on-a-chip (SoC) to which the first CPU belongs, and a first algorithm; the first algorithm is a maximum value algorithm, a minimum value algorithm, or an average value algorithm. The first CPU is frequency-adjusted according to the target frequency.

12. The electronic device as claimed in claim 11, characterized in that, The cluster includes at least one CPU, and the at least one CPU includes the first CPU; The SoC includes at least one cluster, and the at least one cluster includes the cluster to which the first CPU belongs.

13. The electronic device as claimed in claim 11 or 12, characterized in that, When the instruction is executed by the one or more processors, the electronic device performs the following steps: The target frequency of the first CPU is determined based on the frequency of the first CPU to be frequency-tuned, the frequency of the cluster to which the first CPU belongs, the frequency of the SoC to which the first CPU belongs, the first algorithm, and the performance and power consumption requirements.

14. The electronic device as claimed in claim 13, characterized in that, When performance is a sensitive factor, the first CPU consumes the most power; When performance is not a concern, the first CPU consumes the least power.

15. The electronic device according to any one of claims 11-14, characterized in that, The frequency of the first CPU is determined based on the load on the first CPU; or, The frequency of the first CPU is determined based on the load and utilization rate of the first CPU.

16. The electronic device according to any one of claims 11-15, characterized in that, The frequency of the cluster to which the first CPU belongs is determined based on the cluster's load; or, The frequency of the cluster to which the first CPU belongs is determined based on the cluster's load and utilization rate.

17. The electronic device as claimed in claim 16, characterized in that, The load of the cluster is determined based on the load of at least one CPU belonging to the cluster; The utilization rate of the cluster is determined based on the utilization rate of at least one CPU belonging to the cluster.

18. The electronic device according to any one of claims 11-16, characterized in that, The frequency of the SoC to which the first CPU belongs is determined based on the load of the SoC; or The frequency of the SoC to which the first CPU belongs is determined based on the load and utilization rate of the SoC.

19. The electronic device as claimed in claim 18, characterized in that, The load of the SoC is determined based on the load of at least one cluster belonging to the SoC; The utilization rate of the SoC is determined based on the utilization rate of at least one cluster belonging to the SoC.

20. The electronic device according to any one of claims 11-19, characterized in that, The first CPU is a large-core CPU, a medium-core CPU, or a small-core CPU.

21. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, the computer program including program instructions that, when executed by a computer, cause the computer to perform the method as described in any one of claims 1-10.

Citation Information

Patent Citations

  • CPU power supply management method, apparatus and terminal equipment

    CN102023697A

  • Task scheduling method, task scheduling device and multi-core system

    CN104820618A

  • Dynamic power consumption capping regulation and control method and equipment

    CN111309480A