Power adjustment method and related apparatus

By detecting the main secondary scenario in the terminal device and adjusting the maximum power supply of the CPU using the power prediction model, the problem of excessive power consumption of the equipment is solved, extending the usage time and reducing power consumption.

WO2025025599A1PCT designated stage expired Publication Date: 2025-02-06HONOR DEVICE CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2024/080500
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-07-31
Filing Date
2024-03-07
Publication Date
2025-02-06

AI Technical Summary

Technical Problem

Existing terminal equipment consumes too fast power under high load conditions, causing the equipment to automatically shut down, causing inconvenience to users.

Method used

By detecting the main secondary scenario where the device is located, the power prediction model is used to determine the optimal value of the maximum power that the CPU can supply in this scenario, reducing the power consumption of the device as much as possible, and ensuring user experience.

Benefits of technology

It effectively extends the service life of the equipment, reduces power consumption, and avoids the automatic shutdown of the equipment due to power exhaustion.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024080500_06022025_PF_FP_ABST
    Figure CN2024080500_06022025_PF_FP_ABST
Patent Text Reader

Abstract

The present application provides a power adjustment method and a related apparatus. By implementing the method, on the basis of a main secondary scenario where an electronic device is located, the electronic device can determine the optimal power of the maximum CPU suppliable power in the main secondary scenario, so that the power consumption of the electronic device is reduced as much as possible on the premise of ensuring the user experience, effectively prolonging the use duration of the electronic device.
Need to check novelty before this filing date? Find Prior Art

Description

Power adjustment method and related device

[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on July 31, 2023, with application number 202310963633.1 and application name “Power Adjustment Method and Related Devices”, the entire contents of which are incorporated by reference into this application. Technical Field

[0002] The present application relates to the field of terminal technology, and in particular to a power adjustment method and related devices. Background Art

[0003] With the advancement of technology, devices such as desktop computers and laptops have become indispensable for people's lives, work, and entertainment. However, because these devices often need to process large amounts of data, they consume power very quickly. This is especially true for portable devices like laptops, which may need to be used without a charging station. If the device consumes power too quickly, it may automatically shut down due to exhaustion during use, causing inconvenience to the user.

[0004] Therefore, how to reduce the power consumption of such terminal devices is an urgent problem to be solved.

[0005] Summary of the Invention

[0006] The purpose of this application is to provide a power adjustment method and related apparatus. By implementing this method, an electronic device can determine the optimal maximum power that can be supplied by the CPU in the primary and secondary scenarios according to the primary and secondary scenarios in which it is located, thereby minimizing the power consumption of the electronic device while ensuring user experience, and effectively extending the use time of the electronic device.

[0007] The above-mentioned and other objects are achieved by the features of the independent claims. Further implementations are given in the dependent claims, the description and the drawings.

[0008] In the first aspect, the present application provides a power adjustment method, which includes: detecting a first main and second level event, determining that the electronic device is in a first main and second level scenario, the first main and second level event including an event in which the electronic device runs a focus application when no first level event is detected; predicting the first main and second level scenario based on a power prediction model to obtain a first prediction result, the first prediction result including the maximum power that can be supplied by multiple CPUs, and the corresponding probability of impaired user experience when the multiple CPUs are respectively operated at the maximum power that can be supplied by the first main and second level scenarios, the probability of impaired user experience being the probability that the proportion of lag time when the CPU is operated at the maximum power that can be supplied by the CPU is greater than a first threshold; adjusting the maximum power that can be supplied by the CPU of the electronic device according to a first optimal power, the first optimal power being determined by the minimum power that meets the first condition in the first prediction result, the first condition being that the probability of impaired user experience is less than or equal to the second threshold.

[0009] In this method, the first primary secondary scenario can be any primary secondary scenario, the primary secondary scenario including an event in which the electronic device runs a focus application without detecting a primary event. The first optimal power can be the minimum power in the first prediction result that meets the first condition.

[0010] In this method, the electronic device can adjust the maximum power that the CPU can supply to different power values ​​for different operating scenarios. It should be understood that different operating scenarios have different performance requirements for electronic devices. For example, under the same conditions, the performance requirements of the electronic device may be higher when the user is watching a video than when not watching a video. For another example, the performance requirements of the electronic device may be higher when multiple external devices are connected than when no external devices are connected.

[0011] Among these scenarios, the secondary scenario is an operating scenario with lower performance requirements for electronic devices. When the electronic device does not detect a primary event, it can be considered that the electronic device has entered the secondary scenario. Since the focus application is the scene with the highest user attention, in this method, the electronic device can give priority to the performance requirements of the main secondary scene related to the focus application in the secondary scene. In this method, the electronic device can uniquely determine a main secondary scene through these parameters related to performance requirements (hereinafter referred to as main secondary scene parameters). These parameters may include the focus application, the size of the focus application window, the memory usage of the focus application, whether to watch videos, download speed, whether to use a camera, whether to play audio, external device type, whether to use a keyboard, device screen brightness, device available memory RAM, integrated graphics load rate, independent graphics load rate, hard disk write speed, and one or more of them, and may also include other parameters, which are not limited in this application.

[0012] When the electronic device is in any main-secondary scene (for example, the first main-secondary scene), the electronic device can use the above-mentioned power prediction model to predict the main-secondary scene and obtain a prediction result. Specifically, the electronic device can obtain the main-secondary scene parameters of the main-secondary scene in which it is located as the input of the above-mentioned power prediction model, and the power prediction model can output a corresponding prediction result, which includes the probability that the proportion of the freezing time corresponding to the maximum power supply of each CPU when the electronic device is running at the maximum power supply of the multiple CPUs is greater than the first threshold (that is, in the main-secondary scene, the probability that the user experience will be affected when the maximum power supply of each CPU is running). Afterwards, the electronic device can further obtain the optimal power of the main-secondary scene based on the prediction result, and the optimal power is determined by the minimum power of the maximum power supply of the CPU that meets the first condition in the prediction result, and the first condition is that the probability of impaired user experience is less than or equal to the second threshold.

[0013] It can be understood that the greater the proportion of lag time when running at the maximum power that a CPU can supply in a scenario, the less the performance provided by the maximum power that the CPU can supply can meet the performance requirements of the scenario. When the proportion of lag time is greater than a threshold (i.e., the first threshold), the user experience will be damaged. Therefore, after obtaining the first prediction result, the electronic device can use the second threshold to determine the maximum power that can be supplied by the CPU in the first prediction result that will cause damage to the user experience (i.e., meet the first condition). The first optimal power is the minimum maximum power that can be supplied by the CPU that meets the first condition. Since the smaller the CPU maximum power supply performance, the smaller the CPU performance supply will be, and the power consumption of the electronic device will be correspondingly lower, the first optimal power is the maximum power that can be supplied by the CPU among the multiple maximum power supplies of the CPU that will not cause damage to the user experience and has the lowest power consumption for the electronic device. Probability of impaired user experience

[0014] Optionally, the first threshold may be 0.03, and the second threshold may be 0.5.

[0015] Optionally, the power prediction model can be a binary classification model, specifically a logistic regression model, a decision tree model, a random forest model, a neural network model, a GBDT model, an XGboost model, a LightGBM model, or other types of models, which are not limited in this application.

[0016] Optionally, the electronic device may execute this method only when it is not charging. Specifically, the electronic device may adjust the maximum CPU power supply in the primary and secondary scenarios based on the power prediction model only when it is not charging. Because the electronic device has sufficient power supply when charging, the electronic device does not need to adjust the maximum CPU power supply based on the operating scenario. Instead, the maximum CPU power supply is always maintained at the maximum power, prioritizing the performance requirements of the electronic device.

[0017] In combination with the first aspect, in a possible implementation, after adjusting the maximum supply power of the CPU of the electronic device according to the first optimal power, the method further includes: detecting a level one event, determining that the scene in which the electronic device is located is switched from the first main-secondary scene to the level one scene, and the level one scene includes an operating scene in which the electronic device detects an interactive event; and adjusting the maximum supply power of the CPU of the electronic device to the maximum power.

[0018] In this embodiment, the first-level events may include: 1. Interaction events between users and electronic devices. For example, the user clicks the mouse button, scrolls the mouse wheel (but does not include the operation of moving the mouse cursor), the user uses the keyboard shortcut key operation (the shortcut key can include the keyboard Ctrl key, Win key, Shift key, Alt key, Esc key, F1-F12 key, Fn key, Enter key, PrtSc key, PgUp key, PgDn key, etc., and can also include other shortcut keys, as well as shortcut keys obtained by combining multiple shortcut keys among these shortcut keys), the user switches the focus application operation, etc. 2. High load events of electronic devices. For example, the event that the CPU of an electronic device is in a high load state, the event that the electronic device enters game mode, etc.

[0019] When a Level 1 event occurs, the electronic device is in a Level 1 scenario. Because Level 1 events place higher performance demands on electronic devices, in a Level 1 scenario, the electronic device will directly adjust the maximum power available from the CPU to the maximum power to ensure 100% performance of the electronic device.

[0020] In combination with the first aspect, in a possible embodiment, after adjusting the maximum supply power of the CPU of the electronic device according to the first optimal power, the method also includes: detecting a second main-secondary event, determining that the scene in which the electronic device is located is switched from the first main-secondary scene to the second main-secondary scene, and the second main-secondary scene is different from the first main-secondary scene; predicting the second main-secondary scene based on the power prediction model to obtain a second prediction result, the second prediction result including the maximum supply power of the multiple CPUs and the corresponding probability of damage to the user experience when the multiple CPUs are operated separately at the maximum supply power under the second main-secondary scene; adjusting the maximum supply power of the CPU of the electronic device according to the second optimal power, the second optimal power being determined by the minimum power that meets the first condition in the second prediction result.

[0021] Optionally, the second optimal power may be the minimum power in the second prediction result that meets the first condition.

[0022] Combined with the above description, it can be seen that the electronic device can uniquely determine a main secondary scene through the main secondary scene parameters. When any of the main secondary scene parameters corresponding to the current main secondary scene changes, the electronic device can determine to switch from the current main secondary scene (i.e., the first main secondary scene) to another new main secondary scene (i.e., the second main secondary scene). At this time, the electronic device can determine the optimal power of the new main secondary scene based on the above-mentioned power prediction model, and can adjust the maximum power that the CPU can supply to the optimal power of the new main secondary scene.

[0023] In combination with the first aspect, in a possible embodiment, before adjusting the maximum power that can be supplied by the CPU of the electronic device according to the first optimal power, the method also includes: detecting a first auxiliary-secondary event, determining that the electronic device is in a first auxiliary-secondary scenario, the first auxiliary-secondary event including an operating scenario related to a background application when no interactive event is detected; predicting the first auxiliary-secondary scenario based on the power prediction model to obtain a second prediction result, the second prediction result including the maximum power that can be supplied by the multiple CPUs, and the corresponding probability of impaired user experience when the multiple CPUs are operated at the maximum power that can be supplied in the first auxiliary-secondary scenario; adjusting the maximum power that can be supplied by the CPU of the electronic device according to the first optimal power includes: adjusting the maximum power that can be supplied by the CPU of the electronic device to the maximum power between the first optimal power and the first optimal power, the first optimal power being determined by the minimum power that meets the first condition in the third prediction result.

[0024] Optionally, the first optimal power may be the minimum power in the third prediction result that meets the first condition.

[0025] Understandably, when using an electronic device like a computer, users may open multiple applications simultaneously, including both the focus application and background applications. Therefore, during operation, the electronic device must meet not only the performance requirements of the focus application but also those of background applications. In some cases, the performance requirements of background applications can even be higher than those of the focus application.

[0026] It can be understood that a primary secondary scene and an auxiliary secondary scene can coexist in a secondary scene. In this embodiment, in the same secondary scene, the auxiliary secondary scene parameters of the auxiliary secondary scene and the main secondary scene parameters of the main secondary scene are different only in three parameters: application, application window size, and application memory usage, while the remaining parameters are the same, and the focus application and the background application can be converted to each other. Therefore, the auxiliary secondary scene parameters of the auxiliary secondary scene can also be used as the input of the above-mentioned power prediction model, and the power prediction model outputs the probability of impaired user experience corresponding to each power in the auxiliary secondary scene, and then the electronic device further determines the suboptimal power of the auxiliary secondary scene.

[0027] Therefore, in this embodiment, the electronic device can also determine an optimal power corresponding to the first main secondary scene in the currently described secondary scene based on the power prediction model, and determine the first optimal power of the first auxiliary secondary scene in the currently described secondary scene based on the power prediction model, and determine the maximum power of the first optimal power and the first optimal power of the first auxiliary secondary scene as the optimal power of the secondary scene, while meeting the performance requirements of the focus application, further meeting the performance requirements of the background application.

[0028] Optionally, the background application corresponding to the first auxiliary and second-level scenarios is an application with a higher CPU load other than the focus application.

[0029] Optionally, the electronic device may have multiple background applications, and therefore the electronic device may also have multiple auxiliary secondary scenarios. Therefore, the electronic device may obtain the suboptimal power of multiple auxiliary secondary scenarios including the first auxiliary secondary scenario based on the power prediction model, and determine the maximum CPU maximum supply power among the first optimal power and the multiple suboptimal powers of the multiple auxiliary secondary scenarios as the power of the secondary scenario.

[0030] In combination with the first aspect, in a possible embodiment, before the electronic device is detected to be in the first main-secondary scenario, the method also includes: obtaining a training data set based on a valid data set; the training data set includes training data of multiple main-secondary scenarios, and the main-secondary scenarios include scenarios related to the focus application when the electronic device does not detect an interaction event, and the training data include label values ​​corresponding to the maximum power that can be supplied by each CPU in the main-secondary scenario, and the label values ​​include a first label value and a second label value, the first label value represents that the probability of the electronic device being stuck when running at the corresponding power is less than or equal to the first threshold, and the second label value represents that the probability of the electronic device being stuck when running at the corresponding power is greater than the first threshold; the power prediction model is trained according to the training data set.

[0031] In this embodiment, the valid data in the valid data set actually records the running time and the freezing time of the electronic device when it runs at the maximum power that can be supplied by the multiple CPUs in each main and secondary scenario. It should be understood that in some main and secondary scenarios, freezing may occur even if the electronic device runs at the highest power gear. Therefore, for any main and secondary scenario, when the electronic device runs at a certain power, it does not mean that the user experience is impaired as long as the electronic device freezes. It still needs to be determined based on the probability of the electronic device freezing when running at this power. This probability can be reflected by the proportion of freezing time when the electronic device runs at this power. Therefore, in this embodiment, the electronic device needs to first determine whether the user experience is impaired based on the proportion of freezing time at each power gear for each main and secondary scenario. Specifically, the electronic device can set a damage threshold (i.e., the first threshold) and compare the proportion of the freeze time corresponding to each power in each main and secondary scenarios in the valid data with the damage threshold - if the proportion of the freeze time corresponding to a certain power level is less than or equal to the above-mentioned damage threshold, it means that the user experience of running at this power level is not impaired, and the electronic device can update the numerical value corresponding to the power level (i.e., the proportion of freeze time, the same below) to the second label value; conversely, if the proportion of the freeze time corresponding to a certain power level is greater than the above-mentioned damage threshold, it means that the user experience is impaired when running at this power level, and the electronic device can update the numerical value corresponding to the power level to the first label value.

[0032] In combination with the first aspect, in one possible embodiment, the valid data set includes valid data of multiple main and secondary scenarios, and the valid data includes the operating time and the freeze time of the electronic device running at multiple different CPU maximum power supplies in the main and secondary scenarios; obtaining the training data set based on the valid data set includes: determining the freeze time ratio of the electronic device running at multiple different CPU maximum power supplies in the valid data, and the freeze time ratio is the ratio of the freeze time to the operating time; when the freeze time ratio is less than or equal to the first threshold, the label value of the corresponding CPU maximum power supply in the valid data is determined as the first label value; when the freeze time ratio is greater than the first threshold, the label value of the CPU maximum power supply corresponding to the valid data is determined as the second label value.

[0033] Therefore, in this embodiment, the electronic device can map the non-numeric data in the valid data into a numerical encoding operation, that is, create a mapping table to store the mapping relationship between discrete feature values ​​and custom numerical values, ensuring that the electronic device can correctly read the characteristics of the discrete values ​​recorded in the valid data.

[0034] In combination with the first aspect, in a possible embodiment, before obtaining the training data set based on the valid data set, the method also includes: in the first main and secondary scenarios, operating with the maximum power that can be supplied by the CPU as the first power; when the duration of operation at the first power reaches a first duration and no lag occurs, adjusting the maximum supply power of the CPU to a second power; the first power and the second power are included in the multiple different maximum power that can be supplied by the CPU, the second power is less than the first power, the valid data set includes valid data of the first main and secondary scenarios, and the valid data of the first main and secondary scenarios includes the operating duration and lag duration of operation at the first power.

[0035] It should be understood that when an electronic device is running at the maximum power that a CPU can supply in a main-secondary scenario, the smoother the electronic device runs (i.e., the less freezes occur), the more the performance provided by the maximum power that the CPU can supply can meet the performance requirements of the main-secondary scenario. This also means that the performance provided by the electronic device may have a large amount of surplus performance after the performance requirements of the main-secondary scenario. In this case, the electronic device can appropriately reduce the maximum power that the CPU can supply to reduce the performance of the electronic device and further reduce the power consumption of the electronic device. Therefore, in this embodiment, when the electronic device is running at the maximum power that the CPU can supply as the first power, when the duration of running at the first power reaches the first duration and no freezes occur, the electronic device can first save the total duration of this operation at the first power (i.e., the first duration) and the freeze duration (i.e., the freeze duration with a duration of 0), and reduce the maximum power supply of the CPU to the second power. Optionally, the electronic device can gradually reduce the maximum power that the CPU can supply from high to low.

[0036] In this way, the maximum power that can be supplied by the CPU of the electronic device can be quickly adjusted to the optimal power of the first main-secondary scenario, and it can be operated with as many different maximum power that can be supplied by the CPU as possible within a limited time, so that the effective data of the first main-secondary scenario is richer, and the optimal power of the first main-secondary scenario determined based on the effective data of the first main-secondary scenario is also more accurate.

[0037] In combination with the first aspect, in a possible embodiment, the method also includes: when the duration of operation at the first power does not reach the first duration and a freeze occurs, adjusting the maximum supplyable power of the CPU to a third power; the third power is included in the multiple different maximum supplyable powers of the CPU, the third power is greater than the first power, and the valid data of the first main-secondary scenario includes the operating duration and freeze duration of operation at the first power and the third power.

[0038] In this embodiment, when a jam occurs, the electronic device will raise the power gear by one gear, which can effectively avoid the influence of the randomness of the data on the accuracy of the result. Taking the above-mentioned first duration of 30s as an example, assuming that the probability of jamming when the electronic device runs at the first power in the first main and secondary scenarios is very small, actually 0.05, but when running at the first power, the electronic device runs for 30s and jams for 3s (a low probability event occurs). If the power is simply continued to be lowered, the total running time and total jam duration corresponding to the first power will no longer be updated. Therefore, the proportion of jam duration corresponding to the first power calculated by the electronic device is 3 / 30=0.1, which is twice the actual jam probability. However, if the power is raised to the third power, the probability of jamming when the electronic device runs at the third power in the first main and secondary scenarios is even smaller, and there is a high probability that jamming will not occur within 30s. Therefore, after 30s, the electronic device will lower the power back to the first power. Since the probability of the electronic device freezing when running at the first power in the first primary and secondary scenarios is very small, there is a high probability that the electronic device will not freeze within 30 seconds when running at the first power again. The total running time and total freezing time corresponding to the first power will be updated to 60 seconds and 3 seconds respectively. The freezing time ratio corresponding to the first power is calculated as 3 / 60 = 0.05, which is closer to the actual freezing probability corresponding to the first power, thereby reducing or even avoiding the impact of randomness of the data on the accuracy of the results.

[0039] In combination with the first aspect, in a possible embodiment, the method also includes: detecting a third main-secondary event when operating at the first power in the first main-secondary scenario, determining that the scenario in which the electronic device is located is switched from the first main-secondary scenario to the third main-secondary scenario, and the third main-secondary scenario is different from the first main-secondary scenario; saving the exploration progress of the first main-secondary scenario as the first power, and the exploration progress is the maximum power that can be supplied by the CPU used by the electronic device when it enters the corresponding operating scenario next time; determining the exploration progress of the third main-secondary scenario, and adjusting the maximum power that can be supplied by the CPU of the electronic device to the power corresponding to the exploration progress of the third main-secondary scenario, and the valid data set also includes valid data of the third main-secondary scenario.

[0040] It is understandable that during the actual operation of the electronic device, the operating scenario in which the electronic device is located may change at any time. Therefore, when operating at the first power in the first main secondary scenario, if the electronic device has not run for a long enough time, that is, the electronic device has not been able to operate at enough CPU maximum power supply in the first main secondary scenario, the main secondary scenario in which the electronic device is located will change from the first main secondary scenario to another main secondary scenario, and the electronic device will save the running time and the jamming time of this operation at the first power, and record the power exploration progress (that is, the first power) in the first main secondary scenario, so that when the main secondary scene of the electronic device changes to the first main secondary scene again, the electronic device can start from the first power and continue to gradually reduce the maximum CPU power supply from high to low, and collect the running time and jamming time corresponding to each power in the first main secondary scenario. Correspondingly, the power exploration progress in the second main-secondary scene is also recorded when the electronic device switches from the second main-secondary scene to other scenes for the last time (if it is the first time entering the second main-secondary scene, the default power exploration progress is the maximum power). Therefore, after the electronic device enters the second main-secondary scene, it will start from the second main-secondary scene power exploration progress, and gradually reduce the maximum power that the CPU can supply from high to low, and collect the running time and freeze time corresponding to each power in the second main-secondary scene.

[0041] In combination with the first aspect, in one possible implementation, the valid data of the first main-secondary scenario includes, when the total operating time of the electronic device in the first main-secondary scenario reaches a second operating time, the operating time and lag time of the multiple different CPUs running at the maximum power that can be supplied during the second operating time.

[0042] The valid data of the first main-secondary scene includes the running time and the freezing time of the electronic device running at the maximum power supply of the multiple different CPUs in the second time when the total running time of the electronic device in the first main-secondary scene reaches the second time. In order to avoid endless adjustment of the maximum power supply of the CPU in a main-secondary scene, in this embodiment, for any main-secondary scene, when the total running time of the electronic device in the main-secondary scene reaches the second time, it can be regarded as that the electronic device has basically been able to determine the optimal power of the main-secondary scene through the data obtained in the main-secondary scene. At this time, the original data corresponding to the main-secondary scene is valid data, and the main-secondary scene can be called a valid main-secondary scene.

[0043] It is understandable that for a valid primary / secondary scenario that has acquired valid data, the electronic device does not necessarily need to operate at all selectable maximum CPU power supplies in that primary / secondary scenario. For example, assuming that in the first primary / secondary scenario, the electronic device freezes each time it operates at the first power, and in some embodiments, the electronic device needs to increase power when freezing occurs, it is likely that even after the total operating time of the electronic device in the first primary / secondary scenario reaches the second time, the electronic device will not be operating at a maximum CPU power supply lower than the first power. However, since the electronic device freezes every time it runs at the first power in the first main-secondary scenario, it is highly likely that when the electronic device runs at the maximum CPU power supply lower than the first power in the first main-secondary scenario, it will also freeze frequently. That is, running at the first power or the maximum CPU power supply lower than the first power in the first main-secondary scenario will seriously damage the user experience. The first power or the maximum CPU power supply lower than the first power is highly likely not the optimal power for the first main-secondary scenario. Therefore, it is not important whether the electronic device has run at the first power or the maximum CPU power supply lower than the first power in the first main-secondary scenario and obtained the corresponding running time and freezing time. During the model training process, the electronic device can set the label value of the gear with empty information in the valid data to "0", which means that running at these gears will cause the user experience to be damaged.

[0044] With reference to the first aspect, in one possible implementation, the first duration is 30 seconds, and / or the second duration is 600 seconds.

[0045] In combination with the first aspect, in one possible implementation, the amount of operating data in the training data set is greater than a third threshold.

[0046] It should be understood that the amount of data required for model training is very large. Therefore, in this embodiment, the electronic device will train the power prediction model based on the collected valid data only when the number of valid data in the valid data set is greater than or equal to X. Specifically, the above X can be set to 50,000, 100,000, or other values, which can be specifically set based on the performance requirements of the above power prediction model, and this application does not impose any restrictions on this.

[0047] Optionally, since the model training process places great demands on the performance and power consumption of the device. Therefore, after obtaining the above-mentioned training data set, the electronic device can train the above-mentioned power prediction model when it is charging and the screen is off (but the electronic device is still on). It can be understood that the power of the electronic device can always be sufficient when charging, and can provide enough power for the model training process. When the screen is off, the electronic device can reduce the consumption of electronic device performance and power by other processes and applications as much as possible, so the electronic device can provide more power and performance for the model training process. And when the screen is off, it means that the user is not using the electronic device at this moment, so even if the model training process consumes most of the performance of the electronic device, it will not cause damage to the user experience.

[0048] In combination with the first aspect, in a possible implementation, the adjusting the maximum supply power of the CPU of the electronic device according to the optimal power includes: adjusting the maximum supply power of the CPU of the electronic device to the optimal power; or adjusting the maximum supply power of the CPU of the electronic device to the target power, the target power being the maximum supply power of the CPU among the optimal power, the fourth power and the fifth power, the fourth power being less than the target power, the fifth power being greater than the target power, the fourth power and the fifth power belonging to the multiple different maximum supply powers of the CPU, and the difference between the optimal power and the fourth power, and the difference between the optimal power and the fifth power are both less than a fourth threshold.

[0049] It is understandable that the application APPs in electronic devices will be constantly updated, so the performance requirements of these applications for electronic devices may also change with the version update, and the degree of change in their performance requirements will generally not change too much at one time. Therefore, in this embodiment, after determining the first optimal power of the first main and secondary scenarios based on the prediction model, the electronic device can adjust the gear of the maximum power that the CPU can supply to any one of the first optimal power, a power slightly higher than the first optimal power (i.e., the fifth power), and a power slightly lower than the first optimal power (i.e., the fourth power) to adapt to the changes in the performance requirements of the operating scenario caused by the application APP update.

[0050] In combination with the first aspect, in a possible implementation, after adjusting the maximum CPU supply power of the electronic device according to the optimal power, the method further includes: collecting feedback data, the feedback data including the operating time and the lag time of running at the adjusted maximum CPU supply power; updating the power prediction model according to the feedback data.

[0051] In this embodiment, the feedback data may include the operating time and freezing time of the electronic device at the last adjusted power level. The electronic device may update the valid data corresponding to the first primary and secondary scenarios based on the acquired feedback data, and update the power prediction model based on the updated valid data. That is, the new prediction model is trained using the updated valid data, so that the power prediction model can maintain the accuracy of the prediction results even when the application app is continuously updated.

[0052] In a second aspect, an embodiment of the present application provides an electronic device, comprising: one or more processors and a memory; the memory is coupled to the one or more processors, the memory is used to store computer program code, the computer program code includes computer instructions, and the one or more processors call the computer instructions to enable the electronic device to execute the method in the first aspect or any possible implementation of the first aspect.

[0053] In a third aspect, a chip system is provided, which is applied to an electronic device, and the chip system includes one or more processors, and the processors are used to call computer instructions to enable the electronic device to execute the method in the first aspect or any possible implementation of the first aspect.

[0054] In a fourth aspect, a computer program product comprising instructions, when the computer program product is run on an electronic device, enables the electronic device to execute the method in the first aspect or any possible implementation of the first aspect.

[0055] In a fifth aspect, a computer-readable storage medium is provided, comprising instructions. When the instructions are executed on an electronic device, the electronic device executes the method in the first aspect or any possible implementation of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0056] FIG1 is a user interface diagram of an electronic device running a primary scenario and a secondary scenario provided by an embodiment of the present application;

