CPU frequency processing method and electronic equipment
Patent Information
- Application Number
- CN202480031438.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2023-05-29
- Filing Date
- 2024-02-29
- Publication Date
- 2025-12-19
AI Technical Summary
The power consumption problem of electronic devices has not been effectively solved, making it difficult to balance the performance and power consumption of the device in multi-task operation scenarios.
By introducing a CPU frequency processing method in electronic devices, the CPU frequency is dynamically adjusted according to the task's packet information and load impact factors, ensuring that power consumption is saved while meeting performance requirements. The specific method includes calculating the CPU load through grouping information and load impact factors in a mixed operation scenario of foreground and background tasks, and adjusting the CPU frequency based on actual response delay and power consumption to meet the preset service quality specifications.
It achieves significant power savings, improve user experience while meeting task performance requirements, and optimizes the balance between system performance and power consumption.
Smart Images

Figure CN121175641A_ABST
Abstract
Description
CPU frequency processing method and electronic device
[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on May 29, 2023, with application number 202310619203.8 and application name “A CPU frequency processing method and electronic device”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The embodiments of the present application relate to terminal technology, and more particularly to a CPU frequency processing method and electronic device. Background Art
[0003] With advancements in terminal technology, a wide variety of electronic devices have emerged. These devices have become increasingly essential to our daily lives and work. However, the power consumption of these devices remains a significant issue, with no effective solution. Therefore, reducing the power consumption of these devices is an urgent challenge for those skilled in the art.
[0004] Summary of the Invention
[0005] The embodiments of the present application provide a CPU frequency processing method and an electronic device, which can save power consumption of the electronic device.
[0006] In a first aspect, an embodiment of the present application provides a CPU frequency processing method, the method comprising:
[0007] The electronic device runs at a first CPU frequency when N tasks are running in the foreground; N is an integer greater than 1;
[0008] The electronic device switches M tasks out of the N tasks to background operation; M is an integer greater than 0 and less than N;
[0009] In a mixed task running scenario where the electronic device runs the M tasks in the background and NM tasks in the foreground, the electronic device runs at a second CPU frequency; the second CPU frequency is lower than the first CPU frequency.
[0010] Optionally, the electronic device runs N tasks in the foreground, including: the electronic device displays user interfaces of the N tasks on the display screen by means of split screen or floating windows.
[0011] The above solution takes into account the different CPU frequency requirements for tasks running in the foreground and background of an electronic device. Specifically, foreground tasks, because they need to respond promptly to real-time user input requests, have higher performance requirements such as response latency and frame rate, which translates to higher CPU frequency requirements. Background tasks, on the other hand, have lower performance requirements, which translates to lower CPU frequency requirements. Therefore, after a task is switched from the foreground to the background, it can run at a lower CPU frequency, saving power.
[0012] In a possible implementation, in a mixed task running scenario where the M tasks are run in the background and NM tasks are run in the foreground, the method further includes:
[0013] The electronic device obtains first grouping information of each task in the N tasks and a first load of each task; the NM tasks belong to the first group, the M tasks belong to the second group, the tasks included in the first group are tasks running in the foreground, and the tasks included in the second group are tasks running in the background;
[0014] The electronic device calculates the CPU load based on the first grouping information of each task and the first load of each task to obtain a first CPU load;
[0015] The electronic device determines the second CPU frequency based on the first CPU load.
[0016] In the above scheme, since the tasks running in the foreground and the tasks running in the background belong to different groups, the grouping information can be used to distinguish the tasks running in the foreground and background, and then the CPU load can be calculated based on the difference in grouping and the load of the specific task. In other words, the calculated CPU load is calculated by taking into account the grouping of the tasks, that is, the foreground and background running conditions of the tasks. As a result, the CPU frequency obtained by frequency modulation based on the calculated CPU load matches the actual running task, which can meet the performance requirements of the task while saving power as much as possible.
[0017] In one possible implementation, the electronic device calculates the CPU load based on the first grouping information of each task in the N tasks and the first load of each task to obtain the first CPU load, including:
[0018] The electronic device obtains a load impact factor of each task based on the first group information of each task; each group corresponds to a load impact factor, and each task corresponds to the load impact factor of the group to which it belongs;
[0019] The electronic device calculates the first CPU load based on the load impact factor of each task and the first load of each task.
[0020] In the above solution, we can use task groups as the granularity and set a corresponding load impact factor for each group to weight the load of the tasks in that group. Different groups have different load impact factors, which can better calculate the appropriate CPU load.
[0021] In one possible implementation, the electronic device, in a mixed task running scenario where the M tasks are running in the background and NM tasks are running in the foreground, further includes:
[0022] The electronic device obtains its own first response delay and / or first power consumption;
[0023] If the first response delay and / or the first power consumption does not meet the requirements of the preset quality of service (QoS) specification, the electronic device re-determines the CPU frequency to obtain a third CPU frequency.
[0024] In the above solution, frequency modulation based on the mixed operation of foreground and background tasks can also ensure that the QoS requirements of the electronic device are met. If the requirements are not met, the frequency can be re-modulated until they are met. This implementation ensures that power consumption is saved while meeting the performance requirements of the task, thereby improving the user experience.
[0025] In one possible implementation, the electronic device re-determines the CPU frequency to obtain a third CPU frequency, including:
[0026] The electronic device obtains second grouping information of each of the N tasks and a second load of each task; the NM tasks belong to a first group, the M tasks belong to a second group, the tasks included in the first group are tasks running in the foreground, and the tasks included in the second group are tasks running in the background; each group corresponds to a load impact factor, and each task in the N tasks corresponds to the load impact factor of the group to which it belongs;
[0027] The electronic device adjusts the load impact factor corresponding to the first group and / or the second group;
[0028] The electronic device obtains the adjusted load impact factor of each task based on the second grouping information of each task;
[0029] The electronic device calculates the CPU load based on the load influence factor of each task obtained after the adjustment and the second load of each task to obtain a second CPU load;
[0030] The electronic device determines the third CPU frequency based on the second CPU load.
[0031] In the above solution, if the response latency and / or power consumption do not meet the preset QoS specifications, the task group information and task load can be re-obtained, the load impact factor of the group to which the currently running task belongs can be adjusted, the CPU load can be recalculated based on the adjusted load impact factor, and the frequency can be re-adjusted based on the newly calculated CPU load. This can achieve optimization and balance between performance and power consumption.
[0032] In one possible implementation, if the first response delay is greater than the response delay required by the QoS specification, the electronic device specifically performs the following operations:
[0033] The electronic device increases the load impact factor corresponding to the first group and / or the second group;
[0034] The electronic device obtains, based on the second grouping information of each task, a load impact factor of each task after the increase;
[0035] The electronic device calculates the second CPU load based on the increased load impact factor of each task and the second load of each task;
[0036] The electronic device determines the third CPU frequency based on the second CPU load; the third CPU frequency is greater than the second CPU frequency and less than the first CPU frequency.
[0037] In the above scheme, if the actual response delay exceeds the response delay specified by the preset QoS specification, it indicates that the CPU operating frequency is adjusted too low, resulting in the inability to meet the service performance requirements. In this case, the load impact factor corresponding to the group to which the currently running task belongs can be adaptively increased. Then, the CPU load output is recalculated based on the increased impact factor. The newly calculated CPU load is input into the CPU frequency regulator for frequency adjustment to obtain the adjusted CPU operating frequency. Since the impact factor is increased, the calculated CPU load increases, thereby increasing the CPU operating frequency obtained by re-adjustment. Then, the tasks in the electronic device are run based on the increased CPU operating frequency. Since the CPU operating frequency is increased, the response delay of the service can be increased to meet the service performance requirements.
[0038] In one possible implementation, if the first power consumption is greater than the power consumption required by the QoS specification, the electronic device specifically performs the following operations:
[0039] The electronic device adjusts the load impact factor corresponding to the first group and / or the second group to be lowered;
[0040] The electronic device obtains the load impact factor of each task after the adjustment based on the second grouping information of each task;
[0041] The electronic device calculates the second CPU load based on the load impact factor of each task after the adjustment and the second load of each task;
[0042] The electronic device determines the third CPU frequency based on the second CPU load; the third CPU frequency is lower than the second CPU frequency.
[0043] Optionally, when the first power consumption is greater than the power consumption required by the QoS specification and the first response delay meets the response delay required by the QoS specification, the electronic device lowers the load impact factor corresponding to the first group and / or the second group.
[0044] In the above scheme, if the response delay specified by the preset QoS specification is met, but the actual power consumption exceeds the power consumption specified by the preset QoS specification, it indicates that the CPU operating frequency is adjusted too high, resulting in power waste. In this case, the impact factor corresponding to the group to which the currently running task belongs can be adaptively lowered. Then, the CPU load output is recalculated based on the lowered impact factor. The newly calculated CPU load can be input into the CPU frequency regulator for frequency adjustment to obtain the adjusted CPU operating frequency. Since the impact factor is lowered, the calculated CPU load is reduced, thereby reducing the CPU operating frequency obtained by re-adjustment. Then, the tasks in the electronic device are run based on the reduced CPU operating frequency. Since the CPU operating frequency is reduced, power consumption can be saved and power waste can be reduced.
[0045] In a possible implementation, the load impact factor corresponding to the second group is smaller than the load impact factor corresponding to the first group.
[0046] In the above solution, since background tasks have lower performance requirements than foreground tasks, the load impact factor corresponding to the group of background tasks can be set to be smaller than the load impact factor corresponding to the group of foreground tasks. This allows for a simple and efficient calculation of a more appropriate CPU load, thereby obtaining a more appropriate CPU operating frequency and saving power.
[0047] In a second aspect, an embodiment of the present application provides an electronic device, comprising: one or more processors and a memory; the memory is coupled to the one or more processors, the memory being used to store computer program code, the computer program code comprising computer instructions, the one or more processors calling the computer instructions to enable the electronic device to execute: when N tasks are running in the foreground, running at a first CPU frequency; N is an integer greater than 1; switching M of the N tasks to run in the background; M is an integer greater than 0 and less than N; in a mixed task running scenario of running the M tasks in the background and running NM tasks in the foreground, running at a second CPU frequency; the second CPU frequency is less than the first CPU frequency.
[0048] Optionally, running N tasks in the foreground includes: displaying user interfaces of the N tasks on a display screen by way of split screen or floating windows.
[0049] In one possible implementation, in the mixed task running scenario where the M tasks are running in the background and the NM tasks are running in the foreground, the one or more processors are also used to call the computer instructions to enable the electronic device to execute: obtaining the first grouping information of each task in the N tasks and the first load of each task; the NM tasks belong to the first group, the M tasks belong to the second group, the tasks included in the first group are tasks running in the foreground, and the tasks included in the second group are tasks running in the background; calculating the CPU load based on the first grouping information of each task and the first load of each task to obtain the first CPU load; and determining the second CPU frequency based on the first CPU load.
[0050] In one possible implementation, the one or more processors are used to call the computer instructions so that the electronic device specifically executes: obtaining the load impact factor of each task based on the first group information of each task; each group corresponds to a load impact factor, and each task corresponds to the load impact factor of the group to which it belongs; calculating the first CPU load based on the load impact factor of each task and the first load of each task.
[0051] In one possible implementation, in the above-mentioned mixed task running scenario where the M tasks are running in the background and the NM tasks are running in the foreground, after running at the second CPU frequency, the one or more processors are also used to call the computer instructions to enable the electronic device to execute: obtain its own first response delay and / or first power consumption; if the first response delay and / or the first power consumption does not meet the requirements of the preset quality of service QoS specifications, re-determine the CPU frequency to obtain a third CPU frequency.
[0052] In one possible implementation, the one or more processors are used to call the computer instructions so that the electronic device specifically executes: obtaining the second grouping information of each task in the N tasks and the second load of each task; the NM tasks belong to the first group, the M tasks belong to the second group, the tasks included in the first group are tasks running in the foreground, and the tasks included in the second group are tasks running in the background; each group corresponds to a load impact factor, and each task in the N tasks corresponds to the load impact factor of the group to which it belongs; adjusting the load impact factor corresponding to the first group and / or the second group; obtaining the adjusted load impact factor of each task based on the second grouping information of each task; calculating the CPU load based on the load impact factor of each task obtained after the adjustment and the second load of each task to obtain the second CPU load; determining the third CPU frequency based on the second CPU load.
[0053] In one possible implementation, if the first response delay is greater than the response delay required by the QoS specification, the one or more processors are used to call the computer instructions to enable the electronic device to specifically execute: increasing the load impact factor corresponding to the first group and / or the second group; obtaining the increased load impact factor of each task based on the second group information of each task; calculating the second CPU load based on the increased load impact factor of each task and the second load of each task; determining the third CPU frequency based on the second CPU load; the third CPU frequency being greater than the second CPU frequency and less than the first CPU frequency.
[0054] In one possible implementation, if the first power consumption is greater than the power consumption required by the QoS specification, the one or more processors are used to call the computer instructions to enable the electronic device to specifically execute: lowering the load impact factor corresponding to the first group and / or the second group; obtaining the load impact factor of each task after the reduction based on the second group information of each task; calculating the second CPU load based on the load impact factor of each task after the reduction and the second load of each task; determining the third CPU frequency based on the second CPU load; the third CPU frequency is less than the second CPU frequency.
[0055] Optionally, when the first power consumption is greater than the power consumption required by the QoS specification and the first response delay meets the response delay required by the QoS specification, the one or more processors are used to call the computer instruction to enable the electronic device to specifically execute: lowering the load impact factor corresponding to the first group and / or the second group.
[0056] Optionally, the load impact factor corresponding to the second group is smaller than the load impact factor corresponding to the first group.
[0057] In a third aspect, an embodiment of the present application provides an electronic device comprising: a touch screen, a camera, one or more processors and one or more memories; the one or more processors are coupled to the touch screen, the camera, and the one or more memories, and the one or more memories are used to store computer program code, the computer program code including computer instructions, and when the one or more processors execute the computer instructions, the electronic device executes the method described in the first aspect or any possible implementation method of the first aspect.
[0058] In a fourth aspect, an embodiment of the present application provides a chip system, which is applied to an electronic device, and the chip system includes one or more processors, which are used to call computer instructions to enable the electronic device to execute the method described in the first aspect or any possible implementation method of the first aspect.
[0059] In a fifth aspect, an embodiment of the present application provides a computer program product comprising instructions, which, when executed on an electronic device, enables the electronic device to execute the method described in the first aspect or any possible implementation of the first aspect.
[0060] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium comprising instructions, which, when executed on an electronic device, enables the electronic device to execute the method described in the first aspect or any possible implementation of the first aspect.
[0061] The above-mentioned second to sixth aspects are used to cooperate with the method of implementing any one of the above-mentioned first aspect and its possible implementation methods, and therefore have corresponding beneficial effects as the above-mentioned first aspect and its possible implementation methods, which will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0062] FIG1 is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application;
[0063] FIG2 is a schematic diagram of a method flow chart provided in an embodiment of the present application;
[0064] FIG3 is a schematic diagram of a CPU load calculation process according to an embodiment of the present application;
[0065] FIG4 is a schematic diagram of a hybrid task operation scenario provided by an embodiment of the present application;
[0066] FIG5 is a schematic diagram of modules for implementing the method provided in an embodiment of the present application;
[0067] FIG6 is a schematic diagram of the software structure of an electronic device provided in an embodiment of the present application;
[0068] FIG6A is a schematic diagram of the software architecture of the frequency modulation module provided in an embodiment of the present application;
[0069] FIG7 is a schematic diagram of a module interaction process according to an embodiment of the present application;
[0070] FIG8 is a schematic diagram of CPU load changes according to an embodiment of the present application;
[0071] FIG9 is a schematic diagram of CPU frequency change according to an embodiment of the present application;
[0072] Figures 10 to 12 are schematic diagrams of user interfaces provided in embodiments of the present application;
[0073] FIG13 is another schematic diagram of CPU frequency change provided in an embodiment of the present application. DETAILED DESCRIPTION
[0074] The technical solutions in the embodiments of the present application will be described below in conjunction with the accompanying drawings. In the description of the embodiments of the present application, unless otherwise specified, " / " represents or, for example, A / B can represent A or B; "and / or" in the text is merely a description of the association relationship between associated objects, indicating that three relationships can exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present application, "multiple" refers to two or more than two.
[0075] In the following, the terms "first" and "second" are used for descriptive purposes only and should not be understood to imply or suggest relative importance or implicitly indicate the number of the technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the embodiments of this application, unless otherwise specified, "plurality" means two or more.
[0076] The term "user interface (UI)" in the following embodiments of this application refers to a medium interface for interaction and information exchange between an application or operating system and a user, which realizes the conversion between the internal form of information and the form acceptable to the user. The user interface is a source code written in a specific computer language such as Java and extensible markup language (XML). The interface source code is parsed and rendered on an electronic device and finally presented as content that the user can recognize. The commonly used form of user interface is graphical user interface (GUI), which refers to a user interface related to computer operations that is displayed in a graphical manner. It can be a visual interface element such as text, icons, buttons, menus, tabs, text boxes, dialog boxes, status bars, navigation bars, widgets, etc. displayed on the display screen of an electronic device.
[0077] Only part relevant to the present application is shown in the accompanying drawings, not all of it. Before discussing exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processing or methods depicted as flow charts. Although flow charts describe various operations (or steps) as sequential processing, many operations therein can be implemented in parallel, concurrently or simultaneously. In addition, the order of various operations can be rearranged. When its operation is completed, the processing can be terminated, but can also have additional steps not included in the accompanying drawings. The processing can correspond to methods, functions, procedures, subroutines, subprograms, etc.
[0078] First, let’s introduce the technical terms involved in the embodiments of this application.
[0079] 1. Process
[0080] A process is a computer program's execution of a data set. It is the basic unit of system resource allocation and the foundation of operating system architecture. In modern thread-oriented computer architectures, a process is a container for threads. A program is a description of instructions, data, and their organization, while a process is the entity of the program.
[0081] 2. Thread.
[0082] A thread is the smallest unit of computation that an operating system can schedule. It is contained within a process and is the actual unit of operation within that process. A thread is a single, sequential flow of control within a process. Multiple threads can run concurrently within a process, each performing a different task.
[0083] 3. Task.
[0084] For example, the tasks described in the embodiments of the present application are tasks executed by a thread. For example, an application runs through a process, and a process may include one or more threads, each of which performs a different task. Therefore, one or more tasks may be executed during the running of an application.
[0085] In another possible implementation, a task described in the embodiment of the present application can be a task executed by an application process, or a task obtained by dividing the task into other granularities, which is not limited by the embodiment of the present application. For the convenience of subsequent description, the embodiment of the present application mainly introduces a task as a task executed by a thread as an example. In the embodiment of the present application, a task can also be referred to as a task scenario, and the two are equivalent.
[0086] 4. Foreground operation.
[0087] For example, in an embodiment of the present application, if a task (or application) is running and the user interface of the task (or application) is displayed on the display screen, then the task (or application) is said to be running in the foreground. Alternatively, the task (or application) is called a task (or application) running in the foreground. For example, taking a mobile phone as an example, if the display screen of the mobile phone is displaying the user interface of a video application playing a video, then the video playback task of the video application is running in the foreground.
[0088] 5. Run in the background.
[0089] For example, in an embodiment of the present application, if a task (or application) is running and the user interface of the task (or application) is not displayed on the display screen, the task (or application) is said to be running in the background. Alternatively, the task (or application) is called a task (or application) running in the background. For example, taking a mobile phone as an example, if the mobile phone is executing a download task and the user interface of the download task is not displayed on the display screen, then the download task is running in the background.
[0090] During the use of electronic devices, there are often multiple tasks running at the same time, and the multiple tasks include composite task scenarios of tasks running in the foreground and tasks running in the background. For example, while a video playback task is running in the foreground, a navigation task is also running in the background; or, while an interface sliding task is running in the foreground, a download task is also running in the background, and so on. In these composite scenarios, the system power consumption accounts for a large proportion, heat is serious, and performance may be stuck, but there are no good solutions. To this end, the embodiments of the present application provide a CPU frequency processing method, and an electronic device that implements the CPU frequency processing method.
[0091] The following is an illustrative introduction to the electronic devices provided by the embodiments of the present application. The electronic devices involved in the embodiments of the present application may include handheld devices (for example, mobile phones, tablet computers, PDAs, etc.), vehicle-mounted devices (for example, cars, electric cars, airplanes, ships, etc.), wearable devices (for example, smart watches (such as iWatch, etc.), smart bracelets, pedometers, etc.), smart home devices (for example, refrigerators, televisions, air conditioners, electric meters, etc.), intelligent robots, workshop equipment, and various forms of user equipment (UE), mobile stations (MS), terminal equipment, etc. Optionally, electronic devices generally support multiple applications, such as camera applications, word processing applications, telephone applications, email applications, instant messaging applications, photo management applications, web browsing applications, digital music player applications and / or digital video player applications, etc. It will be understood that the introduction here is only an example, and the embodiments of the present application do not limit the specific form and implementation of the electronic device.
[0092] For example, please refer to FIG1 , which shows a schematic diagram of the hardware structure of an electronic device 100 .
[0093] The following embodiments are described in detail using electronic device 100 as an example. It should be understood that electronic device 100 may have more or fewer components than shown in the figure, may combine two or more components, or may have a different component configuration. The various components shown in the figure may be implemented in hardware, including one or more signal processing and / or application-specific integrated circuits, software, or a combination of hardware and software.
[0094] The electronic device 100 may include: a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
[0095] The processor 110 may include one or more processing units. For example, the processor 110 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU). The different processing units may be independent devices or integrated into one or more processors.
[0096] The controller may be the nerve center and command center of the electronic device 100. The controller may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.
[0097] Processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in processor 110 is a cache memory. This memory can store instructions or data that have just been used or are being recycled by processor 110. If processor 110 needs to use the same instruction or data again, it can directly access the memory. This avoids duplicate accesses, reduces processor 110 latency, and thus improves system efficiency.
[0098] In some embodiments, the processor 110 may include one or more interfaces. The interfaces may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface.
[0099] The I2C interface is a bidirectional synchronous serial bus that includes a serial data line (SDA) and a serial clock line (SCL). In some embodiments, the processor 110 may include multiple I2C bus lines. The processor 110 may be coupled to the touch sensor 180K, the charger, the flash, the camera 193, and the like via different I2C bus interfaces. For example, the processor 110 may be coupled to the touch sensor 180K via the I2C interface, enabling communication between the processor 110 and the touch sensor 180K via the I2C bus interface, thereby implementing the touch function of the electronic device 100.
[0100] The I2S interface can be used for audio communication. In some embodiments, the processor 110 can include multiple I2S buses. The processor 110 can be coupled to the audio module 170 via the I2S bus to enable communication between the processor 110 and the audio module 170. In some embodiments, the audio module 170 can transmit audio signals to the wireless communication module 160 via the I2S interface, enabling the function of answering calls through a Bluetooth headset.
[0101] The PCM interface can also be used for audio communication, sampling, quantizing, and encoding analog signals. In some embodiments, the audio module 170 and the wireless communication module 160 can be coupled via a PCM bus interface. In some embodiments, the audio module 170 can also transmit audio signals to the wireless communication module 160 via the PCM interface, enabling the function of answering calls via a Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.
[0102] The UART interface is a universal serial data bus used for asynchronous communication. This bus can be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication. In some embodiments, the UART interface is typically used to connect the processor 110 and the wireless communication module 160. For example, the processor 110 communicates with the Bluetooth module in the wireless communication module 160 via the UART interface to implement Bluetooth functionality. In some embodiments, the audio module 170 can transmit audio signals to the wireless communication module 160 via the UART interface, enabling the function of playing music through Bluetooth headphones.
[0103] The MIPI interface can be used to connect the processor 110 to peripheral devices such as the display 194 and the camera 193. MIPI interfaces include the camera serial interface (CSI) and the display serial interface (DSI). In some embodiments, the processor 110 and the camera 193 communicate via the CSI interface to implement the camera function of the electronic device 100. The processor 110 and the display 194 communicate via the DSI interface to implement the display function of the electronic device 100.
[0104] The GPIO interface can be configured via software. The GPIO interface can be configured as either a control signal or a data signal. In some embodiments, the GPIO interface can be used to connect the processor 110 to the camera 193, display 194, wireless communication module 160, audio module 170, sensor module 180, etc. The GPIO interface can also be configured as an I2C interface, an I2S interface, a UART interface, a MIPI interface, etc.
[0105] The SIM card interface can be used to communicate with the SIM card interface 195 to implement the function of transmitting data to the SIM card or reading data in the SIM card.
[0106] The USB interface 130 is an interface that complies with USB standards and may be a Mini USB interface, a Micro USB interface, a USB Type-C interface, or the like. The USB interface 130 can be used to connect a charger to charge the electronic device 100, or to transfer data between the electronic device 100 and peripheral devices. It can also be used to connect headphones to play audio. This interface can also be used to connect other electronic devices, such as augmented reality devices.
[0107] It is understood that the interface connection relationship between the modules illustrated in the embodiments of the present application is merely an illustrative illustration and does not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods from the above embodiments, or a combination of multiple interface connection methods.
[0108] The charging management module 140 is configured to receive charging input from a charger, which may be a wireless charger or a wired charger.
[0109] The power management module 141 is used to connect the battery 142, the charging management module 140, and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140 to provide power to the processor 110, the internal memory 121, the external memory, the display 194, the camera 193, and the wireless communication module 160.
[0110] The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.
[0111] Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In other embodiments, the antennas can be used in conjunction with a tuning switch.
[0112] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G applied to the electronic device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.
[0113] The modem processor may include a modulator and a demodulator. The modulator is used to modulate the low-frequency baseband signal to be transmitted into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After being processed by the baseband processor, the low-frequency baseband signal is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to the speaker 170A, the receiver 170B, etc.) or displays an image or video through the display screen 194. In some embodiments, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 110 and be set in the same device as the mobile communication module 150 or other functional modules.
[0114] The wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to the electronic device 100. The wireless communication module 160 can be one or more devices that integrate at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, frequency modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, frequency modulate it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.
[0115] In some embodiments, the antenna 1 of the electronic device 100 is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the electronic device 100 can communicate with a network and other devices through wireless communication technologies. The wireless communication technologies may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology. The GNSS may include a global positioning system (GPS), a global navigation satellite system (GLONASS), a Beidou navigation satellite system (BDS), a quasi-zenith satellite system (QZSS) and / or a satellite based augmentation system (SBAS).
[0116] Electronic device 100 implements display functionality through a GPU, display screen 194, and an application processor. A GPU is a microprocessor for image processing that connects display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 110 may include one or more GPUs that execute program instructions to generate or modify display information.
[0117] Display screen 194 is used to display images, videos, and the like. Display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a MiniLED, a MicroLED, a Micro-oLed, or a quantum dot light-emitting diode (QLED). In some embodiments, electronic device 100 may include one or N display screens 194, where N is a positive integer greater than one.
[0118] The electronic device 100 can implement a shooting function through an ISP, a camera 193, a video codec, a GPU, a display screen 194, and an application processor.
[0119] The ISP processes data fed back by camera 193. For example, when taking a photo, the shutter is opened, and light is transmitted through the lens to the camera's photosensitive element. The light signal is converted into an electrical signal, which is then passed to the ISP for processing and converted into a visible image. The ISP can also perform algorithmic optimization on image noise and brightness. It can also optimize parameters such as exposure and color temperature of the captured scene. In some embodiments, the ISP can be located within camera 193.
[0120] The camera 193 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the light signal into an electrical signal, and then passes the electrical signal to the ISP for conversion into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In some embodiments, the electronic device 100 may include 1 or N cameras 193, where N is a positive integer greater than 1.
[0121] The digital signal processor is used to process digital signals. In addition to processing digital image signals, it can also process other digital signals. For example, when the electronic device 100 selects a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.
[0122] Video codecs are used to compress or decompress digital video. Electronic device 100 may support one or more video codecs. This allows electronic device 100 to play or record videos in various encoding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, and MPEG4.
[0123] The NPU is a neural network (NN) computing processor. Drawing on the structure of biological neural networks, such as the transmission patterns between neurons in the human brain, it rapidly processes input information and can continuously self-learn. The NPU can enable intelligent cognitive applications in electronic device 100, such as image recognition, face recognition, speech recognition, and text comprehension.
[0124] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 via the external memory interface 120 to implement data storage functions. For example, files such as music and videos can be stored on the external memory card.
[0125] The internal memory 121 can be used to store computer executable program codes, which include instructions. The processor 110 executes various functional applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 121. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, applications required for at least one function (such as face recognition function, fingerprint recognition function, mobile payment function, etc.), etc. The data storage area may store data created during the use of the electronic device 100 (such as face information template data, fingerprint information template, etc.), etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.
[0126] The electronic device 100 can implement audio functions such as music playback and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.
[0127] The audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. The audio module 170 can also be used to encode and decode audio signals. In some embodiments, the audio module 170 can be provided in the processor 110, or some functional modules of the audio module 170 can be provided in the processor 110.
[0128] In the embodiment of the present application, the electronic device can play sound signals through a sound-generating device, wherein the sound-generating device can be a speaker 170A described below, or a receiver 170B described below, or an external device connected to the electronic device, such as headphones and glasses, etc., which is not limited here.
[0129] The speaker 170A, also called a "speaker", is used to convert audio electrical signals into sound signals. The electronic device 100 can listen to music or listen to hands-free calls through the speaker 170A.
[0130] The receiver 170B, also called a "handset", is used to convert audio electrical signals into sound signals. When the electronic device 100 receives a call or a voice message, the user can place the receiver 170B close to the ear to hear the voice.
[0131] Microphone 170C, also known as "microphone" or "microphone", is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can speak by putting their mouth close to the microphone 170C to input the sound signal into the microphone 170C. The electronic device 100 can be provided with at least one microphone 170C. In other embodiments, the electronic device 100 can be provided with two microphones 170C, which can not only collect sound signals but also realize noise reduction function. In other embodiments, the electronic device 100 can also be provided with three, four or more microphones 170C to collect sound signals, reduce noise, identify the source of sound, realize directional recording function, etc.
[0132] The headphone jack 170D is used to connect a wired headphone and can be the USB interface 130 or a 3.5mm open mobile terminal platform (OMTP) standard interface or a cellular telecommunications industry association of the USA (CTIA) standard interface.
[0133] Pressure sensor 180A is used to sense pressure signals and convert them into electrical signals. In some embodiments, pressure sensor 180A can be located on display screen 194. There are many types of pressure sensors 180A, such as resistive, inductive, and capacitive. A capacitive pressure sensor can include at least two parallel plates made of conductive material. When force acts on pressure sensor 180A, the capacitance between the electrodes changes. Electronic device 100 determines the intensity of the pressure based on this change in capacitance. When a touch operation is applied to display screen 194, electronic device 100 detects the touch intensity based on pressure sensor 180A. Electronic device 100 can also calculate the touch location based on the detection signal from pressure sensor 180A. In some embodiments, touch operations applied to the same touch location but with different touch intensities can correspond to different operation instructions. For example, when a touch operation with an intensity less than a first pressure threshold is applied to a short message application icon, a command to view short messages is executed. When a touch operation with an intensity greater than or equal to the first pressure threshold is applied to a short message application icon, a command to create a new short message is executed.
[0134] The gyroscope sensor 180B can be used to determine the motion posture of the electronic device 100. In some embodiments, the angular velocity of the electronic device 100 around three axes (i.e., x, y, and z axes) can be determined by the gyroscope sensor 180B. The gyroscope sensor 180B can be used for anti-shake shooting. For example, when the shutter is pressed, the gyroscope sensor 180B detects the angle of the electronic device 100 shaking, calculates the distance that the lens module needs to compensate based on the angle, and allows the lens to offset the shaking of the electronic device 100 through reverse movement to achieve anti-shake. The gyroscope sensor 180B can also be used for navigation and somatosensory game scenes.
[0135] The air pressure sensor 180C is used to measure air pressure. In some embodiments, the electronic device 100 calculates the altitude using the air pressure value measured by the air pressure sensor 180C to assist in positioning and navigation.
[0136] The magnetic sensor 180D includes a Hall sensor. The electronic device 100 can use the magnetic sensor 180D to detect the opening and closing of the flip case. In some embodiments, when the electronic device 100 is a flip phone, the electronic device 100 can detect the opening and closing of the flip cover based on the magnetic sensor 180D. Based on the detected opening and closing status of the case or flip cover, features such as automatic unlocking of the flip cover can be configured.
[0137] Accelerometer 180E can detect the magnitude of acceleration of electronic device 100 in all directions (generally three axes). It can also detect the magnitude and direction of gravity when electronic device 100 is stationary. It can also be used to identify the electronic device's posture, enabling applications such as switching between landscape and portrait modes and pedometers.
[0138] The distance sensor 180F is used to measure distance. The electronic device 100 can measure distance using infrared or laser. In some embodiments, when shooting a scene, the electronic device 100 can use the distance sensor 180F to measure distance to achieve fast focusing.
[0139] The proximity light sensor 180G may include, for example, a light emitting diode (LED) and a light detector, such as a photodiode. The light emitting diode may be an infrared light emitting diode. The electronic device 100 emits infrared light outward through the light emitting diode. The electronic device 100 uses a photodiode to detect infrared reflected light from nearby objects. When sufficient reflected light is detected, it can be determined that there is an object near the electronic device 100. When insufficient reflected light is detected, the electronic device 100 can determine that there is no object near the electronic device 100. The electronic device 100 can use the proximity light sensor 180G to detect that the user is holding the electronic device 100 close to the ear to talk, so as to automatically turn off the screen to save power. The proximity light sensor 180G can also be used in leather case mode and pocket mode to automatically unlock and lock the screen.
[0140] Ambient light sensor 180L is used to sense ambient light brightness. Electronic device 100 can adaptively adjust the brightness of display screen 194 based on the perceived ambient light. Ambient light sensor 180L can also be used to automatically adjust white balance when taking photos. Ambient light sensor 180L can also work with proximity light sensor 180G to detect whether electronic device 100 is in a pocket to prevent accidental touches.
[0141] The fingerprint sensor 180H is used to collect fingerprints. The electronic device 100 can use the collected fingerprint characteristics to implement fingerprint unlocking, access application locks, fingerprint photography, fingerprint call answering, etc.
[0142] The temperature sensor 180J is used to detect temperature. In some embodiments, the electronic device 100 uses the temperature detected by the temperature sensor 180J to execute a temperature processing strategy. For example, when the temperature reported by the temperature sensor 180J exceeds a threshold, the electronic device 100 reduces the performance of the processor located near the temperature sensor 180J to reduce power consumption and implement thermal protection. In other embodiments, when the temperature is lower than another threshold, the electronic device 100 heats the battery 142 to prevent the electronic device 100 from shutting down abnormally due to low temperature. In other embodiments, when the temperature is lower than another threshold, the electronic device 100 boosts the output voltage of the battery 142 to prevent abnormal shutdown due to low temperature.
[0143] The touch sensor 180K is also called a "touch panel." The touch sensor 180K can be disposed on the display screen 194. The touch sensor 180K and the display screen 194 form a touch screen, also called a "touch screen." The touch sensor 180K is used to detect touch operations applied thereto or in the vicinity thereof. The touch sensor can transmit the detected touch operations to the application processor to determine the type of touch event. Visual output related to the touch operations can be provided via the display screen 194. In other embodiments, the touch sensor 180K can also be disposed on the surface of the electronic device 100, in a location different from that of the display screen 194.
[0144] The buttons 190 include a power button, a volume button, and the like. The buttons 190 may be mechanical buttons or touch buttons. The electronic device 100 may receive key inputs and generate key signal inputs related to user settings and function control of the electronic device 100.
[0145] Motor 191 can generate vibration prompts. Motor 191 can be used for incoming call vibration prompts, and can also be used for touch vibration feedback. For example, touch operations acting on different applications (such as taking pictures, audio playback, etc.) can correspond to different vibration feedback effects. For touch operations acting on different areas of the display screen 194, motor 191 can also correspond to different vibration feedback effects. Different application scenarios (for example: time reminders, receiving messages, alarm clocks, games, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect can also support customization.
[0146] The indicator 192 may be an indicator light, which may be used to indicate charging status, power level changes, synthesis requests, missed calls, notifications, and the like.
[0147] The SIM card interface 195 is used to connect a SIM card. The SIM card can be connected to and disconnected from the electronic device 100 by inserting it into or removing it from the SIM card interface 195. The electronic device 100 can support 1 or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface 195 can support Nano SIM cards, Micro SIM cards, SIM cards, and the like. Multiple cards can be inserted into the same SIM card interface 195 at the same time. The types of the multiple cards can be the same or different. The SIM card interface 195 can also be compatible with different types of SIM cards. The SIM card interface 195 can also be compatible with external memory cards. The electronic device 100 interacts with the network through the SIM card to implement functions such as calls and data communications.
[0148] In the embodiment of the present application, the electronic device 100 can execute the CPU frequency processing method provided in the embodiment of the present application through the processor 110.
[0149] The CPU frequency processing method provided by the embodiment of the present application is exemplarily described below. Referring to FIG. 2 , the CPU frequency processing method provided by the embodiment of the present application includes but is not limited to the following steps.
[0150] S201: Electronic device identification task scenario.
[0151] Exemplarily, the electronic device can be, for example, any of the electronic devices described above. In a specific implementation, the task scenarios may include cold start, hot start, sliding, clicking, screen rotation, answering calls, answering voice calls, answering video calls, navigation, taking pictures, recording videos, video playback, audio playback, downloading, background installation, garbage cleaning, file transfer and other task scenarios. Among them, the task scenarios such as downloading, background installation, garbage cleaning, file transfer are task scenarios that are not recognizable or not obvious to the user. It will be understood that the task scenarios in the electronic device are merely examples and do not constitute a limitation to the embodiments of the present application. In a specific implementation, other more task scenarios may also be included, which are not described one by one here.
[0152] For example, the above task scenes can be run in the foreground or in the background. These task scenes can also realize the mutual switching between the foreground and background operations.
[0153] In a specific implementation, the electronic device can identify the specific task scenario type being run by collecting input event information and / or information related to the four major components.
[0154] Exemplarily, the input event may include an input event for starting any of the above-mentioned task scenarios. For example, taking video playback as an example, the input event may be an input event for clicking a video playback control, and the like.
[0155] For example, the four major components mentioned above include activity components, service components, broadcast receiver components, and content provider components. Among them, the activity component is a window (or user interface) in the application used to display functions, and the program flow runs in the activity component. The service component is used to complete user-specified operations in the background and does not provide user interface presentation. The broadcast receiver component is a communication mechanism for transmitting information between programs, and its function is to receive or send notifications. The content provider component prepares a content window for all applications and retains databases and files.
[0156] Based on the above description, it can be known that the electronic device can identify the type of the corresponding task scenario by collecting the corresponding input event information and the relevant information of the four major components. For example, taking video playback as an example, the electronic device collects the input event of clicking the video playback control, and learns based on the activity component that the user interface is playing a video, based on the service component that the video playback service is being provided, based on the broadcast receiver component that the video data is being transmitted, and based on the content provider component that the video file is being saved and other related information. Thus, the electronic device can determine that the current task scenario is a video playback scenario. Optionally, the electronic device can determine the specific task type based on any one or more of the input event information, activity component related information, service component related information, broadcast receiver component related information and content provider component related information. The specific implementation is set according to actual needs, and the embodiments of the present application do not limit this. The determination of other task scenario types can refer to the description here and will not be repeated here.
[0157] In one possible implementation, if multiple task scenarios are running in an electronic device, the electronic device can identify the multiple task scenarios separately. For example, if the electronic device is playing a video in the user interface and also running a download task in the background, the electronic device can separately identify the video playback task scenario and the background download task scenario by collecting input event information and / or information related to the four major components.
[0158] S202: The electronic device obtains corresponding scene feature information based on the identified task scene, and obtains preset quality of service (QoS) specification information.
[0159] In a specific implementation, after the electronic device identifies the running task scene, it can collect scene feature information corresponding to the task scene. For example, the scene feature information may include group information to which the task scene belongs and load information of the task scene.
[0160] Exemplarily, the groups to which the task scenarios belong may include the top-app group, the foreground group, the background group, and the system-background group. The system-background group can also be called the root group. The top-app group is the highest priority for completion, followed by the foreground group, and then the background and system-background groups. The background group has the same priority as the system-background group, but the system-background group can usually access more cores. In addition, the tasks included in the top-app group and the foreground group are all tasks running in the foreground. The tasks included in the top-app group are mainly tasks that can realize human-computer interaction (for example, including video playback, sliding, clicking, screen rotation, etc.), while the tasks included in the foreground group are mainly information notification or reminder tasks (for example, including weather notifications, time notifications or message notification bars, etc.). Therefore, the priority of the top-app group is higher than that of the foreground group.
[0161] It is to be understood that the grouping herein is merely an example and does not constitute a restriction to the embodiments of the present application. In a specific implementation, the task scenario can also be grouped in other ways, and the quantity of the grouping is not limited. For ease of description, the follow-up grouping to which the task scenario belongs includes the aforementioned four groupings as an example for introduction.
[0162] For example, in a specific implementation, each task scenario has a clear group at a certain moment. It is understandable that in one possible implementation, if a task scenario can switch between foreground and background operation, the task scenario does not always belong to the same group. For example, when the task scenario is running in the foreground, the group to which the task scenario belongs is the top-app group or the foreground group. When the task scenario is running in the background, the group to which the task scenario belongs is the background group.
[0163] Exemplarily, the group information to which the task scenario belongs can be grouped and managed (including switching of the groups to which the task scenario belongs) through the application management system (AMS). Specifically, the grouping and management of tasks can be implemented through the oomAdjuster process in the AMS. Therefore, the electronic device can obtain the group information to which a specific task scenario belongs through the AMS. Exemplarily, each task scenario has a corresponding identifier. In the AMS, the identifier of the task scenario is associated with the group to which the task scenario belongs. Therefore, after the electronic device identifies the running task scenario, it can find the group information to which the task scenario belongs in the AMS based on the identifier of the task scenario.
[0164] For example, based on the introduction of the previous terms, it can be seen that tasks are executed through threads, so the load of the task scenario is the load of the thread. The thread load calculation method is calculated by the running time of the thread and the corresponding clock cycle. The thread load determines the size of a task. The size of the task represents the computing power value occupied on the corresponding central processing unit (CPU), which shows the load pressure brought to the CPU. For example, in a specific implementation, the electronic device can obtain the load information of the task scenario in the task load calculation module of the kernel layer. Please refer to the introduction of Figure 6 below.
[0165] Exemplarily, the above-mentioned electronic device can also obtain preset QoS specification information, which may include specification information such as frame rate, response delay and power consumption. For example, the QoS specification is defined based on human factors indicators. The frame rate specification may include, for example, the frame rate requirement of the user interface sliding process. The frame rate and refresh rate are strongly bound. The response delay specification includes, for example, the response delay requirement of the user click. The power consumption includes, for example, the power consumption requirement of the chip system (system on chip, SoC). It can be understood that this is only an example and does not constitute a limitation to the embodiments of the present application.
[0166] The QoS specification information can be pre-set, so the electronic device can obtain the QoS specification information in a preset storage space. The embodiment of the present application does not limit the specific value of the preset QoS specification and the storage location. For example, the QoS specification is a reflection of the performance of the electronic device. No matter what task scenario is running in the electronic device, it is required to meet the preset QoS specification as a goal. For example, the preset QoS specification can be adjusted according to actual application requirements, and the embodiment of the present application does not limit this.
[0167] S203: The electronic device calculates the CPU load based on the acquired scene feature information and QoS specification information, and implements frequency modulation based on the calculated CPU load.
[0168] In a specific implementation, there is a corresponding relationship between the CPU load and the CPU operating frequency. The greater the CPU load, the higher the CPU operating frequency. Conversely, the smaller the CPU load, the lower the CPU operating frequency. For example, the corresponding relationship between the CPU load and the CPU operating frequency can be represented by a mapping table. The specific correspondence can be set according to the actual application, and the embodiment of the present application does not limit this. The electronic device will regularly calculate the CPU load, and then implement CPU frequency modulation according to the corresponding relationship between the CPU load and the CPU operating frequency.
[0169] For example, the electronic device can calculate the task load in a frequency modulation window corresponding to the CPU as the CPU load, and then perform frequency modulation based on the CPU load. For example, the frequency modulation window can be, for example, a time period of a preset duration. The preset duration can be set according to actual application and is not limited in this embodiment of the present application.
[0170] In an embodiment of the present application, in order to more reasonably optimize system performance and reduce power consumption, the CPU load can be calculated in combination with the group to which the above-mentioned task scenario belongs and the preset QoS specifications. For ease of understanding, please refer to Figure 3 for example. In Figure 3, it is assumed that the electronic device calculates the CPU load based on the acquired scene feature information and QoS specification information through the load decision module shown in the figure. The input of the load decision module is the group information to which the above-mentioned task scenario belongs and the load information of the task scenario, and then the CPU load is calculated and output with the goal of meeting the preset QoS specifications collected above.
[0171] For example, in a specific implementation, corresponding impact factors can be preset for different groups. The tasks in different groups can adjust the corresponding loads based on the impact factors to achieve subsequent frequency modulation. For ease of understanding, please refer to Table 1 for example.
[0172] Table 1
[0173] As shown in Table 1, the preset impact factor corresponding to the top-app group is a, the preset impact factor corresponding to the foreground group is b, the preset impact factor corresponding to the background group is c, and the preset impact factor corresponding to the root group is d. The values of a, b, c, and d are all greater than 0 and less than or equal to 1. Exemplarily, the impact factor corresponding to the group to which the tasks running in the background belong is smaller than the impact factor corresponding to the group to which the tasks running in the foreground belong. For example, the impact factor c corresponding to the background group is smaller than the impact factor a corresponding to the top-app group, and is also smaller than the impact factor b corresponding to the foreground group. For another example, the impact factor d corresponding to the root group is smaller than the impact factor a corresponding to the top-app group, and is also smaller than the impact factor b corresponding to the foreground group.
[0174] After the load decision module receives the group information and load information of the input task scenario, it obtains the corresponding preset influence factor according to the group to which the task scenario belongs, and then multiplies the influence factor by the load of the input task scenario to obtain the new load of the task scenario. This new load is used for subsequent frequency modulation, so it is simply referred to as frequency modulation load. If the scene feature information of multiple task scenarios is collected in a frequency modulation window, then one or more frequency modulation loads can be calculated for each task scenario. Then, the frequency modulation loads of the multiple task scenarios are added together to obtain the CPU load output.
[0175] Regarding the situation where multiple frequency modulation loads can be calculated for a task scenario, for example, if a task scenario is paused (i.e., the task is exited) after running for a period of time within the frequency modulation window, and then continues to run for a period of time after the pause, then a frequency modulation load for the task scenario can be calculated during the time period before the pause. A frequency modulation load for the task scenario can also be calculated during the time period after the pause and then the continued operation. For ease of understanding, the following example is illustrated in conjunction with Figure 4.
[0176] In Figure 4, assume that two tasks, Task 1 and Task 2, are running within a frequency modulation window. Task 1 belongs to the background group, and Task 2 belongs to the top-app group. Therefore, the collected scene feature information includes the scene feature information for Task 1 and Task 2. Specifically, within this frequency modulation window, Task 1 runs in time periods T1 and T3, with a pause between them. Task 2 runs in time period T2. Based on the previous description, task loads are calculated from the task's runtime and corresponding cycle information. Therefore, the load of Task 1 in time period T1 can be collected as Load 1, the load of Task 2 in time period T2 as Load 2, and the load of Task 1 in time period T3 as Load 3. Furthermore, information can be collected that Task 1 belongs to the background group and that Task 2 belongs to the top-app group. Based on Table 1, the impact factor corresponding to the background group is c, and the impact factor corresponding to the top-app group is a. Therefore, the formula for calculating the CPU load within the frequency modulation window can be obtained as follows: CPU load=c*load1+a*load2+c*load3.
[0177] After the CPU load is calculated, the calculated CPU load can be input into a CPU frequency governor for frequency adjustment to obtain an adjusted CPU operating frequency. Then, tasks in the electronic device are executed based on the adjusted CPU operating frequency.
[0178] It is understood that Figure 4 above mainly uses the background group and the top-app group as an example. In a specific implementation, other groups can be used. It is not limited to two groups, and can be three or four groups or more. The embodiments of this application do not impose any restrictions on this.
[0179] In addition, based on Figure 3 above, it can be seen that the CPU load output by the load decision module is to meet the preset QoS specifications collected above as a goal. Then, in the process of the electronic device running the task in the electronic device based on the above-adjusted CPU operating frequency, it can be detected in real time whether the preset QoS specifications are met. For example, whether the response delay in the process of detecting the task meets the response delay specified by the preset QoS specifications, and whether the power consumption in the process of detecting the task meets the power consumption specified by the preset QoS specifications. If the electronic device meets the preset QoS specifications in the process of running the task in the electronic device based on the above-adjusted CPU operating frequency, it indicates that the CPU load output by the load decision module meets the preset QoS specifications.
[0180] If the electronic device does not meet the preset QoS specifications when running tasks in the electronic device based on the above-adjusted CPU operating frequency, it is necessary to further adjust the above-mentioned preset impact factor and recalculate the CPU load until the preset QoS specifications are met. For example, failure to meet the preset QoS specifications includes one or more of the specification information such as frame rate, response delay and power consumption not meeting the requirements of the preset QoS specifications. For ease of understanding, the following example is provided.
[0181] For example, in the process of an electronic device running a task in the electronic device based on the above-adjusted CPU operating frequency, if the response delay specified by the preset QoS specification is met, but the actual power consumption exceeds the power consumption specified by the preset QoS specification, it indicates that the CPU operating frequency is adjusted too high, resulting in power consumption waste. In this case, the electronic device can feed back the detection result to the above-mentioned load decision module. After the load decision module learns that the CPU operating frequency is too high, it can adaptively lower the impact factor corresponding to the group to which the currently running task belongs. Then, the CPU load output is recalculated based on the lowered impact factor. Exemplarily, the scene feature information corresponding to the task scenario used to recalculate the CPU load this time can be, for example, the information obtained in the above-mentioned step S202; or, for example, it can be the scene feature information corresponding to the task scenario re-acquired by the electronic device based on the implementation process of the above-mentioned step S202. In the specific implementation, it can be selected according to actual needs, and the embodiments of the present application do not limit this.
[0182] After recalculating the CPU load output based on the lowered impact factor, the newly calculated CPU load can be input into the CPU frequency regulator for frequency adjustment to obtain an adjusted CPU operating frequency. Due to the lowered impact factor, the calculated CPU load is reduced, thereby lowering the re-adjusted CPU operating frequency. Tasks in the electronic device are then executed based on this lowered CPU operating frequency. The lowered CPU operating frequency saves power and reduces wasted energy.
[0183] Or, for example, in the process of an electronic device running a task in the electronic device based on the above-adjusted CPU operating frequency, if the power consumption requirement specified in the preset QoS specification is met, but the actual response delay exceeds the response delay specified in the preset QoS specification, it indicates that the CPU operating frequency is adjusted too low, resulting in failure to meet the service performance requirements. In this case, the electronic device can feed back the detection result to the above-mentioned load decision module. After the load decision module learns that the CPU operating frequency is too low, it can adaptively increase the impact factor corresponding to the group to which the currently running task belongs. Then, the CPU load output is recalculated based on the increased impact factor. Exemplarily, the scene feature information corresponding to the task scenario used to recalculate the CPU load this time can be, for example, the information obtained in the above-mentioned step S202; or, for example, it can be the scene feature information corresponding to the task scenario re-acquired by the electronic device based on the implementation process of the above-mentioned step S202. In the specific implementation, it can be selected according to actual needs, and the embodiments of the present application do not limit this.
[0184] After recalculating the CPU load output based on the increased impact factor, the newly calculated CPU load is input into the CPU frequency regulator for frequency adjustment to obtain the adjusted CPU operating frequency. Since the impact factor is increased, the calculated CPU load increases, thereby increasing the re-adjusted CPU operating frequency. Tasks in the electronic device are then executed based on this increased CPU operating frequency. Due to the increased CPU operating frequency, the response latency of the service can be increased to meet service performance requirements.
[0185] For example, the adjustment of the above-mentioned influencing factors can be achieved by stepping, or an adjustment amount can be randomly generated to achieve high and low adjustment, or it can be adjusted according to other preset high and low adjustment methods. The embodiments of the present application do not limit this.
[0186] For example, while the electronic device is running tasks based on the re-adjusted CPU operating frequency, it can still detect in real time whether the preset QoS specifications are met. If not, the impact factor is adjusted again according to the above method, and then a new CPU operating frequency is recalculated until the preset QoS specifications are met. If so, the device continues to run at the current CPU operating frequency until the frequency modulation result of the next frequency modulation window is output.
[0187] Based on the above introduction, it can be seen that the embodiments of the present application can achieve a balance between performance and power consumption, and can reduce power consumption waste as much as possible while meeting performance.
[0188] In another possible implementation, the above-mentioned impact factors may be associated with the task scenario itself in addition to being associated with the group to which the task scenario belongs. For example, see Table 2 for an example.
[0189] Table 2
[0190] In the above Table 2, the correspondence between the group to which the task scenario belongs and the impact factor corresponding to the task scenario is exemplified. The values of the impact factors are all greater than 0 and less than 1, and the values of the impact factors in Table 2 are not related to those in Table 1. Taking task scenario 1 as an example, if the group to which the task scenario 1 belongs is the top-app group, the impact factor of the task scenario 1 is a. If the group to which the task scenario 1 belongs is the foreground group, the impact factor of the task scenario 1 is d. If the group to which the task scenario 1 belongs is the background group, the impact factor of the task scenario 1 is g. If the group to which the task scenario 1 belongs is the root group, the impact factor of the task scenario 1 is z. The same applies to other task scenarios and will not be repeated.
[0191] In above-mentioned table 1, can see, same task scene, the grouping that task scene belongs to is different, and the influence factor corresponding to this task scene is just different.In addition, for same grouping, task scene is different, and corresponding influence factor also can be different.It is understandable that, in same grouping, the influence factor corresponding to different task scene some can be identical, and some can be different, and the embodiment of the application does not limit this.
[0192] Exemplarily, in a specific implementation, after the above-mentioned load decision module receives the group information and the load information of the task scene to which the input task scenario belongs, it obtains the corresponding preset influence factor according to the task scenario and the group to which the task scenario belongs, and then multiplies the influence factor with the load of the input task scenario to obtain the new load of the task scenario. Similarly, this new load is used for subsequent frequency modulation, and is therefore referred to as frequency modulation load. If the scene feature information of multiple task scenes is collected in a frequency modulation window, then each task scene can calculate one or more frequency modulation loads. Then, the frequency modulation loads of the multiple task scenes are added together to obtain the CPU load output. For ease of understanding, the following is still illustrated with reference to FIG4.
[0193] In Figure 4, based on the above introduction, it can be seen that the load of task 1 in time period T1 is load 1, the load of task 2 in time period T2 is load 2, and the load of task 1 in time period T3 is load 3. In addition, it is also possible to collect information that task 1 belongs to the background group and information that task 2 belongs to the top-app group. If task 1 is task scenario 1 in Table 2 above, and task 2 is task scenario 2 in Table 2 above. Based on Table 2 above, it can be seen that the impact factor corresponding to task 1 is g, and the impact factor corresponding to task 2 is b. Therefore, the formula for calculating the CPU load in the frequency modulation window can be obtained as follows: CPU load = g*load1+b*load2+g*load3.
[0194] After the CPU load is obtained through the above calculation, frequency adjustment can be performed based on the CPU load. Optionally, it is also possible to detect whether the operation after frequency adjustment meets the above-mentioned preset QoS specifications. Please refer to the above introduction for details and will not be repeated here. In this implementation method, different task scenarios in different groups correspond to their own influencing factors, so that a more fine-grained adjustment of the load can be achieved, and then a more fine-grained adjustment of the CPU operating frequency can be achieved, thereby better optimizing the performance and power consumption of electronic equipment.
[0195] In another possible implementation, the above-mentioned impact factor may not be associated with the group to which the task scenario belongs, and each task scenario corresponds to an impact factor separately. When calculating the CPU load, the load of the task is multiplied by the corresponding impact factor. It will be understood that this is merely an example and does not constitute a limitation to the embodiments of the present application.
[0196] In order to better understand the CPU frequency processing method provided in the above-mentioned embodiment of the present application, an exemplary introduction is given below in conjunction with Figures 5 and 6.
[0197] As shown in FIG5 , the electronic device may include a scene recognition module, a scene perception module, a load decision module and a frequency modulation module.
[0198] The scene recognition module is used to identify the task scenario described above, i.e., to determine the type of the specific task scenario being run. For example, the scene recognition module can be integrated into the system's APK to identify the specific type of task scenario being run by collecting input event information and / or information related to the four major components. For example, the scene recognition module can be used to perform the operations described in step S201 of the CPU frequency processing method shown in FIG3 .
[0199] The scenario perception module is used to obtain scenario feature information and preset QoS specification information of the above-mentioned task scenario. In other words, the scenario perception module can be used to determine the grouping of tasks. The scenario perception module can be used to perform the operation described in step S202 of the CPU frequency processing method shown in Figure 3 above.
[0200] The load decision module is used to calculate the CPU load. Its input is the group information and load information of the task scenario collected above. It then calculates and outputs the CPU load with the goal of meeting the collected preset QoS specifications. For example, this load decision module can be the load decision module described in step S203 of the CPU frequency processing method shown in FIG3 .
[0201] The frequency modulation module is used to adjust the frequency based on the CPU load output by the load decision module to obtain the latest CPU operating frequency. Exemplarily, the frequency modulation module can be implemented as the CPU frequency regulator. The specific frequency modulation method is not limited in the embodiment of the present application.
[0202] It can be understood that the module division shown in Figure 5 above is only an example. In a specific implementation, it can be divided into software and / or hardware modules of other different granularities, and the embodiments of the present application do not limit this.
[0203] For example, the modules shown in FIG5 can be implemented in conjunction with the software system of the electronic device. The software system of the electronic device can adopt a layered architecture, an event-driven architecture, a micro-kernel architecture, a microservice architecture, or a cloud architecture. The embodiment of the present application takes the Android system with a layered architecture as an example to illustrate the software structure of the electronic device.
[0204] The layered architecture divides the software into several layers, each with a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom: the application layer, the application framework layer, the Android runtime (Android runtime) and the system library, and the kernel layer. In the embodiments of the present application, the main layers involved include the application layer, the application framework layer, and the kernel layer. Therefore, the following mainly uses the interaction between these three layers as an example to further introduce. For example, see Figure 6.
[0205] As can be seen in Figure 6, the application layer can include the above-mentioned scene recognition module, input reader, and four major components. The input reader is used to collect input events. In a specific implementation, the scene recognition module can obtain input events from the input reader and can also obtain information related to the four major components from the four major components, thereby identifying the specific task scenario type being run. The specific implementation process can be referred to the corresponding description in the aforementioned step S201 and will not be repeated here.
[0206] It can also be seen in Figure 6 that the application framework layer may include the above-mentioned scene perception module, AMS and native process, etc. After the scene recognition module in the above-mentioned application layer identifies the running task scene, it can notify the scene perception module to obtain the scene feature information corresponding to the perceived task scene, and obtain the preset QoS specification information. Specifically, the scene perception module can obtain the grouping information to which the specific task scene belongs from the AMS. The load information of the specific task scene can also be obtained from the task load calculation module of the kernel layer through the native process. Exemplarily, for example, the task load information in the kernel layer task load calculation module can be collected through socket communication through a native daemon process. The specific implementation process can refer to the corresponding description in the aforementioned step S202, which will not be repeated here.
[0207] As can also be seen in Figure 6, the kernel layer may include a task load calculation module, a frequency modulation module, and the above-mentioned load decision module. After the scenario perception module in the above-mentioned application framework layer obtains the scenario feature information corresponding to the task scenario and the preset QoS specification information, it outputs it to the load decision module. The load decision module calculates the CPU load based on the scenario feature information corresponding to the task scenario and the preset QoS specification information. Then, the load decision module outputs the calculated CPU load to the frequency modulation module. The frequency modulation module performs frequency modulation based on the CPU load. The specific implementation process can be referred to the corresponding description in the aforementioned step S203, which will not be repeated here.
[0208] For example, see FIG6A , which shows a schematic diagram of the software architecture of the frequency modulation module. It can be seen that the frequency modulation module may include a CPU frequency core module (CPUFreq core), a CPU frequency status module (CPUFreq stats), a CPU frequency management module (CPUFreq Governor), a CPU frequency driver module (CPUFreq driver), and a frequency modulation operation function (clk / regulator), etc. The frequency modulation of the CPU is achieved through the cooperation of these modules and functions. The specific frequency modulation process is not limited in the embodiments of the present application. It is understood that the software architecture of the frequency modulation module shown in FIG6A is for illustration only and does not constitute a limitation on the embodiments of the present application.
[0209] In another possible implementation, while the electronic device is executing tasks based on the adjusted CPU operating frequency, the scenario awareness module in the application framework layer can also detect in real time whether the preset QoS specifications are met. If not, the load decision module is notified, instructing it to recalculate the CPU load. For specific implementation, please refer to the corresponding description in step S203 above and will not be repeated here.
[0210] To facilitate understanding of the process interaction between the scene recognition module, scene perception module and load decision module, please refer to Figure 7 for example. The specific implementation of each step shown in Figure 7 can refer to the above introduction and will not be repeated here.
[0211] It will be understood that the above-mentioned Figures 6 and 7 are merely examples and do not constitute a limitation to the embodiments of the present application.
[0212] Based on the above introduction, compared to the existing CPU load calculation method, the embodiment of the present application takes into account the impact of the group to which the task scenario belongs on the CPU load, and at the same time takes into account the impact of the CPU load on the Qos specification. In the process of calculating the CPU load, the group to which the task scenario belongs and the load of the collected task scenario are input, and the CPU load is comprehensively calculated with the goal of meeting the preset Qos specification requirements. The CPU operating frequency obtained by the CPU load frequency modulation based on the calculation can reduce power consumption as much as possible while meeting the task performance requirements, reducing power consumption waste. For ease of understanding, the following further introduction and explanation are provided.
[0213] The existing method of calculating the CPU load is to add the loads of the tasks running in a frequency modulation window of the electronic device, that is, the sum of the loads of the tasks running in the frequency modulation window is the CPU load. In the embodiment of the present application, the CPU load is calculated in combination with the impact factor corresponding to the group to which the task belongs. For example, please refer to the calculation process of the CPU load in the aforementioned description of Figure 4. In the embodiment of the present application, considering that the requirements of the tasks running in the background for performance such as response delay are lower than those of the tasks running in the foreground, the impact factor corresponding to the group to which the tasks running in the background belong is smaller than the impact factor corresponding to the group to which the tasks running in the foreground belong. The CPU load calculated in the mixed task scenario including foreground running tasks and background running tasks is reduced, thereby reducing the frequency modulation frequency obtained based on the CPU load, thereby reducing the operating power consumption. For example, please refer to Figure 8 to intuitively see the difference between the existing CPU load calculation results and the CPU load calculation results of the embodiment of the present application.
[0214] In Figure 8, the tasks running in a frequency modulation window are divided into two categories: tasks running in the foreground and tasks running in the background. Assume that the tasks running in the foreground belong to the same group, for example, they all belong to the above-mentioned top-app group or foreground group. Below, we take the top-app group as an example. Assume that the tasks running in the background also belong to the same group, for example, they belong to the background group or root group. Below, we take the background group as an example. Then, the existing CPU load calculation method is as follows: CPU load_1 = load of tasks running in the foreground + load of tasks running in the background, (1).
[0215] It is understandable that the load of the task running in the foreground and the load of the task running in the background may be, for example, the load of the task scenario collected in the manner described in S202 above.
[0216] The CPU load calculation method of the embodiment of the present application is as follows: CPU load_1=a*load of the task running in the foreground+c*load of the task running in the background, (2).
[0217] Here, a is the impact factor corresponding to the top-app group shown in Table 1 above, and c is the impact factor corresponding to the background group shown in Table 1 above.
[0218] Based on the above formulas (1) and (2), assuming that the load of the task running in the foreground is fixed, the load of the task running in the background is a variable (represented by the horizontal axis), and the calculated CPU load is the dependent variable (represented by the vertical axis), the two CPU load change relationship lines shown in Figure 8 can be obtained. In Figure 8, line ① is the relationship line drawn based on formula (1), which represents the existing CPU load change. Among them, point A represents the fixed foreground task load, or in other words, it represents the CPU load calculated when there is no load of the task running in the background in the existing solution. Line ② is the relationship line drawn based on formula (2), which represents the CPU load change in the embodiment of the present application. Among them, point B represents the load after the fixed foreground task load is multiplied by the influence factor a, and also represents the CPU load calculated when there is no load of the task running in the background in the embodiment of the present application. If a=1, then point A and point B coincide. As can be seen in Figure 8, as the load of the task running in the background increases, the CPU load calculated by the two calculation methods also increases. However, in the embodiment of the present application, due to the consideration of task grouping and the existence of the impact factor c corresponding to the background group, the calculated CPU load is smaller than the CPU load calculated by the existing solution. As a result, the frequency modulation frequency obtained based on the smaller CPU load is reduced, thereby reducing operating power consumption.
[0219] It is understood that FIG8 is primarily drawn based on the grouping and impact factors shown in Table 1. In a specific implementation, corresponding relationship lines can also be drawn based on the relationships in Table 2, which will not be described in detail here. Furthermore, the transformation relationship curve shown in FIG8 is merely a schematic curve, primarily reflecting the relationship between the CPU load calculated in the existing solution and the CPU load calculated in the embodiment of the present application, and does not constitute a limitation on the embodiment of the present application.
[0220] Based on the above description, it can be seen that in the embodiment of the present application, if the task running in the foreground of the electronic device is switched to the background, the CPU load calculated above will be reduced, thereby reducing the operating frequency of the CPU. For ease of understanding, please refer to Figure 9 for example.
[0221] In Figure 9, it is assumed that the electronic device is running N tasks in the foreground in the frequency modulation window 1, where N is an integer greater than 1. Based on the previous introduction to the terms, it can be seen that the task running in the foreground can see the user interface corresponding to the task on the display screen of the electronic device. Exemplarily, the electronic device can display the user interfaces of the N tasks on the display screen in a split-screen manner, for example, see Figure 10. Figure 10 takes N=2 as an example. As can be seen in Figure 10, the split-screen boundary divides the display screen into two parts, one part is used to display the user interface of the first task, and the other part is used to display the user interface of the second task.
[0222] For example, in another possible implementation, the electronic device can display the user interfaces of the N tasks on the display screen by means of a floating small window, as shown in Figure 11. Figure 11 takes N=2 as an example. As can be seen in Figure 11, the display screen can be used to display the user interface of the first task. Then, a small floating window that can be dragged and moved can be activated to display the user interface of the second task in the small window.
[0223] For example, in another possible implementation, an example of displaying the user interfaces of the above-mentioned N tasks in the form of small windows can also be seen in Figure 12. In Figure 12, the display screen can be used to display the system default main interface (the main interface mainly includes icons of various applications, etc.). Then, one or more floating small windows can be started on the main interface, and each small window can be used to display the user interface of a task. For example, in Figure 12, two small windows can be started on the main interface, one for displaying the user interface of the first task, and the other for displaying the user interface of the second task.
[0224] For example, the user interfaces shown in Figures 10 and 11 may be displayed on electronic devices such as mobile phones. The user interface shown in Figure 12 may be displayed on large-screen electronic devices such as tablet computers or desktop computers. It should be understood that Figures 10 to 12 are merely illustrative and do not constitute limitations on the embodiments of the present application.
[0225] In Figure 9, the electronic device runs N tasks in the foreground during frequency modulation window 1. At frequency modulation time 1, frequency modulation begins based on the task load, task grouping, and pre-set QoS specifications within frequency modulation window 1. The detailed implementation process can be found in the description related to Figure 2 above and will not be repeated here. Assume that the CPU frequency remains unchanged at f1 after this frequency modulation. The electronic device then continues to run the N tasks at the CPU frequency of f1 during frequency modulation window 2.
[0226] In the frequency modulation window 2, M tasks out of the N tasks are switched to background operation, where M is an integer greater than 0 and less than N. Exemplarily, there are many ways to switch tasks to background operation. For example, in the scenario shown in Figure 10, the split screen boundary line can be pulled down to cancel the split screen so that the second task is switched to background operation. Alternatively, the split screen boundary line can be pulled down to cancel the split screen so that the first task is switched to background operation. For another example, in the scenario shown in Figure 11 or Figure 12, the minimize control (not shown in the figure) in the upper right corner of the small window can be clicked to switch the task corresponding to the user interface displayed in the small window to background operation. It can be understood that this is only an example, and other operations can also be used to switch the foreground running task to background operation, and the embodiments of the present application do not limit this.
[0227] After M of the N tasks are switched to background execution, the electronic device now has NM tasks running in the foreground and M tasks running in the background. At frequency modulation time 2, the electronic device begins frequency modulation based on the task load, task grouping, and preset QoS specifications within frequency modulation window 2. During this frequency modulation, although the electronic device still runs the N tasks, because M of the N tasks are switched to background execution, the grouping of these M tasks changes from top-app or foreground to background. Therefore, when calculating the CPU load within frequency modulation window 2, the impact factors of these M tasks change. Using Table 1 as an example, the impact factor changes from a or b to c. Since c is less than a (or less than b), the calculated CPU load decreases, and the CPU frequency obtained by frequency modulation decreases. Therefore, as shown in Figure 9, the CPU frequency decreases within frequency modulation window 3. For example, within frequency modulation window 3, the electronic device continues to run the M tasks in the background and the NM tasks in the foreground. Or, illustratively, in the frequency modulation window 3, the electronic device can run other tasks, and the embodiment of the present application does not limit this.
[0228] In another possible implementation, the frequency modulation starting at frequency modulation time 2 also needs to meet preset QoS specifications. Therefore, the CPU operating frequency can be gradually reduced through multiple frequency modulations so that the preset QoS specifications can be met, that is, a balance between performance and power consumption can be achieved. The specific implementation can be referred to the above description and will not be repeated here. Based on this, the CPU frequency obtained by the frequency modulation starting at frequency modulation time 2 is gradually reduced until it reaches a stable frequency value f2. That is, when the electronic device operates at this CPU frequency f2, it can meet the preset QoS specifications and achieve a balance between performance and power consumption.
[0229] In another possible implementation, for example, see Figure 13 for example. For the frequency modulation started at the frequency modulation moment 2, if the CPU frequency obtained is too low, for example, the CPU frequency obtained is the frequency value f3 shown in Figure 13. After the electronic device runs the task at the frequency value f3, it detects that the preset Qos specification requirements are not met. Then, the CPU operating frequency can be slowly increased through multiple frequency modulations so that the preset Qos specifications can be met, that is, a balance between performance and power consumption. Therefore, after one or more re-frequency modulations, the CPU frequency obtained by the frequency modulation starting at the frequency modulation moment 2 gradually increases until it approaches a stable frequency value f2. That is, when the electronic device runs at f2 as the CPU frequency, it can meet the above-mentioned preset Qos specifications and achieve a balance between performance and power consumption.
[0230] In another possible implementation, the CPU frequency may fluctuate during the process of achieving one or more frequency adjustments starting at frequency modulation time 2 to meet preset QoS specifications, so that the final frequency approaches a stable frequency value f2. For example, in FIG9 , the process of the CPU frequency decreasing from frequency value f1 to frequency value f2 may be an oscillating decrease. For another example, in FIG13 , the process of the CPU frequency increasing from frequency value f3 to frequency value f2 may be an oscillating increase.
[0231] It will be understood that what is shown in FIG9 and FIG13 and their possible implementations are merely illustrative and do not constitute a limitation to the embodiments of the present application.
[0232] An embodiment of the present application also provides an electronic device, which includes one or more processors and one or more memories; wherein the one or more memories are coupled to the one or more processors, and the one or more memories are used to store computer program code, and the computer program code includes computer instructions. When the one or more processors execute the computer instructions, the electronic device executes the method described in the above embodiment.
[0233] An embodiment of the present application also provides a chip system, which is applied to an electronic device. The chip system includes one or more processors, which are used to call computer instructions to enable the electronic device to execute the method described in the above embodiment.
[0234] The embodiments of the present application also provide a computer program product containing instructions. When the computer program product is run on an electronic device, the electronic device executes the method described in the above embodiments.
[0235] An embodiment of the present application further provides a computer-readable storage medium, comprising instructions, which, when executed on an electronic device, enable the electronic device to execute the method described in the above embodiment.
[0236] It is understandable that the various embodiments of the present application can be combined arbitrarily to achieve different technical effects.
[0237] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware, or any combination thereof. When implemented using software, all or part of the embodiments may be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described herein are generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated therein. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a magnetic tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive).
[0238] Those skilled in the art will appreciate that all or part of the process steps in the above-described method embodiments can be implemented by a computer program instructing the relevant hardware. The program can be stored in a computer-readable storage medium, and when executed, the program can include the process steps in the above-described method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as ROM or random access memory (RAM), magnetic disks, or optical disks.
[0239] In short, the above description is only an embodiment of the technical solution of this application and is not intended to limit the scope of protection of this application. Any modifications, equivalent replacements, improvements, etc. made based on the disclosure of this application should be included in the scope of protection of this application.
Claims
1. A CPU frequency processing method, characterized in that: The method comprises: When the electronic device runs N tasks in the foreground, it runs at the first CPU frequency; N is an integer greater than 1; The electronic device switches M tasks out of the N tasks to background operation; M is an integer greater than 0 and less than N; In a mixed task running scenario where the electronic device runs the M tasks in the background and NM tasks in the foreground, the electronic device runs at a second CPU frequency; the second CPU frequency is lower than the first CPU frequency.
2. The method according to claim 1, characterized in that In the mixed task running scenario where the M tasks are run in the background and NM tasks are run in the foreground, the method further includes: The electronic device obtains first grouping information of each of the N tasks and a first load of each task; the NM tasks belong to the first group, the M tasks belong to the second group, the tasks included in the first group are tasks running in the foreground, and the tasks included in the second group are tasks running in the background; The electronic device calculates the CPU load based on the first grouping information of each task and the first load of each task to obtain a first CPU load; The electronic device determines the second CPU frequency based on the first CPU load.
3. The method according to claim 2, characterized in that The electronic device calculates the CPU load based on the first grouping information of each task in the N tasks and the first load of each task to obtain the first CPU load, including: The electronic device obtains the load impact factor of each task based on the first grouping information of each task; each group corresponds to a load impact factor, and each task corresponds to the load impact factor of the group to which it belongs; The electronic device calculates the first CPU load based on the load influence factor of each task and the first load of each task.
4. The method according to any one of claims 1 to 3, characterized in that: The electronic device, in a mixed task running scenario in which the M tasks are run in the background and NM tasks are run in the foreground, runs at the second CPU frequency, further comprising: The electronic device obtains its own first response delay and / or first power consumption; If the first response delay and / or the first power consumption does not meet the requirement of a preset quality of service QoS specification, the electronic device re-determines the CPU frequency to obtain a third CPU frequency.
5. The method according to claim 4, characterized in that The electronic device re-determines the CPU frequency to obtain a third CPU frequency, including: The electronic device obtains second grouping information of each of the N tasks and a second load of each task; the NM tasks belong to a first group, the M tasks belong to a second group, the tasks included in the first group are tasks running in the foreground, and the tasks included in the second group are tasks running in the background; each group corresponds to a load impact factor, and each of the N tasks corresponds to the load impact factor of the group to which it belongs; The electronic device adjusts the load impact factor corresponding to the first group and / or the second group; The electronic device obtains the adjusted load of each task based on the second grouping information of each task Impact factor; The electronic device calculates the CPU load based on the load influence factor of each task obtained after the adjustment and the second load of each task to obtain the second CPU load; The electronic device determines the third CPU frequency based on the second CPU load.
6. The method according to claim 5, characterized in that If the first response delay is greater than the response delay required by the QoS specification, the electronic device specifically performs the following operations: The electronic device increases the load impact factor corresponding to the first group and / or the second group; The electronic device obtains the load influence factor of each task after the increase based on the second grouping information of each task; The electronic device calculates the second CPU load based on the increased load impact factor of each task and the second load of each task; The electronic device determines the third CPU frequency based on the second CPU load; the third CPU frequency is greater than the second CPU frequency and less than the first CPU frequency.
7. The method according to claim 5, characterized in that If the first power consumption is greater than the power consumption required by the QoS specification, the electronic device specifically performs the following operations: The electronic device adjusts the load impact factor corresponding to the first group and / or the second group to be lowered; The electronic device obtains the load impact factor of each task after being lowered based on the second grouping information of each task; The electronic device calculates the second CPU load based on the load impact factor of each task after the adjustment and the second load of each task; The electronic device determines the third CPU frequency based on the second CPU load; the third CPU frequency is less than the second CPU frequency.
8. The method according to claim 7, characterized in that When the first power consumption is greater than the power consumption required by the QoS specification and the first response delay meets the response delay required by the QoS specification, the electronic device lowers the load impact factor corresponding to the first group and / or the second group.
9. The method according to any one of claims 2, 3, 5-8, characterized in that: The load impact factor corresponding to the second group is smaller than the load impact factor corresponding to the first group.
10. The method according to any one of claims 1 to 9, characterized in that: The electronic device runs N tasks in the foreground, including: The electronic device displays the user interfaces of the N tasks on a display screen by way of split screen or floating windows.
11. An electronic device, characterized in that: include: A touch screen, one or more processors, and one or more memories; the one or more processors are coupled to the touch screen and the one or more memories; the one or more memories are used to store computer program codes, the computer program codes include computer instructions, and when the one or more processors execute the computer instructions, the electronic device executes the method as described in any one of claims 1-10.
12. A chip system, characterized in that: The chip system is applied to an electronic device, and the chip system includes one or more processors, and the processor is used to call computer instructions so that the electronic device executes the method as described in any one of claims 1-10.
13. A computer-readable storage medium comprising instructions, characterized in that: When the instructions are executed on an electronic device, the electronic device is caused to execute the method as claimed in any one of claims 1 to 10.
14. A computer program product comprising instructions, characterized in that When the computer program product is executed on an electronic device, the electronic device is enabled to execute the method according to any one of claims 1 to 10.