A load control method and electronic equipment
By adopting intermittent operation mode in electronic devices, the execution time slots of tasks are divided to avoid sudden load increase, which solves the problem of high load and increased power consumption of the CPU during multi-task execution, and achieves a stable reduction in load and power consumption.
Patent Information
- Application Number
- CN202410935223.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-12
- Publication Date
- 2025-03-14
- Estimated Expiration
- 2044-07-12
AI Technical Summary
When electronic devices perform multitasking, they can easily lead to high load on the central processing unit (CPU), causing a sudden increase in succession.
The first task is run in an intermittent operation mode, and the expected operation cycle of the task is divided into multiple execution slots, including the running sub-period and the idle sub-period, avoiding the sudden increase in load.
It effectively avoids the sudden increase in the load, frequency and power consumption of electronic equipment caused by performing new tasks, and reduces the load, frequency and power consumption generated by electronic equipment when performing multiple tasks.
Smart Images

Figure CN118656193B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the technical field of electronic equipment, and in particular to a load control method and electronic equipment. Background Art
[0002] Due to the limited chip capacity and memory of electronic devices, when electronic devices perform multiple tasks, it is very easy to cause a high load on the central processing unit (CPU). For example, when an electronic device is executing task A, task B starts to execute after the start conditions are met. The execution of task B will cause the CPU load to rise sharply, the CPU frequency to increase, and the power consumption of the electronic device to increase suddenly. Summary of the invention
[0003] The embodiments of the present application provide a load control method and an electronic device, which runs a first task in an intermittent operation mode, thereby avoiding a sudden increase in load caused by the running of the first task, and to a certain extent avoiding a sudden increase in the load, frequency and power consumption of the electronic device caused by the execution of a new task, thereby reducing the load, frequency and power consumption generated when the electronic device executes multiple tasks.
[0004] In order to achieve the above-mentioned purpose, the embodiments of the present application adopt the following technical solutions.
[0005] In a first aspect, a load control method is provided, the method comprising:
[0006] The electronic device determines that there is a first task that meets the start condition, and when the first task meets the load control condition, the electronic device runs the first task according to multiple execution time slots of the first task.
[0007] Among them, satisfying the load control condition includes that a first load corresponding to the first task is greater than a first threshold, and the first load represents a system load corresponding to when the electronic device normally performs the first task.
[0008] Among them, the first task corresponds to an expected operating cycle, the expected operating cycle includes an operating period and an idle period, the operating period includes multiple operating sub-periods, the idle period includes the same number of idle sub-periods as the operating sub-periods, and each operating sub-period and an idle sub-period constitute an execution time slot.
[0009] In the present application, after the electronic device determines that there is a first task that meets the start-up conditions, when the first task meets the load control conditions, the electronic device runs the first task according to multiple execution time slots of the first task, so as to run the first task in an intermittent operation mode. Running the first task in an intermittent operation mode can avoid the sudden increase in load caused by the operation of the first task, and to a certain extent can avoid the sudden increase in the load, frequency and power consumption of the electronic device caused by the execution of a new task, and reduce the load, frequency and power consumption generated when the electronic device executes multiple tasks.
[0010] In a possible implementation manner of the first aspect, satisfying the load control condition also includes that a superimposed load of the second load and the first load is greater than the third load.
[0011] The second load is the system load of the electronic device in the current operating environment, and the current operating environment includes one or more tasks running. The third load is the load corresponding to the frequency point of the next level of the frequency point corresponding to the second load, and the next level of the frequency point is higher than the frequency point corresponding to the second load.
[0012] In this application, if the superimposed load is greater than or equal to the third load, it means that the load superposition of the first task will cause the CPU frequency to increase, and the electronic device needs to increase the CPU frequency so that the CPU can perform the first task with stronger processing power. The increase in CPU frequency will increase the power consumption of the electronic device. In this case, the electronic device can run the first task in an intermittent operation mode to achieve load control of the superimposed load.
[0013] In another possible implementation manner of the first aspect, satisfying the load control condition also includes the first task being a non-emergency task.
[0014] In the present application, the first task is a non-urgent task, and running the first task in an intermittent operation mode will not affect the operation of the first task, which can further ensure that the operation of the first task will not cause resource preemption of the foreground task.
[0015] In another possible implementation manner of the first aspect, when the first task that meets the start condition includes multiple tasks, the first task is the task with the smallest load among the multiple tasks.
[0016] In the present application, the task with the smallest load is run first, which can further ensure the load control of the superimposed load when running the first task, so that the electronic device will not cause a sudden increase in load, frequency, and power consumption when running the first task as much as possible.
[0017] In another possible implementation manner of the first aspect, when the first task that meets the start condition includes multiple tasks, the first task includes at least one task whose sum of the corresponding first loads and the superimposed load of the second load is less than the third load.
[0018] The second load is the system load of the electronic device in the current operating environment, and the current operating environment includes one or more tasks running. The third load is the load corresponding to the frequency point of the next level of the frequency point corresponding to the second load, and the next level of the frequency point is higher than the frequency point corresponding to the second load.
[0019] In the present application, a task with a superimposed load smaller than the third load is selected from multiple tasks, and the task with the smaller superimposed load is run preferentially, which can further ensure the load control of the superimposed load when running the first task, so that the electronic device will not cause a sudden increase in load, frequency, and power consumption when running the first task as much as possible.
[0020] In another possible implementation manner of the first aspect, before the electronic device executes the first task according to the multiple execution time slots of the first task, the method further includes:
[0021] The electronic device divides the expected operation cycle of the first task into a plurality of execution time slots according to a preset load compression ratio.
[0022] Then, the electronic device runs the first task according to the multiple execution time slots of the first task, including: the electronic device schedules the first task to run in the running sub-period, and controls the first task to suspend running in the idle sub-period.
[0023] In the present application, the first task is run according to the execution time slot of the first task, that is, the first task is run in an intermittent operation mode. Since the duration of the operation sub-period in the execution time slot is short, after running the first task for a short time, it enters the idle sub-period of the execution time slot. The electronic device can release resources, and will not occupy a large number of system resources and system services of the electronic device. The load of the electronic device executing the first task will not increase suddenly. Even if the load is generated because the electronic device executes the first task, the load generated by the short-term execution of the first task in the operation sub-period is relatively small, achieving the purpose of load control for executing the first task.
[0024] In another possible implementation manner of the first aspect, the method further includes:
[0025] When the electronic device is determined to be in a preset operating environment, it is determined whether there is a first task that meets the start condition.
[0026] The system load under the preset operating environment is greater than a third threshold.
[0027] In this application, the preset operating environment is generally a typical operating environment set based on experience. The load corresponding to these preset operating environments is relatively high, and it is necessary to try to avoid the effects of increased load, increased frequency, and increased power consumption caused by other temporarily executed tasks (such as the first task). Therefore, when the electronic device is determined to be in the preset operating environment, load control of the first task can more effectively ensure the load control effect of the operating environment.
[0028] In a second aspect, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of any one of the methods described in the first aspect.
[0029] In a third aspect, a computer-readable storage medium is provided, wherein instructions are stored in the computer-readable storage medium, and when the computer program / instructions are executed by a processor, the steps of the method described in any one of the first aspects are implemented.
[0030] In a fourth aspect, a computer program product comprising instructions is provided, including a computer program / instructions, which, when executed by a processor, implements the steps of any one of the methods described in the first aspect.
[0031] In a fifth aspect, an embodiment of the present application provides a chip, the chip including a processor, the processor being used to call a computer program in a memory to execute a method as described in any one of the methods in the first aspect.
[0032] It can be understood that the beneficial effects that can be achieved by the electronic device described in the second aspect, the computer-readable storage medium described in the third aspect, the computer program product described in the fourth aspect, and the chip described in the fifth aspect provided above can refer to the beneficial effects in the first aspect and any possible design method thereof, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1 A schematic diagram of CPU frequency and system load provided in an embodiment of the present application;
[0034] Figure 2 A schematic diagram of a method flow for executing a new task in response to an embodiment of the present application;
[0035] Figure 3 A schematic diagram of load increase provided in an embodiment of the present application;
[0036] Figure 4 A flow chart of a load control method for responding to a new task provided in an embodiment of the present application;
[0037] Figure 5A schematic diagram of a normal operation task and an intermittent operation mode operation task provided in an embodiment of the present application;
[0038] Figure 6 A schematic diagram of another load increase provided in an embodiment of the present application;
[0039] Figure 7 A flow chart of a load control method provided in an embodiment of the present application;
[0040] Figure 8 A flow chart of another load control method provided in an embodiment of the present application;
[0041] Fig. 9 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;
[0042] Fig.10 A software architecture diagram of an electronic device provided in an embodiment of the present application;
[0043] Fig.11 A software architecture diagram of another electronic device provided in an embodiment of the present application;
[0044] Fig.12 A schematic diagram of the structure of a chip system provided in an embodiment of the present application. DETAILED DESCRIPTION
[0045] In the description of the embodiments of the present application, the terms used in the following embodiments are only for the purpose of describing specific embodiments, and are not intended to be used as limitations on the present application. As used in the specification and the appended claims of the present application, the singular expressions "a", "said", "above", "the" and "this" are intended to also include expressions such as "one or more", unless there is a clear contrary indication in the context. It should also be understood that in the following embodiments of the present application, "at least one", "one or more" refer to one or more (including two). The term "and / or" is used to describe the association relationship of 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, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship.
[0046] References to "one embodiment" or "some embodiments" etc. described in this specification mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Thus, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways. The term "connection" includes direct connection and indirect connection, unless otherwise specified. "First" and "second" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated.
[0047] In the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.
[0048] Before introducing the load control method provided in the embodiment of the present application, some basic concepts involved in the embodiment of the present application are briefly introduced.
[0049] Task: includes various actions taken by users when operating electronic devices and the corresponding response events (such as single-click, double-click, opening a dialog box, closing a file, starting an application, etc.). Task is a general term that refers to an activity completed by software.
[0050] Frequency: The frequency in the embodiments of the present application refers to the frequency of the CPU of the electronic device. The CPU frequency refers to the number of cycles that the CPU can execute per second (it can also be understood as the operating speed of the CPU), measured in Hertz (Hz). For example, 3.5 GHz means that the CPU can execute 3.5 billion cycles per second.
[0051] Frequency: usually refers to the fixed frequency value at which the CPU can run within a specific time. The CPU of an electronic device is preset with multiple frequency points, each frequency point corresponds to a frequency, and the CPU can work at the frequency corresponding to each frequency point. For example, the CPU is preset with three frequency points, the frequency corresponding to frequency point 1 is 3.13GHz, the frequency corresponding to frequency point 2 is 2.54GHz, and the frequency corresponding to frequency point 3 is 2.04GHz, then the CPU can work at a frequency of 3.13GHz, 2.54GHz or 2.04GHz.
[0052] The frequency can be adjusted dynamically, and the frequency point is the specific value that may be reached during these adjustments.
[0053] Load: The load involved in the embodiments of the present application refers to the system load of the electronic device. The system load usually refers to the utilization rate of resources such as CPU, memory, storage device or network interface.
[0054] The relationship between load and frequency:
[0055] When the system load is high (for example, running complex computing tasks, playing games, or rendering videos; or executing a multi-tasking environment), the CPU needs more computing power. At this time, the CPU frequency can be increased to provide higher performance.
[0056] When the system load is low (such as browsing the web, editing documents, or in standby mode; or, in a single-task operating environment), the CPU does not need too much computing power. In order to save energy and reduce heat, the CPU frequency can be reduced to reduce the overall power consumption of electronic devices. Under low load conditions, the CPU frequency usually drops to a lower frequency point, thereby reducing power consumption and extending battery life.
[0057] When the system is under little load, the CPU can enter a low-power state (such as C-states), reduce the frequency to the minimum, or even completely stop some cores from working to maximize energy savings.
[0058] In some embodiments, illustratively, Figure 1 A schematic diagram of CPU frequency and system load is given. Figure 1As shown, the CPU is preset with three frequency points. The frequency value of frequency point 1 (opp1) corresponds to frequency 1, the frequency value of frequency point 2 (opp2) corresponds to frequency 2, and the frequency value of frequency point 3 (opp3) corresponds to frequency 3. With the goal of minimizing the energy consumption of electronic equipment, when the CPU is at frequency point 1 (opp1), the system load that can be borne by the CPU's processing capability is system load 1 (util1). That is, if the load of the electronic equipment is system load 1, the CPU runs at frequency point 1, and the energy consumption of the electronic equipment can be minimized under the computing power of the CPU. When the CPU is at frequency point 2 (opp2), the system load that can be borne by the CPU's processing capability is load 2 (util2). That is, when the system load increases, for example, when the system load increases to system load 2 (util2), the CPU frequency / frequency point needs to be increased to frequency point 2 (opp2) to ensure the CPU's processing capability. Accordingly, when the system load increases, for example, when the system load increases to system load 3 (util3), the CPU frequency / frequency point is increased to frequency point 3 (opp3). The increase in system load requires higher CPU processing performance. The higher the CPU frequency, the stronger the processing performance, but the greater the power consumption. In other words, the greater the load of the electronic device, the greater the energy consumption of the electronic device.
[0059] Since the processing power (chip capacity) and memory of the processor of an electronic device are always limited, when the electronic device performs complex tasks or suddenly increases the number of tasks to be performed, the load may increase sharply in a short period of time, which can easily cause the electronic device to suddenly enter a high-load state, thereby increasing the frequency of the CPU and causing additional power consumption of the electronic device.
[0060] For example, when the electronic device is executing Task A, the load of the electronic device is Load 1, and the CPU frequency is at Frequency Point 1. Task B runs freely immediately after the start condition is met. Task B runs freely and arbitrarily without distinguishing between foreground and background scenes. The sudden addition of a new task will cause the system load of the electronic device to increase sharply, causing the CPU frequency to increase (for example, it may cause the CPU frequency to increase to Frequency Point 2). The increase in CPU frequency has greater processing power and computing power, but it will cause a sudden increase in the power consumption of the electronic device.
[0061] For example, Figure 2 A schematic diagram of the execution method process of responding to a new task is given. When the electronic device executes task A, the system load is load 1. After the electronic device meets the start conditions of task B (start conditions such as access to the network, non-low power mode, etc.), it immediately executes task B. When the electronic device executes task B, it can perform load tracking to obtain the load of executing tasks A and B. At this time, due to the free and random operation of task B, the system load increases sharply. Reference Figure 3 , Figure 3 A schematic diagram of load increase is given. When the electronic device executes task A, the system load is load 1. When the electronic device executes task B that meets the startup conditions, the system load of task B is load 2 (historical load record), and the system load of the electronic device increases from load 1 (executing task A) to load 3 (executing tasks A and B). The electronic device performs frequency mapping calculation based on the increased load and energy model (EM), and calculates the frequency with the lowest energy consumption when the CPU processes the task of load 3, which is the frequency that should be reached after the load increase. The frequency after the load increase is greater than the frequency before the load increase, so the CPU frequency is adjusted to increase the CPU frequency. For example, the CPU frequency value is increased from opp1 to opp2 to meet the performance requirements of the electronic device under high load. However, running the CPU at a higher frequency will increase the power consumption of the electronic device.
[0062] In addition to causing a sudden increase in the power consumption of electronic devices, this multi-tasking operation may also cause other problems. For example, when the electronic device is executing task A, task B is triggered to execute after meeting the start condition. The execution of task B will occupy system resources and system services, resulting in insufficient system resources for executing task A. For example, when task A corresponds to application A, insufficient system resources for executing task A will cause application A to freeze. Specifically, for example, when application A is a video application, there will be a problem of video loading freeze. For example, when application A is a navigation application, there will be a problem of navigation playback freeze. For example, when application A is an e-book application, there will be a problem of slow loading of e-book pages. For example, when application A is a music application, there will be a problem of music playback loading freeze. Application A freezes, making the user's experience of using electronic devices worse. Especially when task B is a non-urgent task, the electronic device will seize the system resources and system services of task A currently executed for the user due to the execution of non-urgent task B, exacerbating the user's poor experience.
[0063] However, in the actual use of electronic devices, Task B that meets the start condition to trigger execution is sometimes a non-urgent task, which does not need to be executed immediately after the start condition is met until the task is completed. For example, non-urgent tasks may include some foreground tasks and background tasks. Exemplarily, background tasks may include large model calculation tasks performed by the gallery in the background, background synchronization tasks of application data of electronic devices, background data synchronization tasks between electronic devices and servers, and so on. For these non-urgent tasks, after the electronic device detects that these non-urgent tasks meet the start condition, before executing these non-urgent tasks, it can perform load control on these non-urgent tasks to avoid the high load caused by the execution of these non-urgent tasks, as well as the possible resource preemption of the tasks being executed or other urgent tasks, thereby avoiding the sudden increase in the load of the electronic device, the increase in the CPU frequency, the sudden increase in the power consumption of the electronic device, and the possible jamming of the tasks being executed.
[0064] The embodiment of the present application provides a load control method, which can control the task to run in an intermittent operation mode for tasks that meet the startup conditions, so that the load of the electronic device will not increase sharply. When executing new tasks in an intermittent operation mode, the load of the electronic device increases slowly and the load increment is relatively small, achieving the effect of load control of the electronic device. Furthermore, while achieving load control, the frequency of the CPU can be kept constant as much as possible or the degree of frequency increase can be as small as possible, so as to achieve the purpose of minimizing or increasing the additional power consumption caused by the electronic device running new tasks.
[0065] Figure 4 A flow chart of a load control method for responding to a new task provided in an embodiment of the present application. Figure 4 , the electronic device runs task A. The electronic device detects that there is at least one new task B that meets the start condition. The electronic device obtains the current operating environment load, that is, the electronic device obtains the system load of running task A in the operating environment where the electronic device is located. In addition, the electronic device controls the load of the new task B.
[0066] Exemplarily, in some embodiments, the electronic device manages the load of the new task B, which may include the electronic device running the new task B in an intermittent operation mode so that the load of executing the new task B increases slowly, avoiding a sharp increase in load caused by continuous execution of the new task B.
[0067] refer to Figure 5 As shown, Figure 5 A diagram of a normal running task and a task running in intermittent mode is given. Figure 5(a) The normal execution cycle (or expected execution cycle) of a task includes the running time (running time, Figure 5 R in the figure) and sleeping time ( Figure 5 When an electronic device executes a task normally, it will concentrate on completing the task during the running period. The continuous execution of tasks in a concentrated manner will continue to occupy the system resources and system services of the electronic device, causing the load of the electronic device to increase suddenly (see Figure 3 load increase diagram shown).
[0068] In the present application examples, reference Figure 5 (b) The electronic device runs the task that meets the start condition in an intermittent operation mode, and divides the normal execution cycle (or expected operation cycle) of a task into multiple execution time slots (TIME_SLOT), each TIME_SLOT includes an operation sub-period and an idle sub-period. Among them, the operation sub-period includes Figure 5 The idle sub-periods include the time periods indicated by R1, R2, R3, R4, and R5 in (b). Figure 5 The time periods indicated by S1, S2, S3, S4, and S5 in (b). R1 and S1 form a TIME_SLOT, R2 and S2 form a TIME_SLOT, R3 and S3 form a TIME_SLOT, R4 and S4 form a TIME_SLOT, and R5 and S5 form a TIME_SLOT. The sum of the durations of all running sub-periods is the same as the duration of the complete running period of the normal execution cycle of the task (R1+R2+R3+R4+R5=R); the sum of the durations of all idle sub-periods is the same as the duration of the complete idle period of the normal execution cycle of the task (S1+S2+S3+S4+S5=S).
[0069] The electronic device executes the new task in the running sub-period and suspends the execution of the new task in the idle sub-period. The new task runs in an intermittent running mode. Since the running sub-period is short, after running the new task for a short time in the running sub-period of the execution time slot, it enters the idle sub-period of the execution time slot. The electronic device can release resources when it is idle, and will not occupy a large number of system resources and system services of the electronic device. The load of the electronic device executing the new task will not increase suddenly. Even if the load is generated because the electronic device executes the new task, the load generated by the short-term execution of the new task in the running sub-period is relatively small. Reference Figure 6 , Figure 6 Another schematic diagram of load increase is given. Figure 3In comparison, when the electronic device executes task A, the system load is load 1. When the electronic device executes task B that meets the startup conditions, the system load of task B is load 2 (historical load record). The electronic device determines that task B meets the load control conditions based on the system load of task B. The electronic device runs task B according to the execution time slot of task B, and the system load generated by the actual operation of task B is load 4. Since task B is run in an intermittent operation mode, the load 4 generated by the operation of task B under load control is much smaller than the historical load record (load 2). The superimposed load (load 5) formed by running task B in an intermittent operation mode is much smaller than Figure 3 The superimposed load (load 3) formed by the normal operation of task B. After calculation, the superimposed load does not reach the load corresponding to the next frequency point (opp2), and the CPU frequency does not need to be increased, which is enough to meet the performance requirements of the electronic equipment under load 5. It can be seen that the load increment of the electronic equipment is low when the new task (task B) is run in intermittent operation mode, which will not cause a sudden increase in CPU frequency due to a sudden increase in load, and a sudden increase in power consumption of the electronic equipment.
[0070] In some embodiments, when the electronic device obtains the superimposed load of the load (historical load) of executing a new task and the load of the current operating environment, based on the mapping relationship between frequency, load and energy provided by the EM energy model, the expected frequency corresponding to the superimposed load is calculated with energy optimization as the goal, and when the expected frequency is high, the load control operation of the new task is performed to reduce the load increase and frequency increase caused by running the new task. Furthermore, after the electronic device performs load control on the new task and runs the new task in an intermittent operation mode, it can also obtain the new load generated by running the new task in the intermittent operation mode through load tracking to verify whether the new task causes a sudden increase in the system load of the electronic device, or to verify whether it causes an increase in the frequency of the CPU of the electronic device.
[0071] In this embodiment, through the mapping relationship between frequency, load and energy, with the goal of minimizing energy consumption, the estimated frequency corresponding to the load (historical load) of the normal execution of the new task and the superimposed load in the current operating environment is calculated. When the estimated frequency is greater than the frequency of the CPU before the execution of the new task, the electronic device can run the new task in an intermittent operation mode to reduce the load caused by the execution of the new task, so that the CPU frequency remains unchanged as much as possible. In this way, although the superimposed load of the load of executing the new task and the system load in the current operating environment has increased, the load increment is not much. In the current environment, the target frequency corresponding to the load generated by running the new task in an intermittent operation mode does not reach the next level frequency point of the frequency increase (for example, the frequency is at opp1 when the new task is not executed, and the next level frequency point of opp1 is opp2). The CPU frequency can maintain its operating performance to achieve relatively low energy consumption without adjusting its frequency. Therefore, the CPU frequency adjustment can also be omitted, and the CPU still executes tasks at the current frequency to avoid increasing the power consumption of the electronic device.
[0072] In this embodiment, the electronic device runs a new task in an intermittent operation mode, so that the load increases slowly and the load increment is relatively small, thereby realizing the load control of the electronic device. At the same time, the CPU frequency can be kept constant as much as possible or the frequency increase degree can be as small as possible, so as to achieve the purpose of minimizing or increasing the additional power consumption caused by the electronic device running a new task.
[0073] refer to Figure 7 , Figure 7 A flow chart of a load control method in accordance with the above-mentioned embodiment is given as follows: Figure 7 As shown, the method may include:
[0074] S101: The electronic device determines that there is a first task that meets a start condition.
[0075] Among them, the first task refers to a task to be run that meets the startup conditions. The first task can be a foreground task of the electronic device or a background task of the electronic device. The first task can be a non-urgent task. For example, when the first task is a background task, the first task may include tasks such as large model calculation tasks performed by the gallery in the background, background synchronization tasks of application data of the electronic device, and background data synchronization tasks between the electronic device and the server. When the first task is a foreground task, the first task may be a task corresponding to the electronic device running an application or a task performed by the electronic device in other foreground operating environments.
[0076] In some scenarios, the start condition of the first task may include that the communication environment of the electronic device meets the condition, for example, the electronic device is connected to a cellular network, the electronic device is connected to a Wi-Fi network, the electronic device is connected to a hotspot network, the electronic device is connected to a Bluetooth network, etc.
[0077] In some other scenarios, the start condition of the first task may also include that the state of the electronic device satisfies a condition, for example, the electronic device is not in a low power state, the electronic device is not in a low storage space state, the electronic device is not in a high temperature state, the electronic device is in a charging state, etc.
[0078] In some other scenarios, the start condition of the first task may also include that the corresponding set parameters of the task meet the conditions, for example, the execution period of the task is reached, the sleep period of the task is ended, etc.
[0079] A first task may correspond to one or more start conditions that trigger its start-up execution. When the electronic device detects that the start condition of the first task is met, that is, when the electronic device determines that there is a first task to be run, the following load control method for the first task may be executed. Among them, when the first task corresponds to one start condition, the following load control method for the first task is executed when the one start condition is met; when the first task corresponds to multiple start conditions, the following load control method for the first task is executed when at least one start condition is met.
[0080] In some embodiments, the electronic device can detect whether there is a first task that meets the start condition and execute the load control method of the subsequent first task in any operating environment.
[0081] In some embodiments, the electronic device can detect whether the first task meets the start-up condition and execute the load control method of the subsequent first task in some preset operating environments. For example, some preset operating environments may include an operating environment in which the electronic device performs an emergency task, or an operating environment in which the electronic device performs an application with a large load, or an operating environment in which the electronic device is already performing tasks at a high frequency, etc. The preset operating environment is generally a typical operating environment set based on experience. The load corresponding to these preset operating environments is relatively high, and it is necessary to try to avoid the effects of load increase, frequency increase, and power consumption increase caused by other temporarily executed tasks (such as the first task). The load of the preset operating environment is greater than the third threshold. Exemplarily, when the electronic device is a terminal device such as a mobile phone or a tablet computer, the preset operating environment may include an operating environment in which the electronic device plays video / live broadcast, an operating environment in which the electronic device (in the on / off screen state) plays music, an operating environment in which the electronic device plays an e-book, an operating environment in which the electronic device performs navigation, an operating environment in which the electronic device performs games, and an operating environment in which the electronic device performs recording / screen recording, etc. In this embodiment, when the electronic device is in these preset operating environments, if it is detected that there is a first task that meets the start-up condition, S102 is executed.
[0082] S102: The electronic device obtains a second load of the current operating environment.
[0083] Among them, at least one second task is running in the current running environment. The second task can be a foreground task or a background task. The second task can be an urgent task or a non-urgent task.
[0084] In this embodiment, the load corresponding to an operating environment or the load generated by a task during execution is variable, and the electronic device can track the load of tasks in various operating environments to obtain the load distribution of each task in the current operating environment. The second load U2 corresponding to the task in the current operating environment is determined based on the load distribution of the task in the current operating environment. It can be understood that when the operating environment corresponds to the task one-to-one, the load of the task is the load of the corresponding operating environment. Exemplarily, the load with a large distribution probability of the task can be used as the load corresponding to the task in the current operating environment; or, the average load of the task from the beginning to the end can be used as the load of the task in the current operating environment.
[0085] For example, the current operating environment is an operating environment in which the electronic device plays a video, and the second task is to play the video. The electronic device can perform load tracking on the operating environment and obtain the load distribution of the operating environment from the beginning to the end. The load with a high probability of load distribution is taken as the load corresponding to the operating environment. The corresponding relationship between the operating environment and the load is stored in the designated storage space.
[0086] In this embodiment, the designated storage space of the electronic device may store corresponding relationships between various tasks and their corresponding loads, various operating environments and their corresponding loads, etc. In this embodiment, in step S102, the electronic device may obtain a historical load record corresponding to the current operating environment from the designated storage space as the second load.
[0087] S103: The electronic device obtains a first load of a first task.
[0088] When executing a task, the electronic device can track the load of the task and record the load corresponding to the task (average load, or load with the highest distribution probability) in a designated storage space.
[0089] If the first task is not the first time the electronic device performs the task, the designated storage space of the electronic device may have a historical load record related to the first task. The electronic device can obtain the first load U1 corresponding to the first task from the designated storage space.
[0090] If the first task is a task that is executed for the first time by the electronic device, there is no historical record data for the first task in the designated storage space. The electronic device can obtain the historical load record corresponding to the task of the same type as the first task as the first load. For example, the first task is Task A of video application A, but there is no load information corresponding to Task A in the designated storage space. The designated storage space includes load information corresponding to Task B of video application B. The task of video application A is of the same type as the task of video application B, and both are tasks corresponding to video applications. Then the electronic device can use the historical load record of Task B of video application B in the designated storage space as the first load of the first task.
[0091] If there is no historical load record corresponding to the first task in the designated storage space, and there is no historical load record of a task of the same task type as the first task, then the electronic device can obtain the first load of the first task in other ways. For example, the electronic device can first run the first task for a period of time, and obtain the average load within the period as the first load. Alternatively, the electronic device can first run the first task for a period of time, and obtain the load with the highest distribution probability within the period as the first load.
[0092] S104: When the first task meets the load control condition, the electronic device runs the first task in an intermittent operation mode.
[0093] Among them, the load control conditions may include control conditions in multiple dimensions. When the first task meets at least one load control condition, the electronic device may be triggered to run the first task in an intermittent operation mode.
[0094] In one example, the first task that meets the load control condition may include a task whose first load is greater than a first threshold.
[0095] The first threshold Ua can be pre-set based on experience. When the first load is greater than the first threshold, it indicates that the superimposed load generated by executing the task may cause the frequency of the electronic device to increase. In this case, when the first load U1> the first threshold Ua, the first task is run in an intermittent operation mode to achieve load control of the superimposed load. Figure 5 The hint given.
[0096] In some embodiments, the electronic device may determine a load compression ratio based on the expected running time of the first task. Based on the load compression ratio, determine the execution time slot TIME_SLOT division rule for running the first task. Thus, the first task is run based on the divided TIME_SLOT. The load compression ratio may also be a pre-set fixed value. For example, the load compression ratio may be 40%, 50%, or 60%. Based on the load compression ratio, the electronic device divides the expected running cycle of the first task into execution time slots, and runs the first task based on the execution time slots. The expected running cycle includes a running period and an idle period. Optionally, the electronic device may predict the load generated by running the first task in an intermittent running mode, and when the predicted load reaches the load compression ratio, determine the corresponding execution time slot division rule, and run the first task with the divided TIME_SLOT.
[0097] In some other feasible embodiments, the electronic device can obtain the correspondence between each frequency point and the load of the CPU through the EM energy model. The correspondence between the frequency point and the system load refers to the system load that the processing capacity of the CPU can withstand when the CPU is at the frequency point. For example, the CPU presets three frequency points. The system load corresponding to these three frequency points can be obtained through the EM energy model, such as the first frequency point opp1 corresponds to the first system load util1, the second frequency point opp2 corresponds to the second system load util2, and the third frequency point opp3 corresponds to the third system load util3. The first frequency point is smaller than the second frequency point, and the second frequency point is smaller than the third frequency point. The higher the frequency point, the stronger the processing capacity of the CPU and the greater the power consumption of the electronic device. Multiple frequency points can form a frequency point level, for example, the first frequency point, the second frequency point, and the third frequency point form three frequency point levels, the first frequency point corresponds to frequency point level one, the second frequency point corresponds to frequency point level two, and the third frequency point corresponds to frequency point level three. The higher the frequency point level, the higher the frequency point / frequency, and the higher the processing capacity of the CPU.
[0098] In another example, the first task that meets the load control condition may include: the superimposed load of the first load and the second load is less than the task corresponding to the load corresponding to the next level frequency point of the first frequency point opp1. After the electronic device obtains the first load, it can determine the frequency level of the current CPU according to the first load. Exemplarily, assuming that the first load U1 is the same as the first system load util1, the electronic device can determine that the first load U1 is at the first frequency point opp1. After the electronic device obtains the second load, the electronic device can determine whether the second system load util2 corresponding to the second frequency point opp2 will be reached according to the superimposed load of the first load and the second load. Exemplarily, if the superimposed load is greater than or equal to the second system load util2 (the third load corresponding to the current operating environment), it means that the load superposition of the first task will cause the CPU frequency point to increase, and the electronic device needs to increase the CPU frequency so that the CPU can perform the first task with stronger processing power. The increase in CPU frequency will aggravate the increase in power consumption of the electronic device. In this case, the electronic device can run the first task in an intermittent operation mode to achieve load control of the superimposed load.
[0099] In some other embodiments, if the first task is a background task, when the superimposed load of the second load and the first load is less than the second system load util2, the electronic device can run the first task in an intermittent operation mode to achieve control of the superimposed load. When the load of the first task is relatively small, the electronic device can still run the first task in an intermittent operation mode, which can further ensure that the operation of the first task will not cause resource preemption of the foreground task.
[0100] In this embodiment, the EM energy model stores the correspondence between frequency and energy consumption. The electronic device can implement frequency mapping calculation based on the EM energy model to obtain the energy consumption corresponding to the load at different frequencies, and determine the frequency with the minimum energy consumption as the expected frequency corresponding to the load, so as to perform load control processing of the task.
[0101] Among them, energy consumption includes static energy consumption (P_static) and dynamic energy consumption (P_dynamic).
[0102] The total energy consumed to perform the task is E=(P_static + P_dynamic)×t.
[0103] Where t is the task completion time, which depends on the load and frequency.
[0104] The calculation method of t can be expressed as: t = Workload / f.
[0105] Workload is the load; f is the CPU operating frequency.
[0106] The calculation method of dynamic energy consumption (P_dynamic) can be expressed as: P_dynamic = C×V 2 ×f×Activity_Factor.
[0107] Where C is the capacitive load, which is a known parameter; V is the operating voltage, which is a known parameter; f is the frequency, and Activity_Factor represents the activity factor of the workload.
[0108] Electronic devices can calculate the total energy consumption at different frequencies based on the relationship between load and frequency, and thus determine the expected frequency corresponding to the load based on the total energy consumption. The above relationship shows that at high frequencies, the task completion time is shorter, but the energy consumption is higher; at low frequencies, the task completion time is longer, but the energy consumption is lower.
[0109] Through the above EM energy model, the electronic device can calculate the energy consumption corresponding to different CPU frequencies under different loads, so as to determine the load with the lowest energy consumption at each frequency, that is, the system load corresponding to each frequency.
[0110] Through the above EM energy model, the electronic device can calculate the superimposed load of the first load and the second load, and the expected frequency corresponding to the lowest energy consumption. Therefore, according to the expected frequency and the frequency of the current operating environment, it can be judged whether the frequency is increased and whether new task load control is needed.
[0111] For example, in some embodiments, when the electronic device is in the current operating environment, the second task is run at the first frequency. When the presence of a first task that meets the startup conditions is detected, the electronic device can recalculate the total energy consumption of the superimposed load at different frequencies based on the first load of the first task and the superimposed load of the second load of the current operating environment, and obtain the frequency with the minimum energy consumption as the expected frequency. If the expected frequency (the frequency corresponding to the superimposed load) is greater than the corresponding frequency (first frequency) in the current operating environment, it means that the frequency needs to be increased to run the first task. In this case, the electronic device can run the first task in an intermittent operation mode to achieve load control of the superimposed load.
[0112] In some other embodiments, when the electronic device runs the first task in an intermittent operation mode, the electronic device can also perform load tracking on the first task. Obtain the system load when the first task is run in an intermittent operation mode under the current environment, and calculate the frequency corresponding to the system load when the energy consumption is the lowest. If the frequency is the same or close to the frequency before the first task is executed, it belongs to the same frequency level. Then it means that the load generated by running the first task in an intermittent operation mode does not cause a sudden increase in the system load of the electronic device, and the processing capacity corresponding to the first frequency of the CPU is sufficient to handle the current superimposed load, that is, when the CPU processes the superimposed processing of the electronic device at the current first frequency, the energy consumption of the electronic device is the lowest, the frequency of the CPU does not need to be increased, the load of the electronic device does not increase suddenly, and the frequency of the CPU will not increase suddenly, which naturally will not cause a sudden increase in the power consumption of the electronic device, thereby realizing the control of the load of the electronic device performing multiple tasks.
[0113] In this embodiment, when the first task satisfies at least one load control condition, for example, the first load of the first task is greater than the first threshold, or the superimposed load of the second load and the first load is greater than the system load corresponding to the current frequency, or the first load is greater than the first threshold and the superimposed load of the second load and the first load is greater than the system load corresponding to the current frequency, the electronic device can run the first task in an intermittent operation mode to avoid the sudden increase in load caused by the execution of the first task as much as possible. Although running the first task in an intermittent operation mode will still cause an increase in load, the increase in load is not much, and the CPU frequency can maintain its operating performance without adjusting its frequency. Therefore, the CPU frequency can also be adjusted without adjustment, and the CPU still executes tasks at the current frequency, which can avoid an increase or a sharp increase in the power consumption of the electronic device.
[0114] It can be understood that this embodiment is for Figure 7 The order in which the steps are performed is not limited.
[0115] In some embodiments, the first task that satisfies the start condition detected by the electronic device may include one or more tasks. When the first task that satisfies the start condition includes one task, the above Figure 7 The load control is performed by the embodiments provided. When the first task that meets the start condition includes multiple tasks, the load control can be performed by the load control method provided by the following embodiments.
[0116] refer to Figure 8 , Figure 8 Another load control method is given, such as Figure 8 As shown, the method may include:
[0117] S201. The electronic device determines that there are multiple first tasks that meet the startup conditions, and obtains the first load corresponding to the first tasks.
[0118] In this embodiment, when the first tasks that meet the startup conditions include multiple tasks, each task corresponds to a first load. The electronic device obtains the first loads of each task, which can refer to steps S101 and S103 in the above embodiment, and will not be elaborated in this embodiment.
[0119] S202. The electronic device obtains the second load of the current operating environment.
[0120] Referring to step S102 in the above embodiment, it will not be elaborated in this embodiment.
[0121] S203. The electronic device screens the first target tasks from the multiple first tasks according to the first loads corresponding to the respective first tasks.
[0122] The first target task refers to one or more first tasks that meet the load control conditions.
[0123] Among them, the first tasks (first target tasks) that meet the load control conditions may include: the first tasks with the first load less than the second threshold Ub; or, the first tasks with the superimposed load of the first load and the second load of the current operating environment less than the system load corresponding to the CPU frequency in the current operating environment; or, the tasks with the smallest load among the first tasks. Among them, the second threshold Ub is greater than the first threshold Ua. The third threshold is greater than the second threshold.
[0124] In a feasible embodiment, the electronic device screens the first target tasks that meet the load control conditions from the multiple first tasks, which may include: screening one first target task from the multiple first tasks.
[0125] For example, in some scenarios, select one first task with the smallest first load from the multiple first tasks as the first target task. Exemplarily, the first tasks include First Task 1, First Task 2, and First Task 3. Among them, the first load of First Task 1 is U11, the first load of First Task 2 is U12, and the first load of First Task 3 is U13. Among them, U13 < U12 < U11, and First Task 3 is used as the first target task.
[0126] In another feasible embodiment, the electronic device screens the first target tasks from the multiple first tasks, which may include: screening at least one first target task that meets the load control conditions from the multiple first tasks.
[0127] For example, in some scenarios, multiple first tasks are sorted in ascending order of the first load, and the first task with the first load less than the second threshold Ub is selected. If there is one first task with the first load less than the second threshold Ub, then select this one first task with the first load less than the second threshold Ub as the first target task. Exemplarily, the first tasks include First Task 1, First Task 2, and First Task 3. Among them, the first load of First Task 1 is U11, the first load of First Task 2 is U12, and the first load of First Task 3 is U13. Among them, U13 < U12 < U11. The first load U13 of First Task 3 is less than the second threshold Ub, and the first load U12 of First Task 2 is greater than the second threshold Ub. Only First Task 3 meets the load control condition, so First Task 3 is taken as the first target task.
[0128] If there are multiple first tasks with the first load less than the second threshold Ub, then select multiple first tasks with the first load less than the first threshold as the first target tasks. Exemplarily, the first load U13 of First Task 3 is less than the second threshold Ub, the first load U12 of First Task 2 is less than the second threshold Ub, and the first load U11 of First Task 1 is greater than the second threshold Ub. First Task 2 and First Task 3 meet the conditions, so First Task 2 and First Task 3 are taken as the first target tasks.
[0129] For example, in some scenarios, one or more first target tasks can be obtained from the first tasks, and the superimposed load of the first load corresponding to the one or more first target tasks and the second load is less than the next-level frequency point of the frequency point corresponding to the second load. For example, the second load in the current operating environment corresponds to the first frequency point. The next-level frequency point of the first frequency point is the second frequency point (the second frequency point is higher than the first frequency point). The superimposed load of the first load of the first target task and the second load is less than the system load corresponding to the second frequency.
[0130] Exemplarily, the frequency point corresponding to the current second load U2 is Frequency Point 1 (opp1). If the first load of First Task 3 is U13 + the second load U2 < the load corresponding to opp2 (the next-level frequency point of opp1), the first load of First Task 2 is U12 + the second load U2 > the load corresponding to opp2, and the first load of First Task 1 is U11 + the second load U2 > the load corresponding to opp2. First Task 3 meets the conditions, so First Task 3 is taken as the first target task.
[0131] If the first load of the first task 3 is U13 + the second load U2 < the load corresponding to opp2 (the next frequency point of opp1), the first load of the first task 2 is U12 + the second load U2 < the load corresponding to opp2, and the first load of the first task 1 is U11 + the second load U2 > the load corresponding to opp2. When there are multiple cases where the superimposed load of the first load and the second load of the first task is less than the load corresponding to opp2, the electronic device can regard both the first task 2 and the first task 3 as the first target tasks. Or, the electronic device can further screen and judge the superimposed load of the sum of the first loads and the second load. For example, when U13 + U12 + U2 <= opp2, the first task 2 and the first task 3 are regarded as the first target tasks. If U13 + U12 + U2 > opp2, select the task with a smaller load from U13 and U12 as the first target task.
[0132] In this embodiment, the electronic device can implement frequency mapping calculation based on the EM energy model to obtain the energy consumption corresponding to the superimposed load of the load corresponding to different first tasks and the first load at different frequencies, and determine the frequency with the minimum energy consumption as the predicted frequency. When it is determined that the predicted frequency does not increase, the first target task is determined, and thus the load control process of the first target task is carried out. Specifically, the method for performing frequency mapping calculation can refer to the method given in the above embodiment, and this embodiment will not be elaborated.
[0133] S204. The electronic device runs the first target task in an intermittent operation mode.
[0134] After the electronic device screens and obtains the first target task, the electronic device runs the first target task with a load compression ratio determined based on the predicted running duration of the first target task, or a preset load compression ratio, so as to run the first target task in an intermittent operation mode, so as to achieve the effect of controlling the superimposed load (or the first load). Since the first target task is either the to-be-run task with the smallest load, or the superimposed load of the load of the first target task and the second load is less than the system load of the second frequency point. Selecting the first target task has performed preliminary load control, and the electronic device further runs the first target task in an intermittent operation mode, realizing further load control. During the process of the electronic device running the first target task, the problem that the load suddenly increases, resulting in the frequency of the CPU increasing and the power consumption of the electronic device increasing additionally, can be avoided.
[0135] Reference can be made to the content of step S104 in the above embodiment.
[0136] It can be understood that this embodiment does not limit Figure 8 the execution order of the steps involved.
[0137] The load control method provided in the embodiment of the present application can be applied to electronic devices. The electronic device 100 in the embodiment of the present application can be an electronic device that can perform multiple tasks in parallel. Exemplarily, the electronic device can be a portable computer (such as a mobile phone), a tablet computer, a laptop computer, a personal computer (PC), a wearable electronic device (such as a smart watch), an augmented reality (AR) device, a virtual reality (VR) device, a car computer, etc. The following embodiments do not impose any special restrictions on the specific form of the electronic device.
[0138] Fig. 9 A schematic structural diagram of an electronic device 100 is shown.
[0139] 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, a display screen 194, etc.
[0140] It is to be understood that the structure illustrated in the embodiment of the present invention does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figure, or combine some components, or separate some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0141] 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 processor (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), etc. Different processing units may be independent devices or integrated into one or more processors.
[0142] 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.
[0143] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0144] In this embodiment, when the processor is a CPU, the processor 110 is preset with multiple frequency points, each frequency point corresponds to a frequency, and the CPU can work at the frequency corresponding to each frequency point. Exemplarily, the CPU is preset with three frequency points, the frequency corresponding to frequency point 1 is 3.13 GHz, the frequency corresponding to frequency point 2 is 2.54 GHz, and the frequency corresponding to frequency point 3 is 2.04 GHz, then the CPU can work at a frequency of 3.13 GHz, 2.54 GHz, or 2.04 GHz.
[0145] In some embodiments, the processor 110 may include one or more interfaces. The interface 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, etc.
[0146] It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present invention is only a schematic 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 in the above embodiments, or a combination of multiple interface connection methods.
[0147] The charging management module 140 is used to receive charging input from a charger. The charger may be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 may receive charging input from a wired charger through the USB interface 130. In some wireless charging embodiments, the charging management module 140 may receive wireless charging input through a wireless charging coil of the electronic device 100. While the charging management module 140 is charging the battery 142, it may also power the electronic device through the power management module 141.
[0148] 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, and supplies power to the processor 110, the internal memory 121, the external memory, the display screen 194, the camera 193, and the wireless communication module 160. The power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle number, battery health status (leakage, impedance), etc. In some other embodiments, the power management module 141 can also be set in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 can also be set in the same device.
[0149] 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.
[0150] 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 through the external memory interface 120 to implement a data storage function, such as storing music, video and other files in the external memory card.
[0151] 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, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created during the use of the electronic device 100 (such as audio data, a phone book, 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.
[0152] The display screen 194 is used to display images, videos, etc. The 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 or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.
[0153] In this embodiment, the electronic device can display the display interface of the running foreground application through the display screen.
[0154] The software system of the electronic device 100 may adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture. In the embodiment of the present invention, the Android system of the layered architecture is taken as an example to exemplify the software structure of the electronic device 100.
[0155] Fig.10 1 is a software structure block diagram of the electronic device 100 according to an embodiment of the present invention.
[0156] 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 an application layer, an application framework layer (framework, FWK) and a kernel layer (Kernel).
[0157] The application layer may include a series of application packages. For example, the application package may include system applications and third-party applications. For example, the system applications may include camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message, etc.
[0158] The application framework layer provides an application programming interface (API) and a programming framework for the applications in the application layer. The application framework layer includes some predefined functions.
[0159] like Fig.10As shown, the task scheduling engine is deployed in the application framework layer.
[0160] The task scheduling engine can be used as the executor of the above load control method to obtain corresponding information from the kernel layer for load control.
[0161] The task scheduling engine deployed in the application framework layer is specifically used to identify the frequency increase load, the current load, and schedule task operation. The scheduling task operation includes task load judgment, target task screening, and task operation load control.
[0162] In some optional embodiments, the application framework layer may include a view system, a resource manager, a notification manager, etc.
[0163] The view system includes visual controls, such as controls for displaying text, controls for displaying images, etc. The view system can be used to build applications. A display interface can be composed of one or more views. For example, a display interface including a text notification icon can include a view for displaying text and a view for displaying images.
[0164] The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, and so on.
[0165] The notification manager enables applications to display notification information in the status bar. It can be used to convey notification-type messages and can disappear automatically after a short stay without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc. The notification manager can also be a notification that appears in the system top status bar in the form of a chart or scroll bar text, such as notifications of applications running in the background, or a notification that appears on the screen in the form of a dialog window. For example, a text message is displayed in the status bar, a prompt sound is emitted, an electronic device vibrates, an indicator light flashes, etc.
[0166] The kernel layer includes the algorithm processing module. For example, the algorithm processing module can be used for load / frequency distribution tracking, load tracking, frequency mapping calculation, etc. The algorithm processing module stores data such as EM energy model, frequency point table, frequency conditions, etc.
[0167] Fig.11 exist Fig.10 Based on this, a more detailed software architecture diagram is given, and Fig.11 The data flow is also shown.
[0168] Combination Fig.11The specific execution functions of each module shown introduce the load control method provided in the embodiment of the present application, wherein the task scheduling engine of the application framework layer can be used as the execution subject of the load control method provided in the embodiment of the present application, specifically including:
[0169] 1. The task scheduling engine of the application framework layer performs frequency-increasing load identification.
[0170] The task scheduling engine can call the EM energy model and frequency point table in the algorithm processing module of the core layer to identify the frequency-upgrading load.
[0171] The task scheduling engine obtains the preset frequency of the CPU based on the frequency table, and calculates the load corresponding to the lowest energy consumption of the CPU at each frequency according to the corresponding relationship between the frequency, energy consumption and system load provided by the EM energy model; or calculates the expected frequency of a certain load when the energy consumption is the lowest. Optionally, the load increment required to increase between each frequency point (the load difference between the corresponding loads between the frequency points) can also be obtained.
[0172] In this embodiment, the EM energy model stores the corresponding relationship between frequency, energy consumption and system load. The task scheduling engine can implement frequency mapping calculation based on the EM energy model to obtain the load of the frequency with the minimum energy consumption corresponding to different frequency points. Please refer to the relevant calculation method in the above step 104.
[0173] The task scheduling engine can calculate the total energy consumption at different frequencies / frequency points based on the relationship between the above load and frequency / frequency point, and thus determine the corresponding processable load at the frequency point based on the total energy consumption. The rule presented in the above relationship is that when the system load is high, the CPU utilization rate increases and the CPU frequency / frequency point increases; when the system load is low, the CPU utilization rate is low and the CPU frequency / frequency point decreases.
[0174] After obtaining the load corresponding to each frequency point of the CPU, the task scheduling engine may store the corresponding relationship between each frequency point and the load in a designated storage space.
[0175] 2. The task scheduling engine determines the current load.
[0176] The task scheduling engine can call the WALT load tracking algorithm to perform load tracking and frequency distribution tracking on the current operating environment to obtain the second load of the current operating environment and the frequency (frequency point) of the CPU in the current operating environment.
[0177] The load generated by an operating environment or a task during execution is variable. The task scheduling engine can track the load of tasks in various operating environments and obtain the load distribution of each task. The second load corresponding to the task is determined based on the load distribution of the task. For example, the load with a large distribution probability can be used as the load corresponding to the task in the current operating environment; or the average load of the task from the beginning to the end can be used as the load of the task in the current operating environment.
[0178] For example, the current operating environment is the operating environment of an electronic device playing a video. The task scheduling engine can track the load of the operating environment and obtain the load distribution of the operating environment from the beginning to the end. The load with a large load distribution probability is used as the load corresponding to the operating environment. And the correspondence between the operating environment and the load is stored in the designated storage space. The task scheduling engine reads the load corresponding to the environment in which the second task is located from the designated storage space as the second load. Accordingly, the task scheduling engine can obtain the target frequency with the lowest energy consumption corresponding to the CPU processing the load under the operating environment as the corresponding frequency of the current operating environment.
[0179] 3. The task scheduling engine schedules running tasks.
[0180] When it is detected that there is a first task that meets the start condition under the preset operating environment, the task scheduling engine determines the current load.
[0181] The task scheduling engine can determine whether the current environment is a preset operating environment by interacting with the application layer; and obtain information about the first task that meets the start condition by interacting with the application layer.
[0182] Before running the first task, the task scheduling engine obtains a historical load record (first load) of the first task.
[0183] Among them, the task scheduling engine can send the load corresponding to the first task from the application layer to the task scheduling engine through the interface with the application layer. Alternatively, the task scheduling engine can query whether there is a load record of the first task in the specified storage space. If there is a load record of the first task in the specified storage space, the load record is obtained as the load of the first task. If there is no load record of the first task in the specified storage space, the load of a task of the same type as the first task can be obtained as the load of the first task. For details, please refer to step S102 in the above embodiment, which will not be repeated here.
[0184] After obtaining the first load of the first task (the task that meets the start conditions), the second load of the current operating environment, and the CPU frequency (frequency point) corresponding to the current operating environment, the task scheduling engine can judge the task load (the superimposed load of the second load and the first load) and further determine the first target task.
[0185] The specific process of determining the first target task based on the task load may refer to step S203 of the above embodiment, which will not be described in detail here.
[0186] After the task scheduling engine determines the first target task, it determines the load control strategy for running the first target task according to the load compression ratio, and sends the load control strategy to the algorithm processing module of the kernel layer. After receiving the signal carrying the load control strategy, the algorithm processing module of the kernel layer runs the first target task according to the load control strategy. Among them, the load control strategy includes the execution time slot TIME_SLOT division rule of the first target task. Among them, the load compression ratio can be a pre-set fixed value, or it can be a value calculated by the task scheduling engine based on the running time of the first target task. For example, the load compression ratio can be 40%, 50%, or 60%. The task scheduling engine generates the load control strategy for the first target task based on the load compression ratio. The algorithm processing module divides the execution time slots of the running time period and the idle time period for executing the first target task based on the load control strategy, and runs the first target task in an intermittent operation mode.
[0187] In some embodiments, the task scheduling engine obtains the load (or load increment) corresponding to each frequency point of the CPU through frequency-up load identification. When in a preset operating environment, when a first task that meets the startup conditions is detected, the electronic device can recalculate the total energy consumption of the superimposed load at different frequencies based on the first load of the first task and the superimposed load of the second load of the current operating environment, and obtain the frequency with the minimum energy consumption as the target frequency. If the target frequency (the frequency corresponding to the superimposed load) is greater than the corresponding frequency (first frequency) in the current operating environment, it means that the frequency needs to be increased to run the first task. In this case, the task scheduling engine runs the first task in an intermittent operation mode according to the load control strategy to achieve load control of the superimposed load.
[0188] In some embodiments, during the process of the task scheduling engine running the first task in an intermittent operation mode, the task scheduling engine can also perform load tracking. Obtain the system load of running the first task in an intermittent operation mode under the current environment, and calculate the energy consumption of the system load at different frequencies. After calculation, it can be obtained that when the energy consumption is minimum, the target frequency corresponding to the system load is the same as or close to the frequency before the first task is executed, and is within the same frequency range. This means that the load generated by running the first task in an intermittent operation mode has not increased suddenly, the CPU frequency has not increased, and no additional power consumption will be caused.
[0189] The present application also provides a chip system (eg, a system on a chip (SoC)), such as Fig.12 As shown, the chip system includes at least one processor 701 and at least one interface circuit 702. The processor 701 and the interface circuit 702 can be interconnected through lines. For example, the interface circuit 702 can be used to receive signals from other devices (such as a memory of an electronic device). For another example, the interface circuit 702 can be used to send signals to other devices (such as a processor 701 or a camera of an electronic device). Exemplarily, the interface circuit 702 can read instructions stored in the memory and send the instructions to the processor 701. When the instructions are executed by the processor 701, the electronic device can execute the various steps in the above embodiments. Of course, the chip system can also include other discrete devices, which are not specifically limited in the embodiments of the present application.
[0190] An embodiment of the present application also provides a computer-readable storage medium, which includes computer instructions. When the computer instructions are executed on the above-mentioned electronic device, the electronic device executes each function or step executed by the electronic device 100 in the above-mentioned method embodiment.
[0191] The embodiment of the present application further provides a computer program product, which, when executed on a computer, enables the computer to execute the functions or steps executed by the electronic device 100 in the above method embodiment. For example, the computer may be the above electronic device 100.
[0192] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0193] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0194] The units described as separate components may or may not be physically separated, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0195] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0196] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium, including several instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.
[0197] The above contents are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application shall be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
Claims
1. A load control method, characterized in that: include: The electronic device determines that there is a first task that meets the start condition; When the first task that meets the start condition includes multiple tasks, the first task is the task with the smallest load among the multiple tasks; When the first task meets the load control condition, the electronic device determines the load control strategy of the first task according to the load compression ratio; wherein the load compression ratio is a value determined based on the expected running time of the first task; The electronic device divides the expected operation cycle of the first task into a plurality of execution time slots based on the load control strategy; the expected operation cycle includes an operation period and an idle period, the operation period includes a plurality of operation sub-periods, the idle period includes the same number of idle sub-periods as the operation sub-periods, and each operation sub-period and an idle sub-period constitute one execution time slot; The electronic device executes the first task according to the plurality of execution time slots of the first task; In the process of the electronic device running the first task in an intermittent operation mode, load tracking is performed on the first task, the electronic device obtains the system load when the first task is run in the intermittent operation mode under the current operating environment, and calculates the frequency corresponding to the system load when the first task is run in the intermittent operation mode when the energy consumption is lowest; if the frequency corresponding to the system load when the first task is run in the intermittent operation mode when the energy consumption is lowest is the same as the frequency before the first task is executed, and they belong to the same CPU frequency point, it is determined that the load generated by running the first task in the intermittent operation mode does not cause a sudden increase in the system load of the electronic device; Among them, the load control condition includes that the first load corresponding to the first task is greater than the first threshold, and the superimposed load of the second load and the first load is greater than the third load; the electronic device obtains the first load by obtaining the historical load record corresponding to the task of the same type as the first task; the second load is the system load of the electronic device in the current operating environment, and the current operating environment includes one or more running tasks; the third load is the load corresponding to the CPU frequency point of the CPU frequency point corresponding to the second load, and the CPU frequency point of the next level is higher than the CPU frequency point corresponding to the second load; The frequency corresponding to the system load when the energy consumption is the lowest is determined by an EM energy model, and the EM energy model stores the corresponding relationship between the frequency, the system load and the energy consumption.
2. The method according to claim 1, characterized in that The satisfying of the load control condition also includes the first task being a non-emergency task.
3. The method according to claim 1 or 2, characterized in that: The method further comprises: When the electronic device determines that it is in a preset operating environment, determining whether there is a first task that meets the start condition; Wherein, the system load under the preset operating environment is greater than a third threshold.
4. An electronic device comprising a memory, a processor and a computer program stored in the memory, characterized in that: The processor executes the computer program to implement the steps of the method according to any one of claims 1 to 3.
5. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 3 are implemented.
6. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 3 are implemented.
Citation Information
Patent Citations
Message sending control method and device, vehicle and storage medium
CN117544441A