[0057] FIG2 is a flow chart of a power adjustment method provided in an embodiment of the present application;

[0058] FIG3 is a schematic diagram of a training process of a prediction model provided in an embodiment of the present application;

[0059] FIG4 is a schematic diagram of a process of preprocessing valid data by an electronic device provided in an embodiment of the present application;

[0060] FIG5 is a logic diagram of adjusting device performance in a level 1 scenario provided by an embodiment of the present application;

[0061] FIG6 is a logic diagram of adjusting device performance in a secondary scenario provided by an embodiment of the present application;

[0062] FIG7 is a schematic diagram of data changes during a power prediction model prediction process provided by an embodiment of the present application;

[0063] FIG8 is a user interface diagram of an electronic device operation scenario provided by an embodiment of the present application;

[0064] FIG9 is a schematic diagram of dividing data intervals according to an embodiment of the present application;

[0065] FIG10 is a flow chart of a power adjustment method provided in an embodiment of the present application;

[0066] FIG11 is a schematic diagram of determining the optimal power of a secondary scene based on primary and auxiliary secondary scenes according to an embodiment of the present application;

[0067] FIG12 is a logic diagram of a power adjustment method provided in an embodiment of the present application;

[0068] FIG13 is a schematic diagram of a process in which an electronic device explores gear positions in primary and secondary scenarios during a cold start phase according to an embodiment of the present application;

[0069] FIG14 is a schematic diagram showing raw data in an electronic device during a statistical phase, provided by an embodiment of the present application;

[0070] FIG15 is a logical architecture diagram of a power prediction method provided in an embodiment of the present application;

[0071] FIG16 is a diagram of a system architecture provided in an embodiment of the present application;

[0072] FIG17 is a structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0073] The terms used in the following examples of the present application are for the purpose of describing specific embodiments only and are not intended to limit the present application. As used in the specification and appended claims of the present application, the singular expressions "a," "an," "said," "above," "the," and "this" are intended to include plural expressions as well, unless the context clearly indicates otherwise. It should also be understood that the term "and / or" used in the present application refers to and encompasses any or all possible combinations of one or more of the listed items.

[0074] To facilitate understanding, the following first introduces the relevant terms involved in the embodiments of this application.

[0075] (1) Performance and power consumption of electronic equipment

[0076] Performance refers to the properties and functions of a substance. For electronic devices such as computers and tablets, the most important evaluation indicator is the computing speed of the electronic device, that is, the number of instructions that the electronic device can execute per second, which is generally described as "millions of instructions per second". Understandably, the computing speed of an electronic device will be further reflected in the dimensions of whether the electronic device runs smoothly and whether there is obvious lag. Therefore, in this application, the performance of an electronic device can be evaluated based on the lag frequency during its operation (that is, the proportion of the time when the electronic device is stuck in a period of time). The smaller the lag frequency, the better the performance of the electronic device, and vice versa.

[0077] Power consumption refers to the amount of energy consumed by an electronic device per unit time. For electronic devices, power consumption specifically refers to the amount of electrical energy consumed per unit time, measured in watts. Even in standby mode, electronic devices still consume a certain amount of energy (unless the power is turned off, in which case they stop consuming energy).

[0078] For electronic devices such as desktop computers and laptops, the CPU serves as the computing and control core of the system. The maximum power that the CPU can supply (i.e., PowerLimit-1) and the maximum operating frequency that the CPU can operate at (i.e., MaxFrequency) are closely related to the power consumption of the electronic device. It should be noted that "maximum power that the CPU can supply" and "maximum operating frequency of the CPU" refer to the maximum values ​​that the CPU power and operating frequency can provide, respectively. During the operation of an electronic device, the CPU generally does not always operate at the power or operating frequency corresponding to these maximum values. Its actual operating power and operating frequency are generally related to the current operating environment of the electronic device. The more applications the electronic device runs simultaneously, the greater the actual CPU operating power and operating frequency will be, but will not exceed the maximum values ​​corresponding to the maximum power that the CPU can supply and the maximum operating frequency of the CPU.

[0079] Taking the maximum power supply of the CPU as an example, when the maximum power supply of the CPU is set to 45W, the actual operating power of the CPU may be 20W in a certain operating scenario, and may reach the upper limit of 45W in another operating scenario, but will not exceed 45W. In addition, the maximum power supply of the CPU and the maximum operating frequency of the CPU are both adjustable, but there is also an upper limit to the adjustment range. This upper limit is set when the electronic device leaves the factory and is related to the hardware performance of the CPU, CPU heat sink, etc. Taking the maximum power supply of the CPU as an example, when the adjustable upper limit of the maximum power supply of the electronic device's CPU is 45W, the electronic device can set the maximum power supply of the CPU to values ​​such as 45W, 40W, 30W, etc., but cannot be set to 50W.

[0080] Furthermore, the CPU's maximum power supply and maximum operating frequency also, to a certain extent, determine the upper limit of an electronic device's performance. Again, using the CPU's maximum power supply as an example, generally speaking, for microprocessors of the same family, the greater the CPU's maximum power supply, the higher the maximum operating speed the electronic device can support. In some scenarios, reducing the CPU's maximum power supply can reduce the electronic device's power consumption at the expense of performance. For example, in a certain operating scenario, the CPU's maximum power supply is 45W, while the CPU's actual power consumption is 25W. However, the gap between the electronic device's actual CPU power and the CPU's maximum power supply remains significant, indicating that the CPU's power in this scenario is unlikely to reach the upper limit of 45W. Therefore, the CPU's maximum power supply does not limit the CPU's actual power consumption. It should be understood that when the CPU's actual power consumption is 25W, the performance it provides is the maximum performance required for that operating scenario. If the CPU's actual power consumption is adjusted to 15W, the performance provided by the CPU may not meet the maximum performance requirements for that operating scenario, but it will still provide sufficient performance to ensure a satisfactory user experience. For example, assuming that when the actual power of the CPU is 25W, the response time of the electronic device to a certain instruction in this operating scenario is 50ms. When the actual power of the CPU is 15W, the response time of the electronic device to the same instruction in this operating scenario is extended to 100ms. Although the response speed of the electronic device to the instruction has indeed slowed down, for the user, the difference between 100ms and 50ms is difficult to perceive.

[0081] Therefore, in some scenarios, if the actual CPU power can be limited to an appropriate range or value by adjusting the CPU's maximum power supply, then the electronic device can reduce power consumption at the expense of some performance without affecting the user experience. However, combined with the above description, it can be seen that the performance and power consumption of electronic devices cannot be balanced. Therefore, if the performance is sacrificed too much, the electronic device will frequently freeze, and the user experience will be seriously impaired. Therefore, how to adjust the CPU's maximum power supply to an appropriate value to minimize the power consumption of the electronic device while ensuring that the performance meets user needs is the key issue to be addressed in this application.

[0082] In this application, electronic devices can reduce device power consumption without compromising user experience by adjusting the maximum CPU power supply or the maximum CPU operating frequency. For ease of explanation, the following embodiments will use the adjustment of the maximum CPU power supply as an example.

[0083] (2) Focus application and background application

[0084] For electronic devices such as computers, users may open multiple applications at the same time when using them, and multiple application interfaces may be displayed on the display screen of the electronic device (some interfaces may be minimized in the information status bar), but the user generally only has one application that is operated by the mouse or keyboard. Of course, even if the user does not operate the electronic device with devices such as a mouse or keyboard, there will always be an application interface (application window) that is displayed at the top of the display screen. For example, when a user is watching a video on an electronic device, he or she may not operate the electronic device, but the interface of the application used to play the video will generally be displayed at the top of the interface.

[0085] In the embodiments of the present application, the application or application interface that the user is currently operating with the mouse or keyboard and that is displayed on top of the display screen can be referred to as the "focus application." In addition to the focus application, other applications open on the electronic device can be referred to as "background applications." It is understood that the focus application and background applications can be switched. For example, a user can click on the application interface of a background application to make the application interface of the background application appear on top. At this point, the background application is switched to the focus application, and the original focus application also becomes a background application.

[0086] (3) Primary scenario and secondary scenario

[0087] Level 1 scenarios include operating scenarios that have high performance requirements for electronic devices. When an electronic device detects a level 1 event, it is considered that the electronic device has entered a level 1 scenario. Level 1 events may include any one or more of the following: 1. Interaction events between users and electronic devices. For example, the user clicks the mouse button or scrolls the mouse wheel (but does not include the operation of moving the mouse cursor), the user uses the keyboard shortcut keys (shortcut keys may include the keyboard's Ctrl key, Win key, Shift key, Alt key, Esc key, F1-F12 key, Fn key, Enter key, PrtSc key, PgUp key, PgDn key, etc., and may also include other shortcut keys, as well as shortcut keys obtained by combining multiple shortcut keys among these shortcut keys), the user switches the focus application, etc. 2. High-load events of electronic devices. For example, events in which the CPU of an electronic device is in a high-load state, events in which an electronic device enters game mode, etc.

[0088] The second level scenario includes operating scenarios with lower performance requirements for electronic devices. When an electronic device does not detect a first level event, it is considered to have entered the second level scenario.

[0089] Secondary scenarios can include the following two categories:

[0090] 1. Main secondary scene.

[0091] When the electronic device detects a primary secondary event, it is considered that the electronic device has entered the primary secondary scene. A primary secondary event is an event in which the electronic device runs a focus application without detecting a primary event.

[0092] In the main-secondary scenario, the parameters that reflect the performance requirements of the electronic device in the current main-secondary scenario (hereinafter referred to as the main-secondary scenario parameters) may include any one or more of the following: focus application, the size of the focus application window, the memory usage of the focus application, whether watching videos, download speed, whether using a camera, whether playing audio, external device type, whether using a keyboard, device screen brightness, device available memory RAM, integrated graphics load rate, independent graphics load rate, and hard disk write speed.

[0093] In some embodiments, when no primary event is detected, when any one or more of the primary and secondary scene parameters change, it is considered that a switch from one primary and secondary scene to another is made.

[0094] In other embodiments, since parameters such as the focus application window size, focus application memory usage, download speed, screen brightness, RAM, integrated graphics card load rate, discrete graphics card load rate, and hard disk write speed may change frequently during the operation of the electronic device, a switch from one primary-secondary scene to another can be considered only when any one or more of these parameters change by a certain amount. In other words, when the primary-secondary scene parameters of the electronic device change within a certain range, the electronic device can be considered to be in the same primary-secondary scene.

[0095] 2. Auxiliary secondary scene.

[0096] When an electronic device detects an auxiliary level 2 event, it is considered that the electronic device has entered an auxiliary level 2 scene. An auxiliary level 2 event is an event in which a background application is running on the electronic device without detecting a level 1 event.

[0097] Similarly, in the auxiliary secondary scenario, the parameters that reflect the performance requirements of the electronic device in the current auxiliary secondary scenario (hereinafter referred to as auxiliary secondary scenario parameters) may include any one or more of the following: background applications, the size of the background application window, the memory usage of the background application, whether to watch videos, download speed, whether to use the camera, whether to play audio, the type of external device, whether to use the keyboard, the device screen brightness, the device memory RAM, the integrated graphics load rate, the independent graphics load rate, and the hard disk write speed.

[0098] Based on the above definition, it's impossible for both a primary and secondary scene to appear at the same time, but it's possible for a primary and secondary scene to exist simultaneously. Typically, since there's only one focused application at a time, but multiple background applications can exist, there's only one primary and secondary scene at a time, while there can be multiple secondary scenes.

[0099] In the present application, since the first-level scenario has higher performance requirements for electronic devices, when the electronic device is in the first-level scenario, that is, when a first-level event occurs in the electronic device, the electronic device can adjust the maximum power that can be supplied by the CPU to a certain power value, and the difference between this power value and the maximum value of the maximum power that can be supplied by the CPU that the electronic device can provide is less than a threshold. Preferably, when the electronic device is in the first-level scenario, the electronic device can adjust the maximum power that can be supplied by the CPU to the maximum value of the maximum power that can be supplied by the CPU that the electronic device can provide. When the electronic device is in the second-level scenario, the electronic device can adjust the maximum power that can be supplied by the CPU by taking into account both performance and power consumption. For the specific adjustment method, refer to the subsequent method embodiments.

[0100] (4) The maximum power supply position of the CPU

[0101] In the present application, the maximum power that can be supplied by the CPU of the electronic device can be discretized into different gears.

[0102] Combined with the above description, it can be seen that the maximum power supply of the CPU of an electronic device has an adjustment upper limit, which is determined when the electronic device leaves the factory. Here, assuming that the power value corresponding to this upper limit is PL1max, the corresponding power gear can be set for the maximum power supply of the CPU based on this power value PL1max. For details, please refer to the example in the table below:

[0103] Table 1

[0104] As can be seen from Table 1, Pm is the maximum gear corresponding to the maximum power that the CPU can supply; accordingly, the values ​​corresponding to different percentages of Pm can be set as different gears of the maximum power that the CPU can supply. The larger the value of the power gear, the greater the power corresponding to the power gear. For example, the maximum power that the CPU can supply corresponding to gear 9 is greater than the maximum power that the CPU can supply corresponding to gear 8. In order to ensure the normal operation of electronic equipment, the gear of the maximum power that the CPU can supply generally cannot be adjusted to gear 1, and can only be adjusted to gear 2 at the lowest (for some specific secondary scenarios with low performance requirements). Table 1 is only an example. In specific implementations, the power gear can also be set in other ways. For example, more or fewer power gears can be set compared to Table 1.

[0105] (5) Optimal power

[0106] Different CPUs have different maximum power supplies, providing different performance to electronic devices and consuming different amounts of electrical energy.

[0107] In this application, for a secondary scenario, the power value with the lowest power consumption among all power values ​​without affecting the user experience is the optimal power for the secondary scenario. Specifically, whether a certain power value affects the user experience can be determined based on the probability of the electronic device being stuck when running at this power value in the secondary scenario. When the probability of the electronic device being stuck is greater than a certain threshold (for example, 3%), it can be considered that the gear has affected the user experience in the secondary scenario.

[0108] In some implementations, the maximum power supply of the CPU can be discretized into different gears. Without affecting the user experience, the power gear with the lowest power consumption among all power value gears is the optimal power gear for the secondary scenario. When adjusting power, adjusting the power to the optimal power gear for the secondary scenario according to the gear can make the adjustment process of the electronic device more convenient and efficient.

[0109] The following embodiments all use power gears as an example to illustrate the process of adjusting the power of an electronic device to the optimal power. For how to determine the optimal power in a secondary scenario, please refer to the following method embodiments.

[0110] (6) Lightweight Gradient Boosting Machine Model

[0111] The light gradient boosting machine (LightGBM) model can be regarded as a gradient boosting framework. It uses decision trees as base learners and is an optimized model based on the XGBoost model.

[0112] For most binary classification models, the data set required for training the model usually has a very large number of samples, and each sample may also include a large number of features. For example, in this application, the features corresponding to the secondary scene can be as many as more than ten, and the number of valid data used for training may be as high as 100,000. It can be understood that the complexity of the algorithm used by the model is positively correlated with the number of features and the number of samples in the training set (generally the number of features × the number of feature splitting points × the number of samples). Therefore, when the number of samples is too high and the number of features is too large, the performance of the model may be seriously affected.

[0113] The LightGBM model reduces a large number of data instances with only small gradients through the gradient-based one-side sampling algorithm (GOSS), and only uses the remaining data with high gradients when calculating the information gain, saving a lot of time and space overhead. In addition, the LightGBM model further uses the exclusive feature bundling algorithm (EFB) to bundle many mutually exclusive features into one feature, achieving the purpose of dimensionality reduction and speeding up the training of the model without compromising accuracy. Therefore, LightGBM can effectively avoid the negative impact of a large number of samples and features on the model, and can be used as a prediction model in subsequent method embodiments.

[0114] The power regulation method provided in this application is introduced below in conjunction with an exemplary user interface.

[0115] Figure 1 is a user interface of an electronic device running a primary scenario and a secondary scenario provided by an embodiment of the present application. The electronic device 10 may be a laptop computer.

[0116] As shown in (A) of Figure 1 , at this time, the user has opened the "Office-Word" application through the electronic device 10, and the user is editing the word document through the keyboard 101. The application window 102 is the application window of the "Office-Word" application. When editing a word document, the user is likely to frequently use keyboard shortcuts, such as using the PaUp key and PgDn to switch pages of the word document, the Shift key + F5 key to move to the previous revision, etc. Combined with the above description, it can be seen that the user's operation on the word document through the keyboard 101 shortcut keys is a first-level event. Therefore, in (A) of Figure 1 , the operating scenario of the electronic device 10 is a first-level scenario.

[0117] In the first-level scenario shown in FIG1 (A), if a user opens a hardware detection application on an electronic device 10, the application window 103 of the hardware detection application can display the hardware information and performance of the electronic device at the moment to the user. From the hardware information displayed in the dotted box in the application window 103, it can be seen that the maximum power supply level of the CPU of the electronic device 10 (i.e., the PL1 power displayed in the application window 103, the same below) is displayed as 45W, and the corresponding power level is the maximum level. The actual system total power of the electronic device is 40.545W, and the average system total power is 41.795W; the actual system total power is the total system power of the electronic device at the current moment, and the average system total power is the average value of the total system power of the electronic device over a fixed period of time. It is understandable that although the maximum power supply level of the CPU is 45W, the actual power of the CPU may be 40W. In addition to the CPU, there may be some hardware such as the GPU in the electronic device 10 that also consumes power, so the total system power will be greater than 45W.

[0118] As shown in (B) of Figure 1 , at a certain moment, the user closes the "Office-Word" application and opens the "Video" application to start watching a video. The application window 104 is the application window of the "Video" application. It is assumed here that during the entire process of watching the video, no level 1 event is triggered in the electronic device 10. Then, combined with the above description, it can be seen that in (B) of Figure 1 , the operation scenario of the electronic device 10 is a level 2 scenario. In this level 2 scenario, if the user also opens the hardware detection application, it can be seen from the hardware information displayed in the dotted box in the application window 105 that the maximum power that can be supplied by the CPU of the electronic device 10 is still 45W, the actual total system power is 25.375W, and the average total system power is 28.550W.

[0119] As can be seen from the hardware information shown in (A) and (B) of FIG1 , the maximum power supply level of the CPU of the electronic device 10 is set to the maximum level in both the first and second level scenarios, and the corresponding power value is 45 W. However, in both scenarios, the actual operating power of the CPU in the electronic device 10 does not reach 45 W. That is, when the maximum power supply level of the CPU is set to the maximum level, the actual operating power of the CPU in the electronic device 10 may never reach 45 W.

[0120] For the first-level scenario shown in (A) in Figure 1, since the first-level scenario has high performance requirements for electronic devices, the gap between the actual CPU power of the electronic device and the maximum power that the CPU can supply is very small. At some moments, the actual power that the CPU can supply in this first-level scenario may even reach the current maximum power that the CPU can supply, that is, 45W.

[0121] However, for the secondary scenario shown in (B) of FIG1 , there is a large gap between the actual total system power of the electronic device and the maximum power that the CPU can supply, which is 45W. That is, when the electronic device 10 is running in this secondary scenario, the actual power of the CPU will not reach 45W during the entire operation process. Since the secondary scenario has lower requirements for the performance of the electronic device, for the secondary scenario shown in (B) of FIG1 , without affecting the user experience, if the actual operating power of the CPU can be limited by lowering the maximum power supply level of the CPU, that is, by lowering the maximum power supply level of the CPU to reduce the actual operating power of the CPU to a power value smaller than 25W, the total system power of the electronic device will also decrease, which can effectively reduce the power consumption of the electronic device.

[0122] Therefore, the present application provides a power regulation method, which can determine the optimal power level of the maximum power that the CPU can supply in the secondary scenario based on the main secondary scenario in which the electronic device is located, thereby reducing the power consumption of the electronic device as much as possible while ensuring the user experience, and effectively extending the usage time of the electronic device.

[0123] Combined with the above description, it can be seen that the main secondary scene parameters corresponding to the main secondary scene are extremely numerous. When any of the main secondary scene parameters changes, it means that the main secondary scene has changed to another new main secondary scene. These parameters of the main secondary scene together reflect the degree of demand of the secondary scene for the performance of the electronic device. It is not difficult to understand that different main secondary scenes have different requirements for the performance of electronic devices. In the process of users using electronic devices, the main secondary scenes that electronic devices may encounter can reach tens of thousands or even hundreds of thousands. Therefore, for any main secondary scene, how to adjust the maximum power supply value of the CPU of the electronic device to the power value (power gear) that is most suitable for the main secondary scene while ensuring the user experience, and reduce the power consumption of the electronic device as much as possible, is the key problem to be solved in this application.

[0124] The power adjustment method provided by this application and the specific strategy of the electronic device for determining the optimal power gear for different secondary scenarios are described in detail below.

[0125] FIG2 exemplifies the process of the power adjustment method provided in an embodiment of the present application. Since the focus application is the application that the user currently pays the most attention to, in the power adjustment method provided in an embodiment of the present application, the electronic device can only determine the optimal power gear of the primary secondary scene in the secondary scene, and adjust the maximum power gear that the CPU can supply to the optimal power gear of the primary secondary scene, giving priority to ensuring the performance requirements of the focus application. Referring to FIG2 , the method may include the following steps:

[0126] S101. After the electronic device leaves the factory, the electronic device is turned on and operated.

[0127] The electronic devices shown in the embodiments of the present application may be mobile phones, vehicle-mounted devices (such as on-board units (OBUs)), tablet computers (pads), computers with data transceiver functions (such as laptops, PDAs, etc.), mobile internet devices (MIDs), terminals in smart cities, terminals in smart homes, terminal devices in 5G networks, or terminal devices in future-evolved public land mobile networks (PLMNs), etc. It is understood that this application does not limit the specific forms of the above-mentioned electronic devices.

[0128] After the electronic device leaves the factory, the electronic device can be turned on and run under user operation.

[0129] S102: When in the primary and secondary scenes, the electronic device collects valid data.

[0130] During the operation of an electronic device, the operating scenario of the electronic device will constantly change under the operation of the user, and the operating scenario includes a primary scenario and a secondary scenario.

[0131] When the electronic device enters the first-level scene, since the first-level scene has a higher demand on the performance of the electronic device, the electronic device adjusts the gear of the maximum power supply of the CPU to the maximum power gear. When the electronic device enters any main-secondary scene, the electronic device will explore multiple CPU maximum power supply gears. That is, in the main-secondary scene, the electronic device will adjust the gear of the maximum power supply of the CPU to power gears with different power sizes in turn. In the process of running at each power gear, the electronic device can record the proportion of the jamming time at each power gear, and determine the optimal power gear for the main-secondary scene based on the proportion of the jamming time corresponding to each power gear.

[0132] Specifically, for any primary secondary scene scene_x that the electronic device is in, when the electronic device first enters the primary secondary scene, the electronic device can explore the advantages and disadvantages of each gear, that is, in the primary secondary scene, the gear at which the CPU can supply maximum power is adjusted to multiple power gears in sequence; preferably, the multiple power gears can include all power gears that the electronic device can provide. For each power gear, the electronic device can set the same operating time T, for example, T can be 30 seconds. In the primary secondary scene scene_x, when the electronic device begins operating at a new power gear PL1_x, the electronic device records the start time t_start of operation at power gear PL1_x. After the operating time reaches the specified operating time T, the electronic device records the operating time duration_ttl at gear PL1_x and the duration duration_delay of the electronic device experiencing lag while operating at gear PL1_x, and adjusts the gear at which the CPU can supply maximum power from PL1_x to another gear PL1_y. It can be understood that the proportion of the freeze duration corresponding to the gear position PL1_x in the main secondary scene scene_x is duration_delay / duration_ttl.

[0133] Preferably, for a main-secondary scenario, the electronic device can explore each power gear in a descending order. If the electronic device does not freeze within the specified time T during operation at a certain power gear, the maximum power gear that the CPU can supply is lowered by one gear and the exploration continues. If a freeze occurs within the specified time T, the maximum power gear that the CPU can supply is raised by one gear after the freeze occurs and the exploration continues. In other words, for a main-secondary scenario, if the electronic device freezes when running at a certain power gear, the power gear and the power gear lower than the power gear are unlikely to be the optimal power gear for the main-secondary scenario. Therefore, the electronic device will not continue to explore lower power gears, but will explore higher power gears. Based on this, when the total operating time of the electronic device in a main-secondary scenario reaches Ts (Ts can be set to 600s), the electronic device can determine the optimal power gear for the main-secondary scenario.

[0134] During the actual exploration process, in the same primary secondary scene scene_x, the electronic device may run the exploration in the same gear position PL1_x multiple times. For example, when the electronic device is running in gear PL1_x and a freeze occurs and the gear is shifted up one gear to PL1_x+1, after running in gear PL1_x+1 and the running time reaches T, the gear is shifted down one gear again to PL1_x; or when the electronic device is running in gear PL1_x, the main secondary scene scene_x changes to another main secondary scene scene_y, the electronic device will record the gear exploration progress under scene_x (i.e., PL1_x), and if the main secondary scene of the electronic device changes to scene_x again, the electronic device will continue to explore each gear starting from gear PL1_x; accordingly, the last time the electronic device switched from the main secondary scene scene_y to other scenes, the electronic device would record the gear exploration progress under scene_y (if it is the first time entering scene_y, the default gear exploration progress is the maximum gear), so after the electronic device enters scene_y, it will start again from the gear exploration progress recorded in scene_y and continue to explore each gear according to the above-mentioned gear exploration rules. In these cases, for the repeatedly explored power gear electronic devices, multiple duration_delay and multiple duration_ttl will be recorded accordingly. The proportion of the freeze duration corresponding to the power gear PL1_x can be calculated as DURATION_DELAY / DURATION_TTL; among them, DURATION_TTL is the sum of the running time of the electronic device each time the power gear PL1_x runs, and DURATION_DELAY is the sum of the freeze duration of the electronic device each time it runs scene_x at the power gear PL1_x.

[0135] For a primary / secondary scenario, when the optimal power level for that scenario is determined (or when the total operating time of the electronic device in that scenario is sufficiently long), the electronic device can record a piece of valid data corresponding to that scenario. The primary / secondary scenario for which valid data has been obtained is called the "valid primary / secondary scenario." This valid data includes: parameters for the primary / secondary scenario, multiple power levels explored, and the corresponding percentage of lag time under each power level.

[0136] S103: The electronic device trains a power prediction model.

[0137] The power prediction model is a model trained by the electronic device using the collected valid data, which can be used to determine the optimal power gear for the primary and secondary scenarios. The power prediction model can be a binary classification model, specifically a logistic regression model, a decision tree model, a random forest model, a neural network model, a GBDT model, an XGboost model, a LightGBM model, or other types of models, which are not limited in this application.

[0138] When using the power prediction model, the input of the power prediction model is the parameters of the primary and secondary scenarios, and the output is the probability of the user experience being impaired when the electronic device is running at various power levels in the primary and secondary scenarios.

[0139] It should be understood that the amount of data required for model training is very large. Therefore, when the amount of valid data collected by the electronic device is greater than or equal to X, that is, when the number of valid primary and secondary scenarios is greater than or equal to X, the electronic device will train the above-mentioned power prediction model based on the collected valid data. Specifically, the above-mentioned X can be set to 50,000, 100,000 or other values, which can be set based on the performance requirements of the above-mentioned power prediction model, and this application does not limit this.

[0140] Figure 3 shows a schematic diagram of the training process of the above prediction model. As shown in Figure 3, the training process of the above power prediction model may specifically include: data conversion 301 and model training 302.

[0141] Since the power prediction model provided in this application outputs the probability of impaired user experience corresponding to each gear in the secondary scenario, data conversion 301 mainly includes converting the proportion of the freeze duration corresponding to each gear in the valid data into a binary mark indicating whether it is harmful to the user experience, and splitting a piece of valid data into multiple pieces of data according to the gear. In addition, in order to ensure that the electronic device can correctly read the features of the discrete values ​​recorded in the valid data (such as the name of the focus application recorded in the valid data), data conversion 301 can also include an encoding operation that maps non-numeric data in the valid data to numerical values, that is, creating a mapping table to store the mapping relationship between discrete feature values ​​and custom numerical values.

[0142] FIG4 shows a process in which the electronic device numbers and marks the collected valid data and reconstructs the data according to the gear position.

[0143] As shown in Figure 4, the valid data table 40 includes multiple valid data, and the specific data volume can be tens of thousands or hundreds of thousands of items. Any valid data records the main secondary scene parameters of a main secondary scene, as well as the proportion of the lag time when the electronic device runs at different power gears in the main secondary scene.

[0144] As shown in the valid data 401 in the valid data table 40 , it is the valid data corresponding to a main secondary scene. The main secondary scene parameters of the main secondary scene include: the name of the focus application - APP1 (APP is only a pronoun, and in the actual scene it can be a specific application name, such as "Excel.exe"), the window size of the focus application - 8 levels, the download speed of the electronic device - 1 level, whether to use the camera - 0 (the parameter value of the camera is "1" to indicate that the camera is used, and "0" to indicate that the camera is not used), the screen brightness - 10 levels...; in this main secondary scene, the proportion of the electronic device's freezing time at each power level is from level 10 to level 2: 0, 0, 0, 0.01, 0.02, 0.03, 0.04, 0.05, 0.01 (the freezing time proportions corresponding to levels 6, 4, and 3 are not shown in Figure 5 due to space limitations); it can be seen from the freezing time proportions corresponding to each power level that as the level at which the CPU can supply the maximum power decreases, the probability of the electronic device freezing when running the secondary scene also increases accordingly.

[0145] It should be noted that each valid data included in the valid data table 40 does not record the percentage of the jamming duration when the electronic device is running when the power gear is gear 1. Because a large amount of experimental data shows that for most secondary scenarios, after the gear of the electronic device's CPU that can supply the maximum power is adjusted to gear 1, the electronic device will frequently jam or even fail to operate normally. Therefore, when the electronic device collects valid data in step S102, in order to ensure that the user can use the electronic device normally, when exploring the gear for any main and secondary scenarios, the electronic device does not need to adjust the power gear to gear 1, that is, the electronic device does not need to collect the percentage of the jamming duration when running at gear 1, and only needs to explore the power gear to gear 2 for a main and secondary scenario.

[0146] After collecting multiple valid data and obtaining the above-mentioned valid data table 40, the electronic device will further convert the focus application name in each valid data into a digital code to obtain the mapping relationship table 41 as shown in Figure 4. Also take the mapping data 411 in the mapping relationship table 41 as an example for explanation. The mapping data 411 corresponds to the valid data 401 in the valid data table. The difference from the valid data 401 is that the focus application name in the primary and secondary scene parameters recorded in the mapping data 411 has been converted into the digital code "0". Except for the focus application name, the mapping data 411 is the same as the content recorded in the valid data 401. It is understandable that among all the valid data recorded in the valid data table 40, there may be multiple valid data, and the focus application names recorded in these valid data are the same. When the valid data table 40 is converted into the mapping data table 41, the digital codes obtained by converting the focus application names recorded in these valid data are also the same.

[0147] After obtaining the above-mentioned mapping relationship table 41, the electronic device will determine whether the user experience is impaired based on the proportion of the jamming duration at each power gear for each main and secondary scenario. It should be understood that in some secondary scenarios, the electronic device may jam even when running at the highest power gear. Therefore, for any main and secondary scenario, when the electronic device is running at a certain power gear, it does not mean that the user experience is impaired as long as the electronic device jams. It still needs to be determined based on the probability of the electronic device jamming when running at this power gear. This probability can be reflected by the proportion of the jamming duration when the electronic device is running at this power gear. Therefore, for the mapping data corresponding to any main and secondary scenarios in the mapping relationship table 41, the electronic device can set a damage threshold, and the electronic device can compare the percentage of the jamming duration corresponding to each gear recorded by it with the damage threshold - if the percentage of the jamming duration corresponding to a certain power gear is less than or equal to the above-mentioned damage threshold, it means that the user experience of running at this power gear is not impaired, and the electronic device can update the numerical value corresponding to the power gear (i.e., the percentage of the jamming duration, the same below) to the label value "1"; conversely, if the percentage of the jamming duration corresponding to a certain power gear is greater than the above-mentioned damage threshold, it means that the user experience of running at this power gear is impaired, and the electronic device can update the numerical value corresponding to the power gear to the label value "0". The specific numerical value of the above-mentioned damage threshold can be set according to specific needs. Specifically, the damage threshold can be 0.05, 0.03, or other values, which are not limited in this application. In this application, the above-mentioned "damage threshold" can also be referred to as the "first threshold".

[0148] The mapping data 411 in the mapping relationship table 41 and the above-mentioned damage threshold of 0.03 are used as an example for explanation. Referring to the gear marking table 42 shown in FIG4 , the gear marking data 421 is the data obtained after the electronic device marks each gear in the mapping data 411 according to the threshold value 0.03. Combined with the above description, it can be seen that in the mapping data 411, for example, the proportion of the stalling time of power gear 10, power gear 9, power gear 8, power gear 7, etc. is less than or equal to 0.03, so these power gears are marked as "0"; and the proportion of the stalling time of power gear 3 and power gear 2 is greater than 0.03, so these power gears will be marked as "1".

[0149] After obtaining the gear marking table 42, the electronic device needs to reconstruct the gear marking table 42, that is, split each gear marking data in the gear marking table 42 into multiple sub-data according to the gear, and obtain a training set 43. Each gear in the same gear marking data in the training set 43 corresponds to a sub-data, and each sub-data not only records its corresponding gear and the label value corresponding to the gear, but also records all the main and secondary scene parameters of the main and secondary scenes recorded in the original gear marking data. In the embodiment of the present application, the data contained in the above valid data table 40" can also be called a "valid data set", the above training set 43 can also be called a "training data set", and the data in the training set 43 can be called "training data". The above label value "1" can be called a "second label value", and the above label value "0" can be called a "first label value".

[0150] The gear mark data 421 in the gear mark 42 is used as an example for explanation. After the gear mark data 421 is split, 9 training data including sub-data 431, sub-data 432, sub-data 433, sub-data 434, and sub-data 435 can be obtained in the training set 43 (some of the sub-data are not shown in Figure 4 due to space limitations). Among them, each sub-data, in addition to recording its corresponding gear and the label value corresponding to the gear, also records the main and secondary scene parameters recorded in the gear mark data 421, such as the focus application number - "0", window size - 8, download speed - 1 gear, etc. It can be understood that in the training set 43, the information recorded in the 9 sub-data obtained from the same gear mark data is the same except for the different gears and gear label values.

[0151] After obtaining the above training set 43, the electronic device can start to execute the relevant operations included in the model training 302, that is, perform training based on the above training set 43, obtain the above power prediction model, and deploy the power prediction model in the electronic device.

[0152] It should be noted that the model training process places great demands on the performance and power consumption of the device. Therefore, in an optional embodiment, after obtaining the above-mentioned training set 43, the electronic device can train the above-mentioned power prediction model while it is charging and the screen is off (but the electronic device is still on). It can be understood that the power of the electronic device can always be sufficient when it is charging, and can provide enough power for the model training process. When the screen is off, the electronic device can reduce the consumption of electronic device performance and power by other processes and applications as much as possible, so the electronic device can provide more power and performance for the model training process. And when the screen is off, it means that the user is not using the electronic device at this moment, so even if the model training process consumes most of the performance of the electronic device, it will not cause damage to the user experience.

[0153] S104: The electronic device determines the current operating scenario.

[0154] The electronic device determines the current operating scenario by detecting whether a level 1 event occurs. If a level 1 event occurs, it indicates that the electronic device is in the level 1 scenario, and the electronic device can execute step S105; otherwise, it indicates that the electronic device is in the level 2 scenario, and the electronic device can execute step S106.

[0155] S105: When the operating scenario is the first level scenario, the electronic device adjusts the maximum power supply level of the CPU to the maximum power level.

[0156] As shown in Figure 5, the electronic device can determine whether the mouse button is clicked, whether the keyboard shortcut key is operated, and whether the focus application is switched through the corresponding interface; in addition, the electronic device can also obtain the CPU load status and whether the electronic device is in game mode through the corresponding interface.

[0157] When a Level 1 event, such as a mouse click or keyboard shortcut input, is triggered, the electronic device determines that the current operating scenario is Level 1. Based on the high performance requirements of the Level 1 scenario, the electronic device will directly adjust the CPU's maximum power supply to the maximum power setting to ensure 100% performance.

[0158] For the next N seconds, the electronic device will always maintain the maximum power supply gear at the maximum power gear. If the electronic device triggers a level one event again within N seconds, the electronic device will restart the timing from the triggering time of the second level one event, and for the next N seconds, the electronic device will always maintain the maximum power supply gear at the maximum power gear, and so on, until the electronic device does not trigger a level one event for N consecutive seconds. The electronic device will determine that the level one scenario has ended, and the operating scenario is now the level two scenario, and the electronic device can then execute step S106. Specifically, the above-mentioned N can be 5 or other values, and this application does not limit this.

[0159] S106. When the operating scenario is the secondary scenario, the electronic device determines the optimal power gear of the current main secondary scenario based on the above power prediction model, and adjusts the gear of the CPU maximum supply power to the optimal power gear of the current main secondary scenario.

[0160] As shown in Figure 6, when the electronic device is in the secondary scene, it can obtain all primary and secondary scene parameters for the current primary and secondary scene, including parameters such as the focused application and the size of the focused application window. The electronic device can then input all primary and secondary scene parameters for the current primary and secondary scene into the aforementioned power prediction model, which can then output the probability of a compromised user experience at various power levels for the current primary and secondary scene.

[0161] Furthermore, the electronic device can compare the power levels starting from the highest power level and work its way down, selecting the lowest power level with a probability of user damage less than or equal to a certain threshold (e.g., 0.5) as the optimal power level. The electronic device can then adjust the maximum power level that the CPU can supply to this optimal power level.

[0162] FIG7 shows a process of processing collected data when the electronic device determines the optimal power gear for the current primary and secondary scenarios based on the power prediction model.

[0163] As shown in the main-secondary scene feature table 70 in Figure 7, assuming that scene 701 is the main-secondary scene currently running by the electronic device, for the currently running main-secondary scene scene 701, the electronic device can collect all the main-secondary scene parameters including the name of the focus application, the size of the focus application window, and the download speed. It should be noted that when obtaining the focus application, the mapping relationship between the focus application and the number has been saved in the electronic device during the aforementioned data conversion process (refer to the aforementioned mapping relationship table 411). The electronic device can directly obtain the number corresponding to the focus application under the main-secondary scene scene 701, and input it into the above-mentioned power prediction model together with other main-secondary scene parameters. In an embodiment of the present application, the main-secondary scene scene 701 can also be referred to as the "first main-secondary scene".

[0164] After obtaining all the primary and secondary scene parameters of scene 701, the power prediction model can construct a prediction sample table for scene 701 based on all the primary and secondary scene parameters of scene 701. The prediction sample table is used to store multiple prediction samples consisting of the primary and secondary scene parameters of scene 701 and each candidate power gear (power gear 9-power gear 2). For details, please refer to the prediction sample table 71 shown in Figure 7. In the prediction sample table 71, the power prediction model can determine a prediction sample for each candidate power gear that can be provided by the electronic device, so as to facilitate the storage of the prediction results of the probability of user experience impairment corresponding to each subsequent candidate power gear.

[0165] Next, the power prediction model can predict the prediction samples in the prediction sample table 71, and its output is the probability that the user experience will be impaired when the electronic device runs scene 701 at each candidate power gear. For details, please refer to the prediction output table 72 shown in Figure 7. As can be seen from the prediction output table 72, the prediction output table 72 records the prediction results of the power prediction model for each prediction sample in the prediction sample table. When the electronic device runs at each power gear (10 gear - 2 gear) under scene 701, the probability of impaired user experience is 0, 0, 0.01, 0.06, 0.23, 0.48, 0.59, 0.67, and 0.71 respectively. In the embodiment of the present application, the "prediction result" recorded in the prediction output table 72 can be referred to as the first prediction result, and the above "power gear 9 - power gear 2" can also be referred to as "the maximum power that can be supplied by multiple different CPUs."

[0166] Afterwards, the electronic device can search from the highest power gear 10 based on the prediction output table 72, and use the power gear with a probability of user experience damage of less than or equal to 0.5 (in this application, "the probability of user experience damage is less than or equal to 0.5" can be referred to as the "first condition") as the optimal power gear. As shown in the prediction output table 72, for the current scene scene701, the gear with the last probability of user damage less than or equal to 0.5 is gear 5, and the optimal power gear finally determined by the electronic device for scene 701 is gear 5. The electronic device can adjust the gear of the maximum power that the CPU can supply to gear 5, and continue to operate under scene 701. In the embodiment of the present application, the above-mentioned optimal power gear "gear 5" can also be referred to as the first optimal power, and the above-mentioned value "0.05" can also be referred to as the "second threshold."

[0167] It is understood that the specific formats of the data sets involved in the model training and prediction processes shown in Figures 4 and 7 are only for the convenience of the reader and do not represent their formats in actual scenarios. For example, in actual application scenarios, the data recorded in the valid data table 40, mapping relationship table 41, and gear mark table 42 described above may not exist in the electronic device in the form of tables, but may be stored in the electronic device in the form of program code. This application does not limit the specific format of this data in the electronic device.

[0168] In the subsequent operation process, when the operation scene of the electronic device changes, the electronic device can adjust the maximum power supply level of the CPU again. The changes in the operation scenes mentioned here include: 1. The operation scene of the electronic device changes from the current secondary scene to the primary scene. The electronic device adjusts the maximum power supply level of the CPU to the maximum level. For details, please refer to the aforementioned description of step S105, which will not be repeated here. 2. The main secondary scene of the electronic device changes from the current main secondary scene to a new main secondary scene. The electronic device can then execute the subsequent step S107.

[0169] S107. The main secondary scene of the electronic device changes from the current main secondary scene to the new main secondary scene. The electronic device determines the optimal power gear of the new main secondary scene based on the above power prediction model, and adjusts the gear of the maximum power supply of the CPU to the optimal power gear of the new main secondary scene.

[0170] As can be seen from the foregoing description, if any of the primary-secondary scene parameters corresponding to the current primary-secondary scene changes, the electronic device can determine that the current primary-secondary scene should be switched to another new primary-secondary scene. At this point, the electronic device can determine the optimal power level for the new primary-secondary scene based on the power prediction model described above, and can adjust the maximum power level that the CPU can supply to the optimal power level for the new primary-secondary scene. For specific operations, please refer to the aforementioned description of step S106 and will not be repeated here.

[0171] Figure 8 illustrates the effect of adjusting the maximum CPU power available after an electronic device changes from its current primary / secondary scenario to a new primary / secondary scenario. The electronic device shown in Figure 8 may be an electronic device employing the aforementioned power prediction model in this method, and here again, it is assumed that the maximum CPU power available corresponds to a power value of 45W.

[0172] In FIG8 (A), the electronic device opens the "Video" application to start watching a video that has been downloaded to the electronic device. Application window 801 is the application window of the "Video" application. At this time, the electronic device has not triggered a primary event, that is, the electronic device is in the main secondary scene 81. Specifically, the main secondary scene 81 and the main secondary scene 701 described above can be the same main secondary scene.

[0173] To reduce the device's power consumption, the electronic device collects all primary and secondary scene parameters for scene 81 as input to the aforementioned power prediction model. The aforementioned power prediction model then outputs the probability of user experience impairment for scene 81 at each CPU maximum power level. The electronic device can then determine the optimal power level for scene 81 based on the user experience impairment probability for each level. Assuming the power value corresponding to scene 81's optimal power level is 15W, as shown in FIG8(A), the hardware information displayed in application window 802 indicates that the electronic device's maximum CPU power level has been adjusted to 15W. Accordingly, the electronic device's total system power is 15.411W, and the system average power is 16.305W. Although CPU performance decreases as the CPU maximum power level decreases, the electronic device still plays videos smoothly, and the display screen, mouse cursor, and other features remain stable, ensuring the user experience remains intact.

[0174] During subsequent operation, the user operates the electronic device to play music through the music application. The electronic device is currently listening to music through the "Music" application, and application window 803 is the application window of the "Music" application. After switching the focus application from the video application to the music application, the electronic device does not trigger a primary event while playing music. At this point, the electronic device is in primary secondary scene 82. Since the electronic device's operating scene has switched from primary secondary scene 81 to new primary secondary scene 82, primary secondary scene 82 likely has different performance requirements than scene 81. Therefore, the electronic device will obtain the optimal power gear for the new main and secondary scene scene 82; specifically, the electronic device will also collect all the main and secondary scene parameters of scene 82 as input to the above-mentioned power prediction model, and the above-mentioned power prediction model will output the probability of user experience damage under each CPU maximum power gear for scene 82 (in the embodiment of the present application, the probability of user experience damage under each CPU maximum power gear for scene 82 can be referred to as the "second prediction result"). The electronic device can determine the optimal power gear for scene 82 based on the probability of user experience damage at each gear and adaptively adjust the gear of the CPU maximum power that can be supplied. Assuming that the power value corresponding to the optimal power gear of scene 82 is 10W, as shown in Figure 8 (B), it can be seen from the hardware information shown in the application window 804 that the maximum power that can be supplied by the CPU of the electronic device 10 has been adjusted to 10W. Accordingly, the total system power is reduced to 10.411W, and the average system power is also reduced to 11.305W. Similarly, although the CPU performance will be reduced due to the reduction in the maximum power that the CPU can supply, the electronic device can still play music smoothly, the image on the electronic device's display screen and the mouse cursor will not be stuck, and the user experience will not be affected.

[0175] As can be seen, since main-secondary scene 82 and main-secondary scene 81 are different main-secondary scenes, their performance requirements for the electronic device may also be different. Therefore, the maximum power supply determined by the electronic device for scene 82 is also different from the maximum CPU power supply determined for scene 81. It should be noted that parameters such as the focus application window size, focus application memory usage, download speed, screen brightness, RAM, integrated graphics card load rate, discrete graphics card load rate, and hard disk write speed may change frequently during the operation of the electronic device. To prevent the electronic device from frequently adjusting the maximum CPU power supply level under the influence of these parameters, in an optional embodiment, the electronic device can discretize the values ​​of these parameters into different levels. When determining whether the main-secondary scene has changed, for these parameters, only when the level corresponding to the value changes is the main-secondary scene considered to have changed. In this embodiment of the present application, the above-mentioned "main-secondary scene 81" may also be referred to as the "first main-secondary scene," and the above-mentioned "main-secondary scene 82" may also be referred to as the "second main-secondary scene."

[0176] Taking the download speed of an electronic device as an example, and in conjunction with Figure 9, the specific meaning of the above discretization process is explained. For ease of understanding, it is assumed that the download speed of the electronic device is a minimum of 0 kb / s and a maximum of 2028 kb / s. As shown in Figure 9, the download speed interval of the electronic device is [0, 2028]. This interval can be divided into four subintervals, namely subinterval 901, subinterval 902, subinterval 903, and subinterval 904, and their corresponding intervals are [0, 500], [400, 1024], [900, 1500], and [1400, 2028], and their corresponding download speed gears are gear 1, gear 2, gear 3, and gear 4, respectively.

[0177] When determining a secondary scenario, a switch from one primary secondary scenario to another is considered complete only when the gear corresponding to the download speed value changes, that is, when the download speed value changes by a certain amount. Furthermore, to prevent the download speed value from fluctuating back and forth at the intersection of two adjacent intervals, causing the gear position to constantly change, the intervals corresponding to each of the four aforementioned gears overlap. When determining the gear position, if the current download speed value falls within the overlapping area of ​​two sub-intervals, the gear position corresponding to that moment will be determined to be the same as the gear position corresponding to the previous moment. For example, suppose that at a certain moment, the electronic device's download speed is 250kb / s, which falls within the interval [0, 500] and therefore corresponds to gear 1. At the next moment, the electronic device's download speed changes to 450kb / s, which falls within both the interval [0, 500] and [400, 1024]. However, since the download speed at the previous moment fell within the interval [0, 500], the electronic device will still determine that 450 belongs to the interval [0, 500], i.e., the corresponding download speed gear is still 1. If, at the next moment, the electronic device's download speed changes to 600kb / s, this value only falls within the interval [400, 1024] and corresponds to download speed gear 2, then the electronic device will determine that the secondary scene feature of the download speed has changed, i.e., the primary secondary scene has changed.

[0178] Similarly, electronic devices can also discretize parameters such as the focus application window size, focus application memory usage, and screen brightness to obtain multiple levels. Only when the levels corresponding to these parameters change does it determine that a change has occurred in the primary or secondary scene. Furthermore, the division of the level ranges in FIG9 is merely for ease of understanding. In actual application scenarios, the endpoint values ​​of the sub-ranges obtained by dividing the secondary feature range by the electronic device may vary, and the number of sub-ranges may also vary. This application does not impose any restrictions on this.

[0179] Because the electronic device has sufficient power supply when charging, it does not need to adjust the maximum power supply level of the CPU based on the operating scenario. Instead, the CPU's maximum power supply level is always maintained at the maximum level, prioritizing the performance requirements of the electronic device. Therefore, in some embodiments, the electronic device may only execute steps S101, S102, and S104-S107 when it is not charging.

[0180] In the present application, the electronic device can also adjust the maximum operating frequency of the CPU to achieve the purpose of reducing the power consumption of the device without compromising the user experience. Accordingly, when collecting valid data for any secondary scene, the electronic device can also collect the proportion of the freeze duration under different CPU maximum operating frequency gears by adjusting the CPU maximum operating frequency gear. After collecting enough valid data, the electronic device can also train the power prediction model (for details, please refer to the relevant instructions for steps S102-step S103), and output the optimal frequency gear of the main secondary scene in the secondary scene based on the power prediction model during the subsequent operation (that is, for the main secondary scene, without affecting the user experience, the power gear with the lowest power consumption among all CPU maximum operating frequency gears), and adjust the CPU maximum operating frequency gear to the above-mentioned optimal frequency gear.

[0181] In some embodiments, the power prediction model may be deployed in the electronic device by the manufacturer of the electronic device before the electronic device leaves the factory. For example, the manufacturer of the electronic device may use an electronic device A of the same model as the electronic device (electronic device A may include one or more devices of the same model as the electronic device) to collect the valid data for training the power prediction model, and use electronic device B (electronic device B and electronic device A may be the same device or different devices) to train the valid data collected by electronic device A to obtain the power prediction model. Afterwards, the manufacturer may uniformly deploy the power prediction model to multiple terminal devices of the same model including the electronic device. In this case, the electronic device may not execute steps S102 and S103.

[0182] In addition, in some embodiments, the model training work involved in step S103 is completed by a server provided by the manufacturer of the electronic device. In this case, the above-mentioned electronic device can complete the collection of valid data together with other electronic devices of the same model. That is, the number of valid data collected by the above-mentioned electronic device can be less than X, and it can send the collected valid data to the server provided by the manufacturer of the electronic device together with other electronic devices of the same model. When the amount of valid data received by the server is greater than X, the server can use these valid data to perform model training to obtain the above-mentioned power prediction model. Afterwards, the server can uniformly send the above-mentioned power prediction model to multiple electronic devices of the same model including the above-mentioned electronic device, so as to avoid the time and storage resources consumed by the electronic device training model. Of course, the number of valid data collected by the above-mentioned electronic device can also be greater than or equal to X. In this case, the above-mentioned server can train the above-mentioned power prediction model based on the valid data collected by the above-mentioned electronic device (greater than or equal to X) and send the power prediction model to the above-mentioned electronic device. In this way, the power prediction model in the electronic device can be more adapted to the user's personalized needs and usage habits, and its prediction performance will also be better.

[0183] In some embodiments, in certain first-level scenarios, the electronic device may also adjust the maximum power that the CPU can supply. Specifically, when the triggering event of the first-level scenario is an event such as the electronic device being in game mode or the CPU being in a high-load state, the performance requirements of the electronic device at this time are very high. Therefore, for the first-level scenario triggered by this type of first-level event, the electronic device can still keep the maximum power that the CPU can supply at the maximum gear. However, when the triggering event of the first-level scenario is an event such as clicking a mouse button or using a keyboard shortcut, the performance requirements of the electronic device at this time are relatively lower. Therefore, for the first-level scenario triggered by this type of first-level event, the electronic device may also collect corresponding valid data in such a first-level scenario and train a prediction model applicable to such a first-level scenario based on the valid data; when the electronic device is subsequently in such a first-level scenario with relatively low performance requirements, the electronic device may also determine the optimal power gear for such a first-level scenario based on the above-mentioned prediction model. The specific process of collecting the training data of the prediction model and the model training can refer to the aforementioned description of steps S102-S103, which will not be repeated here.

[0184] It is understandable that for electronic devices such as computers, users may open multiple applications at the same time, including the focus application and background applications. Therefore, during the operation of the electronic device, the electronic device must not only meet the performance requirements of the focus application, but also the performance requirements of the background applications. In some cases, the performance requirements of the background applications for the electronic device are even higher than those of the focus application.

[0185] Therefore, in some embodiments, after the above-mentioned power prediction model is successfully trained, the electronic device can determine an optimal power gear corresponding to the main secondary scene in the secondary scene based on the power prediction model, and determine the corresponding N optimal power gears for N auxiliary secondary scenes in the secondary scene based on the power prediction model, and determine the largest power gear among the (N+1) optimal power gears corresponding to the main secondary scene and the auxiliary secondary scene as the optimal power gear of the secondary scene, while meeting the performance requirements of the focus application, further meeting the performance requirements of the background application.

[0186] In conjunction with the above description, the following describes another power adjustment method provided by an embodiment of the present application in conjunction with Figure 10. Referring to Figure 10, the method may include the following steps:

[0187] S201: When the operating scenario is a secondary scenario, the electronic device determines an optimal power gear for the current primary and secondary scenarios based on a power prediction model.

[0188] The electronic device shown in the embodiment of the present application may be the electronic device shown in FIG2 . The power prediction model in the embodiment of the present application may be the power prediction model shown in FIG2 . The specific training process and application process thereof may refer to the aforementioned description of steps S101 to S103 in FIG2 , and will not be repeated here.

[0189] The specific operation process of step S201 can refer to the above-mentioned relevant description of step S106, which will not be repeated here.

[0190] S202: The electronic device determines M optimal power gears for M auxiliary-secondary scenarios based on the power prediction model.

[0191] In combination with the above description, it can be seen that a main secondary scene and an auxiliary secondary scene can exist simultaneously in a secondary scene. Usually, at the same time, the number of main secondary scenes is one, and the number of auxiliary secondary scenes can be multiple. In the same secondary scene, the auxiliary secondary scene parameters of the auxiliary secondary scene and the main secondary scene parameters of the main secondary scene are only different in three parameters: application, application window size, and application memory usage, while the rest of the parameters are the same, and the focus application and the background application can be converted to each other. Therefore, the auxiliary secondary scene parameters of the auxiliary secondary scene can also be used as the input of the above-mentioned power prediction model, and the power prediction model outputs the probability of impaired user experience corresponding to each power gear in the auxiliary secondary scene (in the embodiment of the present application, the probability of impaired user experience corresponding to each power gear in the above-mentioned auxiliary secondary scene can also be referred to as the "third prediction result"), and then the electronic device further determines the optimal power gear of the auxiliary secondary scene. The specific operation process is similar to the above-mentioned operation process of determining the optimal power gear of the main secondary scene, and will not be repeated here.

[0192] Preferably, the background applications corresponding to the M auxiliary secondary scenes can be the M background applications that consume the most CPU performance among the background applications. Specifically, the value of M can be 3 or other values, which is not limited in this application.

[0193] When the N background applications that consume the most CPU performance among the background applications include the focus application, there will be an auxiliary secondary scene among the above-mentioned M auxiliary secondary scenes, and its auxiliary secondary scene parameters are exactly the same as the main secondary scene parameters, then the prediction result of the prediction model for this auxiliary secondary scene is also exactly the same as the prediction result for the main secondary scene. Therefore, in an optional embodiment, when the M background applications that consume the most CPU performance among the background applications include the focus application, after the electronic device obtains the M groups of auxiliary secondary scene parameters of the above-mentioned M auxiliary secondary scenes, it can eliminate the group of auxiliary secondary scene parameters that are exactly the same as the main secondary scene parameters. When the power prediction model is used for prediction later, it is only necessary to determine the optimal power gears of the main secondary scene and the remaining two auxiliary secondary scenes respectively.

[0194] S203. The electronic device determines the optimal power gear of the above-mentioned main secondary scene and the largest power gear among the M optimal power gears of the above-mentioned M auxiliary secondary scenes as the optimal power gear of the current secondary scene, and adjusts the gear of the maximum power that can be supplied by the CPU to the optimal power gear of the current secondary scene.

[0195] In order to ensure that the final set power level can meet the needs of background applications and focus applications at the same time, the electronic device selects the largest power level from the optimal power level of the main secondary scene and the M optimal power levels of the above-mentioned M auxiliary secondary scenes as the optimal power level of the current secondary scene, and adjusts the level of the maximum power that the CPU can supply to the optimal power level of the current secondary scene.

[0196] FIG11 shows a process in which an electronic device determines a common optimal power gear for a primary secondary scenario and an auxiliary secondary scenario.

[0197] As shown in Figure 11, assume that at this moment in the electronic device, the focus application is numbered 0, and the three background applications that consume the most CPU performance are numbered 1, 2, and 3, respectively. Scene 01 is the primary secondary scene currently running on the electronic device, and scene 02, scene 03, and scene 04 are the three secondary secondary scenes currently running on the electronic device. In the embodiment of the present application, scene 01 may also be referred to as the "first primary secondary scene," and any of scene 02, scene 03, and scene 04 may be referred to as the "first secondary secondary scene."

[0198] For the currently running main secondary scene scene 01, the electronic device can collect the main secondary scene parameters of scene 01, as shown in data 0101 in main secondary scene parameter table 010. Similarly, for the three currently running auxiliary secondary scenes scene 02, scene 03, and scene 04, the electronic device can also collect the auxiliary secondary scene parameters of these three auxiliary secondary scenes, as shown in data 0111, data 0112, and data 0113 in auxiliary secondary scene parameter table 011.

[0199] After obtaining the primary secondary scene parameters for scene 01, the electronic device can determine the optimal power level PL11 for scene 01 based on the primary secondary scene and the prediction model. This process is described in detail with reference to the aforementioned description of FIG. 2 and will not be further described here or in subsequent embodiments. In the embodiments of the present application, the optimal power level PL11 may also be referred to as the "first optimal power level."

[0200] Similarly, after obtaining the auxiliary secondary scene parameters for the three auxiliary secondary scenes scene 02, scene 03, and scene 04, the electronic device can also determine the optimal power level PL12 for scene 02, the optimal power level PL13 for scene 03, and the optimal power level PL14 for scene 04 based on the auxiliary secondary scene parameters of scene 02, scene 03, and scene 04 and the prediction model. In the embodiment of the present application, any of the power levels PL12, PL13, and PL14 can also be referred to as the "first optimal power level."

[0201] After obtaining the optimal power levels PL11, PL12, PL13, and PL14 for the four scenarios, the electronic device can determine the largest of these four optimal power levels as the optimal power level for the current scenario. For example, assuming PL11 > PL12 > PL13 > PL14, the electronic device will ultimately determine PL11 as the optimal power level for the current secondary scenario and adjust the maximum power level that the CPU can supply to PL11.

[0202] S204. When the current secondary scene changes to a new secondary scene, the electronic device determines the optimal power gear of the new secondary scene based on the power prediction model, and adjusts the gear of the maximum power supply of the CPU to the optimal power gear of the new secondary scene.

[0203] The current secondary scene changes to a new secondary scene in one or more of the following two situations: 1. The current primary secondary scene changes to a new primary secondary scene. 2. If the background applications corresponding to the M secondary secondary scenes are the three background applications with the highest CPU performance consumption, the M background applications running on the electronic device that consume the most CPU performance change, resulting in changes in the M secondary secondary scenes.

[0204] It can be understood that the changes in the main secondary scene and the changes in the auxiliary secondary scene can occur synchronously or asynchronously. Among them, for the main secondary scene, the electronic device can detect in real time whether the main secondary scene parameters of the main secondary scene have changed; if any of the main secondary scene parameters change, it is determined that the current main secondary scene has changed to a new main secondary scene. For the auxiliary secondary scene, the electronic device can periodically detect the M background applications with the largest performance consumption in the background applications. If they are different from the M background applications determined last time, it means that the M auxiliary secondary scenes have changed (as long as the newly determined M background applications are not exactly the same as the M background applications determined last time, it means that the M auxiliary secondary scenes have changed). Optionally, the duration of the above cycle can be set to 30s, or it can be set to other durations, and this application does not limit this.

[0205] When the primary secondary scene and / or the M auxiliary secondary scenes change, it indicates that the current secondary scene has changed to a new secondary scene. The electronic device can re-determine the optimal power level for the new secondary scene based on the relevant operations in steps S201-S203 and adjust the maximum power level that the CPU can supply to the optimal power level for the new secondary scene.

[0206] It is understandable that the applications in electronic devices are constantly updated, and the performance requirements of these applications for the electronic device may also change with the version update, and the degree of change in their performance requirements is generally not too large. Therefore, in some embodiments, after the power prediction model is trained, for any primary and secondary scenario, after determining the optimal power level for the primary and secondary scenario based on the prediction model, the electronic device can adjust the maximum power level that the CPU can supply to any one of the optimal power level, a level higher than the optimal power level, or a level lower than the optimal power level. Accordingly, during subsequent operation, the electronic device will also collect feedback data, which may include the operating time and lag duration of the electronic device in the last adjusted level. Finally, the electronic device can update the valid data corresponding to the primary and secondary scenario based on the obtained feedback data, and update the power prediction model based on the updated valid data, that is, use the updated valid data to train a new prediction model, so that the power prediction model can maintain the accuracy of the prediction results even when the application is constantly updated. Figure 12 exemplifies the update process of the prediction model.

[0207] As shown in FIG12 , the power prediction model may be a model trained by the electronic device based on multiple valid data in the valid data table 12A, where 12A1 is valid data of the primary and secondary scene 12 collected by the electronic device.

[0208] After the power prediction model is trained, when the electronic device is in scene 12 again, the electronic device may determine the optimal power level PL1x for scene 12 based on the power prediction model and the primary and secondary scene parameters of scene 12 .

[0209] Here, it is assumed that the higher power level adjacent to power level PL1x is PL1(x+1), and the lower power level adjacent to power level PL1x is PL1(x-1). In this embodiment of the present application, the electronic device can obtain a random number that falls within the main interval [1, 100] based on a random number function. If this random number falls within the subinterval [1, 5], the power level PL1y to be adjusted is determined to be PL1(x-1); if this random number falls within the subinterval [96, 100], the power level PL1y to be adjusted is determined to be PL1(x+1); if this random number falls within the subinterval [5, 95], the power level PL1y to be adjusted is determined to be PL1x. It can be understood that the probabilities of PL1y being determined to be PL1(x-1), PL1x, and PL1(x+1) are 5%, 90%, and 5%, respectively. In the application embodiment, the main secondary scene scene12 can be called the "first main secondary scene", PL1x can be called the optimal power, PL1x-1 can be called the fourth power, and PL1x-1 can be called the fifth power.

[0210] Regardless of which power gear PL1y is determined to be PL1(x-1), PL1x, and PL1(x+1), the electronic device will record the running time and the jamming time when running at that gear. Here, we take PL1x as gear 7 and PL1y as PL1(x+1), i.e., gear 8, as an example. Assuming that the running time of the electronic device when running at power gear 8 is 100s, and the jamming time during operation is 1s, the electronic device will use the running time of 100s and the jamming time of 1s as the feedback data of scene 12 running at gear 8. Afterwards, the electronic device can use the feedback data to update the valid data 12A1 of scene 12. As shown in the valid data 12A2 in the valid data table 12A, the proportion of the jamming time corresponding to gear 8 in the valid data corresponding to scene 12 has been updated from the original 0 to 0.01.

[0211] It is understandable that when the electronic device is operating in other main and secondary scenarios, the electronic device can also use the above method to update the valid data of other main and secondary scenarios, that is, the valid data in the valid data table 12A can be continuously updated. In the subsequent operation process, the electronic device can periodically use the valid data in the valid data table to retrain a new power prediction model to update the power prediction model obtained by previous training. In addition, in some embodiments, the probability that PL1(x-1), PL1x and PL1(x+1) are determined to be PL1y can be set to other probability values ​​by adjusting the proportion of each sub-interval in the main interval, and this application does not limit this.

[0212] It should be noted that after an app in an electronic device is updated, the electronic device may not be able to perceive whether the app's performance requirements have increased, decreased, or remained unchanged. Therefore, after determining the optimal power level for the primary and secondary scenes based on the prediction model, the electronic device may adjust the final adjusted level to PL1(x-1) if the performance requirements of the focus application increase, or may adjust the final adjusted level to PL1(x+1) if the performance requirements of the focus application decrease. Although in either case, the electronic device cannot determine the final adjusted level as the most optimal power level for the current primary and secondary scenes, the feedback data obtained when operating in the final adjusted level objectively records the percentage of lag time experienced by the electronic device at that level, and can accurately reflect whether the final adjusted level has compromised the user experience for the current primary and secondary scenes. For example, suppose the current optimal power level for scene 12 determined by the prediction model is level 7, and the focus application corresponding to scene 12 has been updated. The actual optimal power level for scene 12 is level 7, but the electronic device ultimately determines the final adjusted level PL1y as level 6 based on the above method. In this case, although the electronic device may experience more frequent freezes when operating at power level 6 in scene 12, the collected feedback data is also collected for power level 6. After the effective data is updated using the feedback data, the proportion of freeze duration recorded in the effective data increases, reflecting that power level 6 is less suitable for the current scene 12 than before. This reflection is accurate and reliable for the current scene 12. Therefore, regardless of whether the electronic device can determine the final adjusted power level as the most suitable power level for the current primary and secondary scenes, the feedback data obtained in the subsequent process is true and objective. After using the feedback data to update the corresponding effective data, the prediction performance of the new power prediction model retrained by the electronic device using the updated effective data will be improved.

[0213] In the method embodiments shown in Figures 2 and 10 above, the entire operation process of the electronic device after leaving the factory can be divided into three stages: a cold start stage, a statistical stage, and a prediction stage. The amount of valid data obtained by the electronic device in these three stages (i.e., the number of valid secondary scenarios) is different, which leads to different ways for the electronic device to determine the power gear to be adjusted for the main and secondary scenarios. Among them:

[0214] ① [Cold Start Phase] Valid Data: 0, Gear Determination Method: Optimal Power Exploration Strategy - That is, for a primary / secondary scenario, the electronic device operates in multiple power gears in the primary / secondary scenario, and the optimal power gear for the primary / secondary scenario is determined by recording the smoothness of operation at each gear.

[0215] The cold start phase can be considered as the phase in which the electronic device starts up and runs the main and secondary scenarios for the first time after leaving the factory. In this phase, for any main and secondary scenario, the electronic device can successively run at multiple power gears in the main and secondary scenario, and obtain the probability of freezing for each main and secondary scenario at different frequency gears. Preferably, the multiple power gears can include all power gears that the electronic device can provide. For each power gear, the electronic device can set the same operating time T, specifically, T can be 30s.

[0216] Let's take the main secondary scene scene_x as an example. In the main secondary scene scene_x, each time the electronic device starts running at a new power gear PL1_x, the electronic device will record the start time t_start of running at the power gear PL1_x; after the running time reaches the specified running time T, the electronic device will record the running time duration_ttl of the gear PL1_x and the duration duration_delay of the electronic device being stuck when running at the gear PL1_x, and adjust the gear of the CPU's maximum power supply from PL1_x to another gear PL1_y. It can be understood that in the main secondary scene scene_x, the proportion of the stuck time corresponding to the gear PL1_x is duration_delay / duration_ttl.

[0217] Preferably, for a main secondary scene scene_x, the electronic device can adjust the maximum power supply of the CPU provided by the explored electronic device in sequence from high to low to all gears it can provide. If the electronic device does not freeze within the specified time T when running at a certain power gear, the maximum power supply of the CPU is lowered by one gear and the exploration continues downward; if a freeze occurs within the specified time T, the maximum power supply of the CPU is immediately raised by one gear after the freeze occurs and the exploration continues downward. The gear exploration rules can be specifically set as follows:

[0218] 1) When the electronic device operates at power level PL1_x for T1 (T1≤T), the operating scenario changes to level 1 scenario;

[0219] The electronic device saves the current gear exploration progress PL1_x, adjusts the power gear to the highest power gear PL1_max, and saves the running time at the power gear PL1_x under scene_x and the freeze duration (the freeze duration is 0s at this time); that is, for the tuple (scene_x, PL1_x), save the running time T1 and the freeze duration (0s).

[0220] 2) The primary secondary scene scene_x does not change to another scene, and the electronic device has been running at power level PL1_x for a specified time period T without experiencing any lag.

[0221] The electronic device saves the current gear exploration progress PL1_x, lowers the power gear by one gear to gear PL1_x-1; and saves the duration of operation at power gear PL1_x under scene_x and the duration of the freeze (the freeze duration is 0s in this case); that is, for the tuple (scene_x, PL1_x), the corresponding running time T and freeze duration (0s) are saved. In this embodiment of the present application, the main secondary scene scene_x can be referred to as the "first main secondary scene", the power gear PL1_x can be referred to as the "first power", and the power gear PL1_x-1 can be referred to as the "second power".

[0222] 3) When running at power level PL1_x, the main secondary scene changes from scene_x to scene_y after T2 duration (T2≤T);

[0223] The electronic device saves the duration of operation at power gear PL1_x under scene_x and the duration of the freeze (the freeze duration is 0s in this case), and saves the gear exploration progress PL1_x under scene_x; that is, for the tuple (scene_x, PL1_x), the corresponding operation time T2 and freeze duration (0s) are saved; in addition, the electronic device will continue to explore lower gears based on the new main secondary scene scene_y, starting with the gear exploration progress PL1_y saved under scene_y. In this embodiment of the present application, the main secondary scene scene_y can be referred to as the "third main secondary scene."

[0224] 4) The vehicle runs at power level PL1_x for a duration of T3 (T3≤T), and a freeze occurs within the duration of T3 for a duration of T4 (T4≤T3);

[0225] The electronic device saves the exploration progress PL1_x and increases the power level by one level to PL1_x+1. It also saves the runtime T3 and the duration T4 of the freeze at power level PL1_x under scene_x. That is, for the binary pair (scene_x, PL1_x), the corresponding runtime T3 and the corresponding freeze duration T4 are saved. In this embodiment of the present application, power level PL1_x+1 can be referred to as the "third power level."

[0226] 5) Switch back to scene_x from other running scenes;

[0227] The electronic device restarts the gear exploration process of the secondary scene scene_x, and continues to explore lower gears based on the gear exploration progress saved under scene_x.

[0228] 6) The total exploration time of the secondary scene scene_x reaches Ts;

[0229] The electronic device ends the gear exploration process for scene_x, and saves the secondary scene feature value corresponding to scene_x and the proportion of the electronic device's freeze duration at different power gears of scene_x as valid data of scene_x.

[0230] Wherein, Ts is greater than or equal to n×T, where n is the number of all adjustable power levels of the CPU's maximum adjustable power. Preferably, Ts=2n×T. In the embodiment of the present application, the duration T can be referred to as the "first duration" and Ts can be referred to as the "second duration."

[0231] From the above gear exploration rules, it can be seen that for a primary and secondary scenario, the electronic device may repeatedly explore a certain power gear, and the electronic device may explore the same power gear multiple times. In this case, for the repeatedly explored power gear, the electronic device will also record multiple running durations duration_delay and multiple freeze durations duration_ttl. The freeze duration ratio corresponding to the power gear can be calculated as DURATION_DELAY / DURATION_TTL; where DURATION_TTL is the sum of the running durations of the electronic device each time it runs at this power gear, and DURATION_DELAY is the sum of the freeze durations of the electronic device each time it runs at this power gear.

[0232] In addition, combined with the aforementioned gear exploration rules, it can be seen that the electronic device's gradual reduction of the CPU's maximum power supply gear from high to low is only a major adjustment trend. In the actual gear exploration process of the secondary scenario, the electronic device may not completely lower the CPU's maximum power supply gear in the direction of high to low. When a freeze occurs, the electronic device will increase the power gear by one gear. This can effectively avoid the impact of data randomness on the accuracy of the results.

[0233] For example, assuming that the probability of an electronic device freezing when running at gear PL1_x in the main secondary scene scene_x is very small, actually 0.05, but when exploring at gear PL1_x, the electronic device runs for 30s and freezes for 3s (a low-probability event). If the power gear is simply lowered, the total running time and total freezing time corresponding to the power gear PL1_x will no longer be updated. Therefore, the electronic device calculates the freezing time corresponding to the power gear PL1_x as 3 / 30=0.1, which is twice the actual freezing probability. However, if the power gear is raised by one gear to PL1_x+1, the probability of the electronic device freezing when running at gear PL1_x+1 in the main secondary scene scene_x is even smaller, and there is a high probability that no freezing will occur within 30s. Therefore, after 30s, the electronic device will lower the power gear by one gear and return to gear PL1_x. Since the probability of an electronic device experiencing lag when running in the secondary scene scene_x at power level PL1_x is very low, it is highly likely that the electronic device will not experience lag within 30 seconds when running at power level PL1_x again. Therefore, the total running time and total lag duration corresponding to power level PL1_x will be updated to 60 seconds and 3 seconds, respectively. The calculated lag duration percentage for power level PL1_x is 3 / 60 = 0.05, which is closer to the actual lag probability for power level PL1_x, thereby reducing or even eliminating the impact of randomness on the accuracy of the results.

[0234] FIG13 exemplarily shows a process in which the electronic device performs gear exploration on the primary and secondary scenes according to the aforementioned gear exploration rules during the cold start phase.

[0235] It is assumed here that the above-mentioned T is 30s, Ts is 600s, and the number of adjustable gears for the maximum power that the CPU can supply is 10 gears (since the lowest gear 1 is very likely to cause user experience, the gear exploration is only carried out to the lowest gear 2 and no further exploration is carried out). As shown in Figure 13, the original data table 1300 is used to record the information obtained by the electronic device when exploring each power gear in each main and secondary scene. This information includes the main and secondary scene parameters of the main and secondary scenes, as well as the running time and freeze time of the electronic device at each gear. In the original data table 1300, each main and secondary scene corresponds to a separate piece of original data. It can be understood that when the electronic device is started for the first time after it is put into use, the original data table 1300 is empty.

[0236] Assume that scene 131 is the first primary-secondary scene entered by the electronic device at time t1 after factory startup. As shown in (A) of Figure 13 , raw data 1301 will be stored as the first raw data entry in raw data table 1300 . From this point on, although not shown in Figure 13 , the electronic device will store the primary-secondary scene parameters for scene 131 in raw data 1301 . Furthermore, the electronic device will also record in raw data 1301 all the gears of the CPU's maximum power supply (100% is gear 10, 90% is gear 9, and so on). Each gear forms a binary tuple with scene 131, which records the operating time and lag duration (percentage of lag duration) of the electronic device at the corresponding power gear. Because the electronic device had not yet explored scene 131 before time t1, the information corresponding to each gear in raw data 1301 shown in (A) of Figure 13 is empty.

[0237] At time t1, the electronic device begins the power gear exploration process for scene 131. According to the aforementioned gear exploration rules, when the exploration begins, the electronic device will adjust the gear of the CPU's maximum power supply to the highest gear 10 and run. After running for 30 seconds, at time t2, if the electronic device does not freeze during the entire operation process, the exploration of gear 10 ends. According to the gear exploration rules, the electronic device will save the current gear exploration progress 10 gears, record the total running time 30 seconds and the freeze time 0 seconds corresponding to the exploration process of gear 10, and lower the power gear by one gear to gear 9, and continue the exploration.

[0238] As shown in (B) in FIG13 , at time t2, the data area corresponding to the 10th gear of the original data 1301 has saved the duration information (30,0), which means that as of time t2, the total duration of the electronic device running at 10th gear under scene 131 is 30s, and the total freeze is 0s. In addition, the electronic device can mark the gear to save the gear exploration progress. For example, in the original data 1301 shown in (B) in FIG13 , there is an exploration progress mark on the 10th gear, indicating that the electronic device's current gear exploration progress for scene1 is 10th gear. It can be understood that the exploration progress mark shown in (B) in FIG13 is only for the convenience of explanation and understanding. In actual application scenarios, it can exist in the electronic device in the form of code, or in the electronic device in a form that can be perceived by other electronic devices. This application does not limit this.

[0239] At time t2, the electronic device begins operating at gear 9. After 10 seconds of operation, at time t3, if the electronic device does not experience any lag during operation, but a level 1 event is triggered, the electronic device's operating scene changes from scene 131 to level 1. According to the exploration rules, the electronic device saves the current gear exploration progress, gear 9, and records the total operating time (10 seconds) and lag duration (0 seconds) corresponding to the exploration of gear 9. It then adjusts the power gear directly to the maximum gear, gear 10.

[0240] As shown in (C) in FIG13 , at time t3 , the data area corresponding to the 9th gear of the original data 1301 already stores the duration information (10, 0), which means that as of time t3 , the electronic device ran scene 131 at the 9th gear for a total of 10 seconds, with a total of 0 seconds of lag.

[0241] Assuming the electronic device doesn't trigger a primary event again within 5 seconds after t3, the primary scene ends. The electronic device re-enters the secondary scene. Here, it's assumed that after the primary scene ends, the electronic device is in scene 131. Then, 5 seconds after t3, at t4, the electronic device re-enters the primary secondary scene 131. At this point, the electronic device continues gear exploration for scene 131, using the gear exploration progress for scene 131 stored in raw data 1301 at gear 9.

[0242] As shown in (D) in FIG13 , at time t4, the data in raw data 1301 has not changed compared to time t3, and the electronic device continues to operate at gear 9 in scene 131. After 30 seconds of operation, at time t5, the electronic device has not experienced any lag during the entire operation process. According to the gear exploration rules, the electronic device saves the gear exploration progress as gear 9, records the operation time of 30 seconds at gear 9 and the lag time of 0 seconds, and then lowers the power gear to gear 8, continuing the gear exploration.

[0243] As shown in (E) in FIG13 , at time t5, the data area corresponding to the 9th gear of the original data 1301 has stored the duration information (40,0), which means that as of time t5, the total duration of the electronic device running in the 9th gear under scene 131 is 40s, and the total freeze is 0s. It should be noted that the duration information (40,0) includes two duration information, namely the duration information (10,0) obtained when running in the 9th gear for the first time, and the duration information (30,0) obtained when running in the 9th gear for the second time. The electronic device can fuse the two duration information to obtain the duration information (40,0) shown in (E) in FIG13 and record it in the original data 1301, or it can record the two duration information (40,0) and (10,0) separately in the original data 1301. This application does not limit this.

[0244] At t5, the electronic device begins operating at gear 8 in scene 131. After 20 seconds of operation, at t6, the electronic device experiences a freeze, which lasts for 0.3 seconds (the 0.3 seconds spans from 19.7 seconds to 20 seconds after t5). According to the exploration rules, the electronic device saves the current gear exploration progress at gear 8, records the total operating time of 20 seconds and the freeze duration of 0.3 seconds corresponding to the exploration process at gear 8, and then increases the power gear to gear 9 to continue exploration.

[0245] As shown in (F) in FIG13 , at time t6, the data area corresponding to the 8th gear of the original data 1301 already stores the duration information (20, 0.3). This means that as of time t6, the electronic device ran scene 131 at the 8th gear for a total of 20 seconds, with a total freeze of 0.3 seconds.

[0246] At time t6, the electronic device resumes operation at gear 9 under scene 131. After running for 10 seconds, at time t7, the electronic device has not been stuck during the entire operation process, but the main secondary scene in which the electronic device is running has changed from scene 131 to main scene 132 (here it is assumed that the electronic device enters main scene 132 for the first time). According to the exploration rules, the electronic device will save the gear exploration progress of scene 131 at gear 9, and record the running time of 10 seconds and the stuck time of 0 seconds when running at gear 9 under scene 131. In addition, the electronic device will also start gear exploration of the new main secondary scene scene 132, and create a new raw data 1302 in the raw data table 1300 to save the information obtained when exploring the gear of scene 132.

[0247] As shown in (G) in FIG13 , at time t7, the data area corresponding to the 9th gear of the original data 1301 already contains the duration information (50,0), which means that as of time t7, the electronic device has been running in the 10th gear under scene 131 for a total of 50 seconds, with a total of 0 seconds of lag. Similarly, the duration information (50,0) is obtained by fusing three duration information, namely (10,0), (30,0), and (10,0). For details, please refer to the above description, and will not be repeated here or in subsequent embodiments. In addition, a new raw data 1302 is added to the original data table 1300. However, since the electronic device has not yet explored the gear position of scene 132 before time t7, the information corresponding to each gear position in the original data 1302 shown in (G) in FIG13 is empty.

[0248] At t7, the electronic device begins gear exploration for scene 132. Similarly, the electronic device adjusts the CPU's maximum power supply to the highest gear, 10, and continues operating. After 30 seconds of operation, at t8, the electronic device experiences no lags throughout the entire operation. The electronic device saves the current gear exploration progress, 10 gears, and records the total runtime of 30 seconds and the lag duration of 0 seconds for the exploration of gear 10. It then lowers the power gear to 9 and continues exploration.

[0249] As shown in (H) in FIG13 , at time t8 , the data area corresponding to gear 10 in raw data 1302 already contains duration information (30, 0). This indicates that as of time t8 , the electronic device has been operating in gear 10 for a total of 30 seconds in scene 132, with a total of 0 seconds of stalling. Furthermore, the electronic device can mark gear 10 to preserve its gear exploration progress for scene 132.

[0250] In the subsequent operation process, the electronic device will encounter more and more main and secondary scenes under the operation of the user, and the amount of raw data stored in the raw data table 1300 will also increase. Similarly, in the subsequent operation process, the electronic device will be in the same secondary scene many times in succession. For example, the main secondary scene of the electronic device may switch back to scene 131 again in the subsequent operation process. For any main and secondary scene, when the total operating time of the electronic device in the main and secondary scene reaches 600s, it can be regarded as that the electronic device has completed the gear exploration process of the main and secondary scene, that is, the electronic device can basically determine the optimal power gear of the main and secondary scene through the acquired data. At this time, the raw data corresponding to the main and secondary scene is valid data, and the main and secondary scene can be called a valid main and secondary scene. After any main and secondary scene obtains its corresponding valid data, the cold start phase also ends accordingly, and the electronic device enters the statistical phase.

[0251] It should be noted that for a valid primary / secondary scenario for which valid data has been obtained, the electronic device does not necessarily need to explore all power gears within that primary / secondary scenario. For example, assume there is a secondary scenario, scene 133, and the electronic device is exploring a new secondary scenario, scene 132, using the optimal power exploration strategy. Assume that each time the electronic device runs scene 133 in gear 4, it experiences a freeze. Because of this freeze, the electronic device needs to increase the gear to gear 5. Therefore, it is likely that after the total operating time in scene 133 reaches 600 seconds, the electronic device does not run in gears 3 and 2 in scene 133. Therefore, the information corresponding to these gears in the valid data corresponding to scene 133 is also empty. However, since the electronic device freezes every time it runs in gear 4 under scenario 133, it is highly likely that freezing will also occur frequently when running in gears below gear 4 under scenario 133. In other words, running in gear 3 or 2 under scenario 133 will seriously damage the user experience. Gears 3 and 2 are highly likely not the optimal power gears for scenario 133, so it is not important whether to explore gears 3 and 2 under scenario 133. In the subsequent model training process, when processing valid data to obtain gear mark data, the electronic device can set the label value of the gear with no information in the valid data to "0", indicating that running in these gears will cause a damage to the user experience.

[0252] ② [Statistical stage] Valid data: [1, X), gear determination method: For non-valid primary and secondary scenarios, the optimal power exploration strategy is used for gear exploration; for valid primary and secondary scenarios, the optimal frequency gear reading method is used, that is, based on the jamming probability of each gear in its corresponding valid data, the lowest gear with a jamming probability value less than or equal to a certain threshold is determined as the optimal power gear.

[0253] Unlike the cold start phase, during the statistics phase, the electronic device already has valid data for some primary and secondary scenarios (the number of valid data items is less than X, where X is the minimum number of valid data items required for model training). In this phase, some invalid primary and secondary scenarios still exist, including primary and secondary scenarios that the electronic device has not yet encountered, and primary and secondary scenarios that the electronic device has encountered but whose total runtime has not yet reached 600 seconds.

[0254] In this stage, when the main secondary scene in which the electronic device is located is a valid secondary scene, the electronic device can determine the optimal power level corresponding to the secondary scene based on the proportion of the lag time under different power levels recorded in the valid data corresponding to the valid secondary scene, and adjust the maximum power level that the CPU can supply to the optimal power level.

[0255] However, if the primary secondary scenario is not a valid primary secondary scenario, the electronic device cannot yet determine the optimal power level for that non-valid primary secondary scenario. Therefore, the electronic device will continue to explore the power level for that non-valid primary secondary scenario according to the aforementioned optimal exploration strategy, i.e., operating at the power level saved in the exploration progress. For secondary scenarios never encountered before, the exploration will begin at the highest power level that the electronic device can provide, based on the maximum power that the CPU can supply.

[0256] Figure 14 shows the specific contents of the raw data table stored in the electronic device at a certain moment in the statistical phase. As shown in Figure 14, the raw data table 1400 records the raw data of multiple secondary scenarios. Among them:

[0257] Scene 141 is a valid primary secondary scene, and the raw data 1401 recorded in the raw data table 1400 is the valid data of scene 141 .

[0258] Scene 142 is a non-valid primary secondary scene that the electronic device has encountered but the total running time has not yet reached 600 seconds. As can be seen from the original data table 1400, the gear exploration progress of the electronic device in scene 142 is 6 gears.

[0259] Scene 143 is a non-valid primary secondary scene that the electronic device has never encountered.

[0260] It should be noted that the running time and freeze duration information recorded for each gear in raw data table 1400 have been converted into freeze duration percentages (the probability of freeze). Furthermore, raw data 1403 shown in raw data table 1400 is for illustrative purposes only; in reality, if scene 143 had not yet occurred, raw data 1403 might not be present in raw data table 1400.

[0261] Assume that the current operating scenario of electronic devices changes:

[0262] 1) If the running scene after the change is a level one scene.

[0263] The electronic device directly adjusts the maximum power supply of the CPU to the maximum gear until the first-level scene changes to the second-level scene.

[0264] 2) If the running scene after the change is a secondary scene, and the main secondary scene is scene 141.

[0265] The electronic device can query the original data table 1400 based on the main secondary scene parameters of scene 141. After obtaining the valid data 1401 of scene 14, the optimal power gear for scene 141 is determined based on the valid data 1401. Here, a threshold of 0.03 is used as an example for explanation. Assuming that in the valid data of a certain main secondary scene, when the proportion of the lag duration corresponding to a power gear is less than or equal to 0.03, it means that running the main secondary scene at this gear will not harm the user experience, otherwise it will harm the user experience. For scene 141, the electronic device can start from the highest gear in the valid data 1401 and search downwards, and finally determine the smallest gear (i.e., gear 5) with a gear corresponding probability value less than or equal to 0.03 as the optimal power gear. Afterwards, under scene 141, the electronic device will adjust the gear of the maximum power that the CPU can supply to gear 5.

[0266] 3) If the running scene after the change is a secondary scene, and the main secondary scene is scene 142.

[0267] The electronic device can query raw data table 1400 based on the primary and secondary scene parameters of scene 142 to determine raw data 1402 corresponding to scene 142. After determining that raw data 1402 is invalid data, the electronic device obtains the saved gear exploration progress (gear 6) for scene 142, adjusts the gear at which the CPU can supply maximum power to gear 6, and continues to complete the gear exploration process for scene 142 according to the gear exploration rules described above.

[0268] 4) If the running scene after the change is a secondary scene, and the main secondary scene is scene 143.

[0269] The electronic device may query raw data table 1400 based on the primary and secondary scene parameters for scene 143. After determining that scene 143 is an unprecedented scene, the electronic device may create a new raw data entry 1403 in raw data table 1400. However, at this point, the data areas corresponding to all gears in raw data 1403 are empty. The electronic device may then perform a gear exploration for scene 143, starting with gear 10, the highest CPU power supply, according to the aforementioned gear exploration rules, and record the percentage of lag duration at each gear.

[0270] ③ [Prediction stage] Valid data: [X, +∞), gear determination method: optimal power gear prediction method - that is, based on obtaining the main and secondary scenario parameters of the main and secondary scenarios as the input of the prediction model, the prediction model outputs the probability of user experience being impaired when running at various power gears under the main and secondary scenarios, and determines the minimum power gear with a probability value less than or equal to a certain threshold as the optimal power gear.

[0271] In the prediction stage, the electronic device obtains enough (≥X) valid data and trains a corresponding power prediction model based on these valid data. That is to say, in this stage, the electronic device has performed model training based on the stored valid data, obtained the power prediction model in the above description and deployed it in the electronic device. Therefore, in this stage, when the electronic device is in a certain main secondary scene, regardless of whether the main secondary scene is a valid secondary scene or a non-valid secondary scene, the electronic device can determine the optimal power gear of the main secondary scene through the above power prediction model. Specifically, the electronic device can input the main secondary scene parameters of the main secondary scene into the power prediction model, and the power prediction model can output the probability of the user experience being impaired when running at each power gear under the main secondary scene. Afterwards, the electronic device can use a certain threshold (for example, 0.5) as a benchmark to determine the minimum power gear with a corresponding probability value less than or equal to the threshold as the optimal power gear of the main secondary scene, and adjust the gear of the CPU's maximum power supply to the optimal power gear.

[0272] It should be noted that in the three stages described above, the electronic device's adjustment of the CPU's maximum power level for different primary and secondary scenarios can only occur when the electronic device is unplugged (i.e., not charging). When the electronic device is charging, since the electronic device has sufficient power supply, the electronic device does not need to adjust the CPU's maximum power level based on the operating scenario. Instead, the CPU's maximum power level is always maintained at the maximum level, prioritizing the performance requirements of the electronic device.

[0273] Figure 15 is a logical architecture diagram of a power prediction method provided by an embodiment of the present application, which shows the specific logic of the electronic device determining the power gear to be adjusted for the secondary scenario, determining the user experience after adjusting the power gear, and updating the power adjustment algorithm based on the user experience. As shown in Figure 15, the logical architecture includes: operating environment, operating scenario, AI algorithm, adjustment strategy and result feedback. Among them:

[0274] The operating environment specifically refers to all relevant data that the electronic device can currently collect, such as the usage of the mouse and keyboard, the specific performance parameters of the CPU and GPU, the brightness of the electronic device screen, whether the electronic device uses a camera, whether the electronic device plays audio, etc.

[0275] The operating scenario can be considered as an operating state that reflects the current performance requirements of the electronic device. It can select relevant data that affects the performance of the electronic device from all the data collected by the operating environment. After combining these data, a unique operating scenario is obtained. Among them, when the data corresponding to the operating environment indicates that a first-level event such as a mouse click or a keyboard shortcut key is operated occurs, the operating scenario is a first-level scenario. When the data corresponding to the operating environment indicates that a first-level event has not occurred, the operating scenario is a second-level scenario. At this time, the electronic device can also obtain all the second-level scenario parameters corresponding to the second-level scenario based on the data corresponding to the operating environment.

[0276] The AI ​​algorithm may include the method for determining the maximum power supply level of the CPU to be adjusted (hereinafter referred to as the power level to be adjusted) in the first-level scenario described above, and the method for determining the power level to be adjusted in the second-level scenario. For details, please refer to the aforementioned relevant instructions and will not be repeated here. When determining the maximum power supply level of the CPU to be adjusted based on the AI ​​algorithm in the second-level scenario, the AI ​​algorithm takes the scene parameters of the second-level scene (the scene parameters include the main second-level scene parameters and may also include the auxiliary second-level scene parameters) as input, and the output is the power level to be adjusted.

[0277] The adjustment strategy is used to send and execute the power level to be adjusted output by the AI. It can correspond to the CPU performance adjustment module in the electronic device. The CPU performance adjustment module can exist in the electronic device in the form of program code. It can include a storage address for recording the gear value of the current maximum power supplyable by the electronic device's CPU. After the CPU performance adjustment module obtains the power level to be adjusted, the CPU performance adjustment module can change the gear value of the current maximum power supplyable by the electronic device's CPU based on the above storage address to complete the adjustment of the gear value of the maximum power supplyable by the CPU.

[0278] Feedback is the feedback generated by adjusting the CPU's maximum power level to the desired power level, affecting the operating environment. This feedback can be categorized as positive or negative based on the device's operational flow. Positive feedback indicates a positive benefit from the desired power level just issued by the AI ​​(i.e., the device experienced no lags when operating at the desired power level), while negative feedback indicates a negative benefit (i.e., the device experienced lags when operating at the desired power level).

[0279] AI will further iterate and optimize the algorithm step by step through the positive and negative feedback in the result feedback. It can be understood that the result feedback exists in the entire working process of the electronic device. For example, in the cold start stage, when the electronic device is running in a certain gear and the running time reaches T without any lag, the electronic device will consider the feedback generated when running in this gear as positive feedback, and the electronic device will adjust the gear down one gear; if the electronic device is running in this gear and the running time does not reach T, the electronic device will consider the feedback generated when running in this gear as negative feedback, and the electronic device will adjust the gear up one gear. For example, in the prediction stage, after the electronic device determines the gear to be adjusted based on the power prediction model and adjusts the gear with the maximum power that the CPU can supply to the gear to be adjusted, the electronic device will also count the feedback data (if the lag time recorded in the feedback data is 0, the feedback is positive feedback, and if it is not 0, it is negative feedback), and update the power prediction model based on the obtained feedback data.

[0280] Figure 16 shows a system architecture provided in an embodiment of the present application, which can be used to train and run the above-mentioned prediction model. As shown in Figure 16, the electronic device 100 can be the electronic device provided in the present application in the aforementioned description. The electronic device 100 can be communicatively connected or electrically connected to multiple input devices 200 (not shown in Figure 16), such as a mouse and a keyboard. Specifically, some of the devices in the input device 200 are integrated on the electronic device 100; for example, when the electronic device 100 is a laptop computer, the keyboard included in the input device 200 can be integrated with the electronic device 100 on the same device body.

[0281] Specifically, the electronic device 100 may include a data acquisition module 1001, a data processing module 1002, a data storage module 1003, a training module 1004, an execution module 1005, and a charging module 1010; wherein:

[0282] The data collection module 1001 is used to collect valid data. The specific collection method can refer to the relevant description of step S101 in the above method embodiment, which will not be repeated here.

[0283] When the amount of valid data is greater than a certain threshold, the data processing module 1002 is used to pre-process all valid data collected by the data collection module 1001. The specific processing method can be referred to the above description of FIG4 and will not be repeated here.

[0284] The data storage module 1003 is used to store valid data collected by the data acquisition module 1001. Furthermore, the data storage module is also used to store data obtained from pre-processing the valid data by the data processing module 1002, such as a mapping table for recording the mapping between focus application names and focus application numbers, a gear marking table for recording whether a power gear has a negative impact on the user experience, and finally, a training set for input into the prediction model for training (for details, please refer to the aforementioned description of FIG. 4 ).

[0285] After the valid data is converted into a training set, the training module 1004 is used to perform model training using the training set stored in the data storage module 1003 to obtain a power prediction model 1007 , and integrate the power prediction model 1007 into the calculation module 1006 .

[0286] Optionally, before training the power prediction model 1007, the charging module 1010 can first identify whether the user is in a charging state; in the charging state, the charging module 1010 will send an execution instruction to the training module 1004. Only after receiving the execution instruction will the training module 1004 start training to ensure that the electronic device can provide sufficient power for the model training process.

[0287] The power prediction model 1007 can predict the probability of a user experience impairment corresponding to each power level in the primary and secondary scenarios currently being run by the electronic device based on the primary and secondary scenario parameters. Furthermore, the calculation module 1006 can use the probability of a user experience impairment corresponding to each power level in the secondary scenario output by the power prediction model to determine the optimal power level for the secondary scenario based on the lowest level with an impairment probability less than or equal to 0.5, and send this optimal power level to the CPU performance adjustment module 1009.

[0288] After receiving the optimal power level, the CPU performance adjustment module 1009 may adjust the maximum power level that can be supplied to the CPU of the electronic device 100 to the optimal power level.

[0289] In addition, when a user operates through the interface provided by the I / O interface 1008, such as clicking a mouse button or inputting an operation through a keyboard shortcut, this can be regarded as the electronic device 100 triggering a level 1 event, and the scenario in which the electronic device 100 is running is a level 1 scenario. In this case, the I / O interface 1008 can send the corresponding instruction or information to the CPU performance adjustment module 1009, and the CPU performance adjustment module 1009 can directly adjust the gear of the maximum power supply of the CPU to the maximum gear. Specifically, the CPU performance adjustment module 1009 can exist in the electronic device 100 in the form of program code, and it can include a storage address, which is used to record the gear value of the current maximum power supply of the CPU of the electronic device. When the CPU performance adjustment module 1009 receives an instruction or information for adjusting the gear of the maximum power supply of the CPU, the CPU performance adjustment module 1009 can change the gear value of the current maximum power supply of the CPU of the electronic device based on the above-mentioned storage address to complete the adjustment of the gear of the maximum power supply of the CPU.

[0290] Optionally, the CPU performance adjustment module 1009 may also receive a control instruction issued by the charging module 1010, which is used to indicate whether the electronic device 100 is currently in a charging state. When the control instruction indicates that the electronic device 100 is currently in a charging state, the CPU performance adjustment module 1009 may no longer use the optimal power level issued by the calculation module 1006 as a reference to adjust the maximum power level of the CPU. That is, when the electronic device 100 is in a charging state and the power supply is sufficient, the prediction model 1007 may no longer be effective, and the CPU performance adjustment module 1009 may directly adjust the maximum power level of the CPU to the maximum power level and maintain the maximum power level at all times, prioritizing the performance requirements of the electronic device. When the control instruction indicates that the electronic device 1000 is currently not in a charging state, the CPU performance adjustment module 1009 will again use the optimal power level issued by the calculation module 1006 as a reference to adjust the maximum power level of the CPU of the electronic device 100 to the optimal power level, thereby ensuring a balance between the performance and power consumption of the electronic device 100.

[0291] It can be understood that Figure 15 is only a schematic diagram of a system architecture provided by an embodiment of the present application. The positional relationship between the devices, components, modules, etc. shown in the figure does not constitute any limitation. For example, in Figure 16, the data storage module 1003 is an internal memory in the electronic device 100. In other cases, the data storage module 1003 can also be placed outside the electronic device 100.

[0292] Next, the electronic device provided by this application is introduced.

[0293] The electronic device may be a mobile phone, a tablet computer, a wearable device, an in-vehicle device, an augmented reality (AR) / virtual reality (VR) device, a laptop computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), or a dedicated camera (such as a SLR camera or a compact camera). This application does not impose any restrictions on the specific type of the electronic device.

[0294] FIG17 exemplarily shows the structure of the electronic device.

[0295] 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 audio module 170, a speaker 170A, a microphone 170C, a headphone interface 170D, a button 190, an indicator 192, a camera 193, a display screen 194, etc.

[0296] It should be understood that the structure illustrated in the embodiments 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, or may combine or separate certain components, or arrange the components differently. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0297] The processor 110 may include one or more processing units. For example, the processor 110 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU). The different processing units may be independent devices or integrated into one or more processors.

[0298] The controller can generate operation control signals according to the instruction operation code and timing signal to complete the control of instruction fetching and execution.

[0299] Processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in processor 110 is a cache memory. This memory can store instructions or data that have just been used or are being recycled by processor 110. If processor 110 needs to use the instruction or data again, it can directly retrieve it from the memory. This avoids duplicate accesses, reduces processor 110 latency, and thus improves system efficiency.

[0300] The charging management module 140 is configured to receive charging input from a charger. The charger can be either a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 can receive charging input from the wired charger via the USB interface 130. In some wireless charging embodiments, the charging management module 140 can receive wireless charging input via the wireless charging coil of the electronic device 100. While charging the battery 142, the charging management module 140 can also provide power to the electronic device via the power management module 141.

[0301] 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 provides power to the processor 110, the internal memory 121, the display 194, the camera 193, etc. The power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle count, and battery health status (leakage, impedance). In some other embodiments, the power management module 141 can also be provided in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 can also be provided in the same device.

[0302] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel.

[0303] The camera 193 is used to capture still images or videos.

[0304] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 via the external memory interface 120 to implement data storage functions. For example, files such as music and videos can be stored on the external memory card.

[0305] The internal memory 121 can be used to store computer executable program codes, which include instructions. 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. The processor 110 executes various functional applications and data processing of the electronic device 100 by running instructions stored in the internal memory 121 and / or instructions stored in a memory provided in the processor.

[0306] The electronic device 100 can implement audio functions such as music playback and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.

[0307] The audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. The audio module 170 can also be used to encode and decode audio signals. In some embodiments, the audio module 170 can be provided in the processor 110, or some functional modules of the audio module 170 can be provided in the processor 110.

[0308] The speaker 170A, also called a "speaker", is used to convert audio electrical signals into sound signals. The electronic device 100 can listen to music or listen to hands-free calls through the speaker 170A.

[0309] The receiver 170B, also called a "handset", is used to convert audio electrical signals into sound signals. When the electronic device 100 receives a call or a voice message, the user can place the receiver 170B close to the ear to hear the voice.

[0310] Microphone 170C, also known as "microphone" or "microphone", is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can speak by putting their mouth close to the microphone 170C to input the sound signal into the microphone 170C. The electronic device 100 can be provided with at least one microphone 170C. In other embodiments, the electronic device 100 can be provided with two microphones 170C, which can not only collect sound signals but also realize noise reduction function. In other embodiments, the electronic device 100 can also be provided with three, four or more microphones 170C to collect sound signals, reduce noise, identify the source of sound, realize directional recording function, etc.

[0311] The headphone jack 170D is used to connect a wired headphone and can be a USB interface 130 or a 3.5mm Open Mobile Terminal Platform (OMTP) standard interface or a Cellular Telecommunications Industry Association of the USA (CTIA) standard interface.

[0312] The buttons 190 include a power button, a volume button, and the like. The buttons 190 may be mechanical buttons or touch buttons. The electronic device 100 may receive key inputs and generate key signal inputs related to user settings and function control of the electronic device 100.

[0313] The indicator 192 may be an indicator light, which may be used to indicate the charging status, power level changes, messages, missed calls, notifications, etc.

[0314] The processor 110 is configured to collect valid data of the primary and secondary scenarios in the primary and secondary scenarios and train the power prediction model based on the collected valid data. The electronic device 100 may store the collected valid data in a memory within the processor 110 or in an external memory connected via the external memory interface 120.

[0315] Specifically, when the amount of valid training data is sufficient, the charging management module 140 may send first information to the processor 110, and the display screen 194 may send second information to the processor 110 through a corresponding interface. The processor 110 will trigger the process of training the above-mentioned power prediction model only when the first information indicates that the electronic device 100 is currently in a charging state and the second information indicates that the display screen of the electronic device is in an off state (the electronic device 100 is still in a powered-on state).

[0316] During the operation of the electronic device 100, if the electronic device 100 is in a charging state, the charging management module 140 can send a third information to the processor 110, and the third information is used to notify the processor 110 that the electronic device 100 is currently in a charging state, so that the processor 110 keeps the maximum supplyable power gear at the maximum power gear.

[0317] If the electronic device 100 is in a powered-off state, the processor 110 can identify the operating scenario characteristics of the electronic device 100 and determine the power value or power level that needs to be adjusted based on the operating scenario type. The specific determination method can be referred to the above description of Figures 2, 12, and 13.

[0318] An embodiment of the present application further provides an electronic device, the electronic device comprising: one or more processors and a memory;

[0319] The memory is coupled to the one or more processors, and the memory is used to store computer program code, which includes computer instructions. The one or more processors call the computer instructions to enable the electronic device to execute the method shown in the above embodiment.

[0320] As used in the above embodiments, the term “when…” may be interpreted to mean “if…” or “after…” or “in response to determining…” or “in response to detecting…”, depending on the context. Similarly, the phrases “upon determining…” or “if (stated condition or event) is detected” may be interpreted to mean “if determining…” or “in response to determining…” or “upon detecting (stated condition or event)” or “in response to detecting (stated condition or event)”, depending on the context.

[0321] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When software is used for implementation, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website, computer, server or data center to another website, computer, server or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrations. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk).

[0322] Those skilled in the art will appreciate that all or part of the process steps in the above-described method embodiments can be implemented by a computer program instructing the relevant hardware. The program can be stored in a computer-readable storage medium, and when executed, the program can include the process steps in the above-described method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as ROM or random access memory (RAM), magnetic disks, or optical disks.

[0323] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any modifications or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in the present invention should be included in the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be based on the scope of protection of the claims.

Claims

1. A power adjustment method, characterized in that: The method comprises: A first primary-secondary event is detected, and it is determined that the electronic device is in a first primary-secondary scene, wherein the first primary-secondary event includes an event in which the electronic device runs a focus application when no primary event is detected; Predicting the first primary and secondary scenarios based on the power prediction model, obtaining a first prediction result, the first prediction result including maximum power supplies of multiple CPUs, and corresponding probabilities of impaired user experience when the multiple CPUs are respectively operated at the maximum power supplies of the multiple CPUs in the first primary and secondary scenarios, the probability of impaired user experience being a probability that a proportion of freeze duration when the CPU is operated at the maximum power supplies of the CPU is greater than a first threshold; The maximum power that can be supplied by the CPU of the electronic device is adjusted according to the first optimal power, where the first optimal power is determined by the minimum power in the first prediction result that meets the first condition, and the first condition is that the probability of impaired user experience is less than or equal to a second threshold.

2. The method according to claim 1, characterized in that After adjusting the maximum supply power of the CPU of the electronic device according to the first optimal power, the method further includes: A primary event is detected, and it is determined that the scene in which the electronic device is located is switched from the first main secondary scene to the primary scene, where the primary scene includes an operation scene in which the electronic device detects an interaction event; The maximum power that can be supplied by the CPU of the electronic device is adjusted to the maximum power.

3. The method according to claim 1 or 2, characterized in that: After adjusting the maximum supply power of the CPU of the electronic device according to the first optimal power, the method further includes: A second primary-secondary event is detected, and it is determined that the scene of the electronic device is switched from the first primary-secondary scene to a second primary-secondary scene, and the second primary-secondary scene is different from the first primary-secondary scene; Predicting the second primary and secondary scenarios based on the power prediction model to obtain a second prediction result, the second prediction result including the maximum power that can be supplied by the multiple CPUs and corresponding probabilities of impaired user experience when the multiple CPUs are respectively operated at the maximum power that can be supplied by the multiple CPUs in the second primary and secondary scenarios; The maximum power that can be supplied by the CPU of the electronic device is adjusted according to the second optimal power, and the second optimal power is determined by the minimum power that meets the first condition in the second prediction result.

4. The method according to any one of claims 1 to 3, characterized in that: Before adjusting the maximum power that can be supplied by the CPU of the electronic device according to the first optimal power, the method further includes: A first auxiliary-secondary event is detected, and it is determined that the electronic device is in a first auxiliary-secondary scenario, wherein the first auxiliary-secondary event includes a running scenario related to a background application when no interaction event is detected; Predicting the first auxiliary-secondary scenario based on the power prediction model, obtaining a third prediction result, the third prediction result including the maximum power that can be supplied by the multiple CPUs, and corresponding probabilities of impaired user experience when the multiple CPUs are respectively operated at the maximum power that can be supplied by the multiple CPUs in the first auxiliary-secondary scenario; The step of adjusting the maximum power that can be supplied by the CPU of the electronic device according to the first optimal power comprises: The maximum power that can be supplied by the CPU of the electronic device is adjusted to the maximum of the first optimal power and the first optimal power. Power, the first optimal power is determined by the minimum power that meets the first condition in the third prediction result.

5. The method according to any one of claims 1 to 4, characterized in that: Before detecting that the electronic device is in the first primary and secondary scenes, the method further includes: Acquire a training data set according to a valid data set; the training data set includes training data of multiple main-secondary scenarios, the main-secondary scenarios include scenarios related to a focus application when the electronic device does not detect an interaction event, the training data includes label values ​​corresponding to the maximum power that can be supplied by each CPU in the main-secondary scenario, the label values ​​include a first label value and a second label value, the first label value indicates that the probability of a freeze when the electronic device is running at the corresponding power is less than or equal to the first threshold, and the second label value indicates that the probability of a freeze when the electronic device is running at the corresponding power is greater than the first threshold; The power prediction model is trained according to the training data set.

6. The method according to claim 5, characterized in that The valid data set includes valid data of multiple primary and secondary scenarios, and the valid data includes the operating time and freezing time of the electronic device respectively running at the maximum power supply of multiple different CPUs in the primary and secondary scenarios; The acquiring of the training data set according to the valid data set comprises: Determine the percentage of freeze duration of the electronic device in the valid data when the electronic device is respectively operated at the maximum power that can be supplied by multiple CPUs, where the percentage of freeze duration is the ratio of freeze duration to operating duration; When the proportion of the freeze duration is less than or equal to the first threshold, the label value of the maximum CPU power that can be supplied corresponding to the valid data is determined as the first label value; when the proportion of the freeze duration is greater than the first threshold, the label value of the maximum CPU power that can be supplied corresponding to the valid data is determined as the second label value.

7. The method according to claim 5 or 6, characterized in that: Before acquiring the training data set according to the valid data set, the method further includes: In the first primary-secondary scenario, the CPU operates at a first power with a maximum power that can be supplied by the CPU; When the duration of operation at the first power reaches a first duration and no lag occurs, the maximum CPU supply power is adjusted to a second power; the first power and the second power are included in the maximum supply powers of the multiple different CPUs, the second power is less than the first power, and the valid data set includes valid data of the first main-secondary scene, and the valid data of the first main-secondary scene includes the operating duration and lag duration of operation at the first power.

8. The method according to claim 7, characterized in that The method further comprises: When the duration of operation at the first power does not reach the first duration and a freeze occurs, the maximum power that the CPU can supply is adjusted to a third power; the third power is included in the multiple different maximum power that the CPU can supply, and the third power is greater than the first power, and the valid data of the first main-secondary scenario includes the operation duration and the freeze duration when running at the first power and the third power.

9. The method according to claim 7 or 8, characterized in that: The method further comprises: When the electronic device is running at the first power in the first main-secondary scene, a third main-secondary event is detected, and it is determined that the scene in which the electronic device is located is switched from the first main-secondary scene to a third main-secondary scene, and the third main-secondary scene is different from the first main-secondary scene; The exploration progress of the first main secondary scene is saved as the first power, where the exploration progress is the maximum power that can be supplied by the CPU used by the electronic device when it enters the corresponding operation scene next time; Determine the exploration progress of the third main-secondary scene, adjust the maximum power that can be supplied by the CPU of the electronic device to the power corresponding to the exploration progress of the third main-secondary scene, and the valid data set also includes valid data of the third main-secondary scene.

10. The method according to any one of claims 7 to 9, characterized in that: The valid data of the first main-secondary scenario includes the operating time and the lag time of the electronic device running at the maximum power supplyable by the multiple different CPUs in the second time when the total operating time of the electronic device in the first main-secondary scenario reaches the second time.

11. The method according to claim 8, characterized in that The first duration is 30 seconds, and / or the second duration is 600 seconds.

12. The method according to any one of claims 6 to 9, characterized in that: The amount of running data in the training data set is greater than a third threshold.

13. The method according to any one of claims 1 to 3, characterized in that: The step of adjusting the maximum power supplied by the CPU of the electronic device according to the optimal power comprises: Adjusting the maximum power supplied by the CPU of the electronic device to the optimal power; Or, the maximum supply power of the CPU of the electronic device is adjusted to the target power, the target power is the maximum supply power of the CPU among the optimal power, the fourth power and the fifth power, the fourth power is less than the target power, the fifth power is greater than the target power, the fourth power and the fifth power belong to the multiple different maximum supply powers of the CPUs, and the difference between the optimal power and the fourth power, and the difference between the optimal power and the fifth power are both less than a fourth threshold.

14. The method according to claim 4, characterized in that The background application is an application that has a higher CPU load except the focus application.

15. The method according to any one of claims 1 to 14, characterized in that After adjusting the maximum power supplied by the CPU of the electronic device according to the optimal power, the method further includes: Collect feedback data, where the feedback data includes the operation time and the freezing time of the CPU at the adjusted maximum power supply; The power prediction model is updated according to the feedback data.

16. An electronic device, characterized in that: The electronic device comprises: one or more processors, a memory and a display screen; The memory is coupled to the one or more processors, and the memory is used to store computer program codes, wherein the computer program codes include computer instructions, and the one or more processors call the computer instructions to enable the electronic device to execute the method according to any one of claims 1 to 15.

17. A chip system, characterized in that: The chip system is applied to an electronic device, and the chip system includes one or more processors, and the processor is used to call computer instructions so that the electronic device executes the method as described in any one of claims 1-15.

18. A computer-readable storage medium comprising instructions, characterized in that: When the instructions are executed on an electronic device, the electronic device is caused to execute the method as claimed in any one of claims 1 to 15.

Citation Information

Patent Citations

  • Method and device for switching central processing unit (CPU) working modes according to application scenarios

    CN103529925A

  • Power supply power distribution method of electronic device, electronic device and readable storage medium

    CN110442224A

  • Resource optimization method and device based on user usage scenario

    CN113641488A

  • Resource scheduling method and electronic equipment

    CN116028205A

  • Resource scheduling method, electronic equipment and storage medium

    CN116028210A