Power adjustment method and related device

By detecting the main secondary scenario in electronic devices and adjusting the maximum power supply of CPU using the power prediction model, the problem of how to reduce the power consumption of electronic devices without affecting the user experience is solved, and the effect of extending the service life of the device is achieved. .

CN119440219AActive Publication Date: 2025-02-14HONOR DEVICE CO LTD

Patent Information

Application Number
CN202310963633.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-07-31
Publication Date
2025-02-14
Estimated Expiration
2043-07-31

AI Technical Summary

Technical Problem

How to reduce the power consumption of electronic devices and extend the service life of the device without affecting the user experience, especially when there is no charging conditions.

Method used

By detecting the main secondary scenario in which the electronic device is located, the power prediction model is used to predict the user experience loss probability of the maximum power available to different CPUs in this scenario, adjust the maximum power available to the CPU to achieve the optimal power, and ensure the lowest power consumption.

Benefits of technology

On the premise of ensuring user experience, it effectively reduces the power consumption of electronic devices and extends the service life of the device, solving the problem of automatic shutdown of equipment due to exhaustion of electricity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119440219A_ABST
    Figure CN119440219A_ABST
Patent Text Reader

Abstract

The invention provides a power adjustment method and a related device. By implementing the method, the electronic equipment can determine the optimal power of the maximum available power of the CPU in the main and secondary scenes according to the main and secondary scenes, so that the power consumption of the electronic equipment is reduced as much as possible on the premise of ensuring the user experience, and the service life of the electronic equipment is effectively prolonged.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] With the development of science and technology, devices such as desktop computers and laptops have become indispensable items in people's lives, work and entertainment. However, since such devices often need to process a large amount of data, they consume power very quickly; especially for portable devices such as laptops, users may need to use them in an environment without charging conditions. If the power consumption of the device is too fast, the device may automatically shut down due to power exhaustion during the user's use, causing inconvenience to the user.

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

[0004] The purpose of this application is to provide a power adjustment method and related devices. By implementing this method, the electronic device can determine the optimal power that the CPU can supply in the main and secondary scenarios according to the main and secondary scenarios, reduce the power consumption of the electronic device as much as possible while ensuring the user experience, and effectively extend the use time of the electronic device.

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

[0006] In a first aspect, the present application provides a power adjustment method, the method comprising: detecting a first main-secondary event, determining that the electronic device is in a first main-secondary scenario, the first main-secondary event comprising an event in which the electronic device runs a focus application without detecting a first-level event; predicting the first main-secondary scenario based on a power prediction model to obtain a first prediction result, the first prediction result comprising a plurality of maximum CPU supply powers, and corresponding probabilities of impaired user experience when the plurality of CPUs are respectively operated at the maximum CPU supply powers in the first main-secondary scenario, the probability of impaired user experience being the probability that the proportion of lag time when the CPU is operated at the maximum CPU supply power is greater than a first threshold; adjusting the maximum CPU supply power of the electronic device according to a first optimal power, the first optimal power being determined by the minimum power in the first prediction result that meets a first condition, the first condition being that the probability of impaired user experience is less than or equal to a second threshold.

[0007] In this method, the first primary secondary scene may be any primary secondary scene, and the primary secondary scene includes an event in which the electronic device runs a focus application without detecting a primary event. The first optimal power may be the minimum power in the first prediction result that meets the first condition.

[0008] 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 other conditions, the performance requirements of the electronic device when the user is watching a video may be higher than the performance requirements when not watching a video; for another example, when the electronic device has multiple external devices, the performance requirements may be higher than the performance requirements when there are no external devices.

[0009] Among these scenarios, the secondary scenario is an operating scenario with low 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, 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. In this method, the electronic device can uniquely determine a main secondary scene through these parameters related to performance requirements (hereinafter referred to as the 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, one or more of them, and may also include other parameters, which are not limited in this application.

[0010] When the electronic device is in any main secondary scene (for example, the first main secondary scene), the electronic device can use the above 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 as the input of the above 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 is greater than the first threshold when the electronic device is running at the maximum power supply of the multiple CPUs (that is, the probability that the user experience is affected when the maximum power supply of each CPU is running in the main secondary scene). After that, 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.

[0011] It can be understood that the greater the proportion of lag time when a CPU is running at its maximum power supply in a scenario, the less the performance provided by the CPU's maximum power 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 impaired. Therefore, after obtaining the first prediction result, the electronic device can use the second threshold to determine the CPU maximum power supply that will damage the user experience (i.e., meet the first condition) in the first prediction result. The first optimal power is the smallest CPU maximum power supply among the CPU maximum power supply 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 CPU maximum power supply that will not damage the user experience and has the lowest power consumption for the electronic device among the multiple CPU maximum power supplies. Probability of impaired user experience

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

[0013] 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 is not limited in this application.

[0014] Optionally, the electronic device may execute the method only when it is not charged, that is, the electronic device may adjust the maximum power supply of the CPU in the primary and secondary scenarios based on the power prediction model only when it is not charged. Since the electronic device has sufficient power supply in the charging state, the electronic device does not need to adjust the maximum power supply of the CPU based on the operating scenario, but always keeps the maximum power supply of the CPU at the maximum power, giving priority to ensuring the performance requirements of the electronic device.

[0015] 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 also includes: detecting a level one event, determining that the scene in which the electronic device is located is switched from the first main-level 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.

[0016] In this embodiment, the first-level event may include: 1. Interaction events between the user and the electronic device. 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 may 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 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 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 the game mode, etc.

[0017] When a level 1 event occurs, the electronic device is in a level 1 scenario. Since level 1 events have high performance requirements for electronic devices, in a level 1 scenario, the electronic device will directly adjust the maximum power that the CPU can supply to the maximum power to ensure 100% supply of the electronic device's performance.

[0018] 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 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 powers of the multiple CPUs and the corresponding probability of impaired user experience when the multiple CPUs are operated separately at the maximum supply powers 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 in the second prediction result that meets the first condition.

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

[0020] Combined with the above description, it can be known that the electronic device can uniquely determine a main secondary scene through the main secondary scene parameters. When any one 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 power prediction model, and can adjust the maximum power that the CPU can supply to the optimal power of the new main secondary scene.

[0021] In combination with the first aspect, in a possible implementation, 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 operation 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 separately at the maximum power that can be supplied by the multiple CPUs 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 of 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.

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

[0023] It is understandable that for electronic devices such as computers, users may open multiple applications at the same time when using them, including focus applications and background applications. Therefore, during the operation of electronic devices, electronic devices not only need to meet the focus performance requirements, but also need to meet the performance requirements of background applications. In some cases, the performance requirements of background applications for electronic devices are even higher than the corresponding performance requirements of focus applications.

[0024] It can be understood that a main secondary scene and an auxiliary secondary scene can exist simultaneously 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.

[0025] 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, thereby further meeting the performance requirements of the background application while meeting the performance requirements of the focus application.

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

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

[0028] In combination with the first aspect, in a possible implementation, 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, the main-secondary scenarios include scenarios related to the focus application when the electronic device does not detect an interaction event, the training data include 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 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; train the power prediction model based on the training data set.

[0029] 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 the multiple CPUs can supply 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 freeze time corresponding to each power in each main and secondary scenarios in the valid data with the damage threshold - if the proportion of 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 is not impaired when running at this power level, 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 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.

[0030] In combination with the first aspect, in a possible implementation, the valid data set includes valid data of multiple main and secondary scenarios, and the valid data includes the operating time and 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.

[0031] 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.

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

[0033] It should be understood that when an electronic device runs with a maximum power supply of a CPU in a main secondary scenario, if the electronic device runs more smoothly (i.e., the less jamming occurs), it means that the performance provided by the maximum power supply of the CPU can better meet the performance requirements of the main secondary scenario, which also means that the performance provided by the electronic device may still have a lot of remaining performance after the performance requirements of the main secondary scenario. In this case, the electronic device can appropriately reduce the maximum power supply of the CPU 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 with the maximum power supply of the CPU as the first power, when the duration of running at the first power reaches the first duration and no jamming occurs, the electronic device can first save the total duration of this operation at the first power (i.e., the first duration) and the jamming duration (i.e., the jamming 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 supply of the CPU from high to low.

[0034] 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.

[0035] In combination with the first aspect, in a possible implementation, 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 power that the CPU can supply to a third power; the third power is included in the multiple different maximum power that the CPU can supply, the third power is greater than the first power, and the valid data of the first main-secondary scenario includes the operating duration and the freeze duration of operation at the first power and the third power.

[0036] 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, it is assumed that the probability of jamming of the electronic device when running at the first power in the first main and secondary scenarios is very small, which is actually 0.05, but when running at the first power, the electronic device runs for 30s and jams for 3s (a small probability event occurs). If the power is simply continued to be lowered, the total running time and the total jamming time corresponding to the first power will not be updated again, so the proportion of the jamming time corresponding to the first power calculated by the electronic device is 3 / 30=0.1, which is twice the actual jamming probability. However, if the power is raised to the third power, the probability of jamming of the electronic device when running at the third power in the first main and secondary scenarios is smaller, and there is a great probability that jamming will not occur within 30s, so 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, and 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 to be 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 the randomness of the data on the accuracy of the results.

[0037] In combination with the first aspect, in a possible implementation, 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 scene 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 scene is different from the first main-secondary scene; saving the exploration progress of the first main-secondary scenario as the first power, the exploration progress being 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.

[0038] It is understandable that during the actual operation of the electronic device, the operation scenario in which the electronic device is located may change at any time. Therefore, when the electronic device is running 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 run at a sufficient amount of the maximum power that the CPU can supply in the first main secondary scenario, the main secondary scenario in which the electronic device is located changes from the first main secondary scenario to another main secondary scenario, and the electronic device will save the operation time and 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 scenario of the electronic device changes to the first main secondary scenario again, the electronic device can start from the first power, continue from high to low, and gradually reduce the maximum power that the CPU can supply, and collect the operation 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 with the power exploration progress of the second main-secondary scene, and gradually reduce the maximum power that the CPU can supply from high to low, and collect the operating time and freeze time corresponding to each power in the second main-secondary scene.

[0039] In combination with the first aspect, in a 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 respectively at the maximum power that can be supplied during the second operating time.

[0040] The valid data of the first main-secondary scene includes, when the total running time of the electronic device in the first main-secondary scene reaches the second running time, the running time and the freezing time of the multiple different CPU maximum power supplies in the second running 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 running 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 the valid data, and the main-secondary scene can be called a valid main-secondary scene.

[0041] It is understandable that for a valid main-secondary scenario that has acquired valid data, the electronic device does not necessarily need to operate at all optional maximum CPU power supplies in the main-secondary scenario. For example, assuming that in the first main-secondary scenario, the electronic device freezes every time it runs at the first power, and in some embodiments, the electronic device needs to increase the power when freezing occurs, so it is very likely that after the total operating time of the electronic device in the first main-secondary scenario reaches the second time, the electronic device does not run at a CPU maximum 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 the electronic device will frequently freeze when running at a CPU maximum power supply lower than the first power in the first main-secondary scenario, that is, running at the first power or a CPU maximum power supply lower than the first power in the first main-secondary scenario will seriously damage the user experience, and the first power or a CPU maximum power supply lower than the first power is highly likely not the optimal power for the first main-secondary scenario, so it is not important whether the electronic device has run at the first power or a CPU maximum 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 position with empty information in the valid data to "0", which means that running at these gear positions will cause the user experience to be damaged.

[0042] In combination with the first aspect, in a possible implementation manner, the first duration is 30 seconds, and / or the second duration is 600 seconds.

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

[0044] It should be understood that the amount of data required for model training is very large. Therefore, in this embodiment, when the number of valid data in the valid data set is greater than or equal to X, the electronic device will train the above power prediction model based on the collected valid data. 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 limit this.

[0045] Optionally, since the model training process has great demands on the performance and power consumption of the device. Therefore, after obtaining the above training data set, the electronic device can train the above power prediction model while charging and the screen is off (but the electronic device is still on). It is understandable 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.

[0046] In combination with the first aspect, in a possible implementation, 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 any one of 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.

[0047] 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 scenarios caused by the application APP update.

[0048] 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 at the adjusted maximum CPU supply power; updating the power prediction model according to the feedback data.

[0049] In this embodiment, the feedback data may include the operation time and freezing time of the electronic device under the last adjusted power. 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, train a new prediction model using the updated valid data, so that the power prediction model can still maintain the accuracy of the prediction results when the application APP is continuously updated.

[0050] 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.

[0051] 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 so that the electronic device executes a method as in the first aspect or any possible implementation of the first aspect.

[0052] According to 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 according to the first aspect or any possible implementation of the first aspect.

[0053] In a fifth aspect, a computer-readable storage medium is provided, comprising instructions, which, when executed on an electronic device, enable the electronic device to execute a method in the first aspect or any possible implementation of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] Figure 1 A user interface diagram of an electronic device running a primary scenario and a secondary scenario provided in an embodiment of the present application;

[0055] Figure 2 A flow chart of a power adjustment method provided in an embodiment of the present application;

[0056] Figure 3 A schematic diagram of a training process of a prediction model provided in an embodiment of the present application;

[0057] Figure 4 A schematic diagram of a process of preprocessing valid data by an electronic device provided in an embodiment of the present application;

[0058] Figure 5A logical schematic diagram of adjusting device performance in a primary scenario provided in an embodiment of the present application;

[0059] Figure 6 A logical schematic diagram of adjusting device performance in a secondary scenario provided in an embodiment of the present application;

[0060] Figure 7 A schematic diagram of a process of data changes during a power prediction model prediction process provided by an embodiment of the present application;

[0061] Figure 8 A user interface diagram of an electronic device operation scenario provided in an embodiment of the present application;

[0062] Fig. 9 A schematic diagram of dividing a data interval provided in an embodiment of the present application;

[0063] Fig.10 A flow chart of a power adjustment method provided in an embodiment of the present application;

[0064] Fig.11 A schematic diagram of determining the optimal power of a secondary scene based on primary and secondary scenes provided in an embodiment of the present application;

[0065] Fig.12 A logic diagram of a power adjustment method provided in an embodiment of the present application;

[0066] Fig.13 A schematic diagram of a process of an electronic device exploring a primary or secondary scene in a cold start phase provided by an embodiment of the present application;

[0067] Fig.14 A schematic diagram of representing raw data in an electronic device during the statistical phase provided in an embodiment of the present application;

[0068] Fig.15 A logical architecture diagram of a power prediction method provided in an embodiment of the present application;

[0069] Fig.16 A system architecture diagram provided for an embodiment of the present application;

[0070] Fig.17 A structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0071] The terms used in the following embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to be used as limitations to the present application. As used in the specification and appended claims of the present application, the singular expressions "one", "a kind of", "said", "above", "the" and "this" are intended to also include plural expressions, unless there is a clear indication to the contrary in the context. It should also be understood that the term "and / or" used in the present application refers to and includes any or all possible combinations of one or more listed items.

[0072] To facilitate understanding, the relevant terms involved in the embodiments of the present application are first introduced below.

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

[0074] 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 duration of the electronic device being stuck within a period of time). The smaller the lag frequency, the better the performance of the electronic device, and vice versa.

[0075] 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 by the electronic device per unit time, measured in W. Even in standby mode, an electronic device will still consume a certain amount of electrical energy (unless the power is turned off, it will not consume energy).

[0076] For electronic devices such as desktop computers and laptops, the CPU is the computing and control core of the system in the device. The maximum power that the CPU can supply (i.e., PowerLimit-1) and the maximum operating frequency of the CPU (i.e., MaxFrequency) are closely related to the power consumption of the electronic device. It should be noted that "the maximum power that the CPU can supply" and "the 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 the electronic device, the CPU generally does not always operate at the power or operating frequency corresponding to this maximum value. Its actual operating power and operating frequency are generally related to the current operating environment of the electronic device. When the electronic device runs more applications at the same time, the actual working power and operating frequency of the CPU will be greater, but it will not exceed the maximum values ​​corresponding to the maximum power that the CPU can supply and the maximum operating frequency of the CPU.

[0077] 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 working 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 can be adjusted, 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 CPU is 45W, the electronic device can set the maximum power supply of the CPU to 45W, 40W, 30W and other values, but cannot set it to 50W.

[0078] In addition, the maximum power that can be supplied by the CPU and the maximum operating frequency of the CPU also determine the upper limit of the performance of the electronic device to a certain extent. Taking the maximum power that can be supplied by the CPU as an example, generally speaking, for the same series of microprocessors, the greater the maximum power that can be supplied by the CPU, the greater the maximum operating speed that the electronic device can support. In some scenarios, the power consumption of the electronic device can be reduced at the expense of performance by reducing the maximum power that can be supplied by the CPU. For example, in a certain operating scenario, the maximum power that can be supplied by the CPU is 45W, and the actual power of the CPU is 25W. However, at this time, the gap between the actual power of the CPU of the electronic device and the maximum power that can be supplied by the CPU is still very large, which also means that the power of the CPU in the current scenario is difficult to reach the upper limit of 45W, so the maximum power that can be supplied by the CPU does not limit the actual power of the CPU. It should be understood that when the actual power of the CPU is 25W, the performance provided by the CPU is the maximum performance required for the operating scenario. If the actual power of the CPU is adjusted to 15W, the performance provided by the CPU may not meet the maximum performance requirements of the operating scenario, but it can still provide sufficient performance for the operating scenario to ensure that the user experience is not impaired. 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.

[0079] Therefore, in some scenarios, if the actual power of the CPU can be limited to a suitable range or value by adjusting the maximum power supply of the CPU, then the electronic device can reduce power consumption at the expense of some performance without affecting the user experience. However, in combination with the above description, it can be seen that the performance and power consumption of electronic devices cannot be taken into account at the same time. 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 maximum power supply of the CPU to a suitable value to minimize the power consumption of the electronic device while ensuring that the performance meets the user's needs is the problem that this application focuses on solving.

[0080] In the present application, the electronic device can achieve the purpose of reducing the power consumption of the device without compromising the user experience by adjusting the maximum power that the CPU can supply or the maximum operating frequency of the CPU. For the sake of convenience, in the subsequent embodiments, the adjustment of the maximum power that the CPU can supply is used as an example for explanation.

[0081] (2) Focus application and background application

[0082] For electronic devices such as computers, users may open multiple applications at the same time when using them, and the display screen of the electronic device may also display multiple application interfaces (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 through devices such as the mouse or keyboard, there will always be an application interface (application window) on the display screen that is displayed on the top of the display screen. For example, when the user is watching a video on the electronic device, he may not operate the electronic device, but the interface of the application used to play the video is generally displayed on the top of the interface.

[0083] In the embodiment of the present application, the application or application interface that the user is operating with the mouse or keyboard and is displayed on top of the display screen can be called a "focus application"; in addition to the focus application, other applications opened by the electronic device can be called "background applications". It can be understood that the focus application and the background application can be switched. For example, the user can click on the application interface of a background application to make the application interface of the background application displayed on top. At this time, the background application is switched to the focus application, and the original focus application becomes a background application.

[0084] (3) Primary scenario and secondary scenario

[0085] Level 1 scenarios include operating scenarios that have high requirements for electronic device performance. 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, operations such as users clicking mouse buttons and scrolling mouse wheels (but not including operations of moving the mouse cursor), users using keyboard shortcut keys (shortcut keys may include keyboard Ctrl keys, Win keys, Shift keys, Alt keys, Esc keys, F1-F12 keys, Fn keys, Enter keys, PrtSc keys, PgUp keys, PgDn keys, etc., and may also include other shortcut keys, as well as shortcut keys obtained by combining multiple shortcut keys in these shortcut keys), users switching focus applications, 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.

[0086] The second-level scenario includes operating scenarios with lower requirements on the performance of electronic devices. When the electronic device does not detect a first-level event, it is considered that the electronic device has entered the second-level scenario.

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

[0088] 1. Main secondary scene.

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

[0090] 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, size of the focus application window, memory usage of the focus application, whether watching videos, download speed, whether using a camera, whether playing audio, type of external device, whether using a keyboard, device screen brightness, device available memory RAM, integrated graphics load rate, independent graphics load rate, and hard disk write speed.

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

[0092] In other embodiments, since parameters such as the focus application window size, the focus application memory usage, the download speed, the screen brightness, the memory RAM, the integrated graphics card load rate, the independent graphics card load rate, and the hard disk write speed may change frequently during the operation of the electronic device, for these parameters, it can be considered that one main secondary scene is switched to another main secondary scene only when the change of any one or more parameters reaches a certain range. That is, when the main secondary scene parameters of the electronic device change within a certain range, the electronic device can be considered to be in the same main secondary scene.

[0093] 2. Auxiliary secondary scene.

[0094] When the 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.

[0095] 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.

[0096] Based on the above definition, it is impossible for the primary scene and the secondary scene to appear at the same time, but the primary secondary scene and the auxiliary secondary scene can exist at the same time. Usually, since there is usually only one focus application at the same time, but there can be multiple background applications, the number of primary secondary scenes at the same time is one, and the number of auxiliary secondary scenes can be multiple.

[0097] In the present application, since the first-level scenario has high 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 supply of the CPU to a certain power value, and the difference between the power value and the maximum value of the maximum power supply of 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 supply of the CPU to the maximum value of the maximum power supply of 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 supply of the CPU by taking into account both performance and power consumption. For the specific adjustment method, refer to the subsequent method embodiments.

[0098] (4) The maximum power that the CPU can supply

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

[0100] Combined with the above description, it can be seen that the maximum power that the CPU of an electronic device can supply has an upper limit for adjustment, which is determined when the electronic device leaves the factory. Here, it is assumed that the power value corresponding to this upper limit is PL1 max , then based on the power value PL1 max Set the corresponding power level for the maximum power that the CPU can supply. For details, please refer to the example in the following table:

[0101] Table 1

[0102]

[0103] 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, and the larger the value of the power gear, the greater the corresponding power. 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.

[0104] (5) Optimal power

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

[0106] 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 a freeze when the electronic device is running at the power value in the secondary scenario. When the probability of freeze is greater than a certain threshold (for example, 3%), it can be considered that the gear position affects the user experience in the secondary scenario.

[0107] In some embodiments, the maximum power that the CPU can supply 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 the 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 quick.

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

[0109] (6) Lightweight Gradient Boosting Machine Model

[0110] The light gradient boosting machine model (LightGBM) 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.

[0111] 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.

[0112] 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 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 can speed 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.

[0113] The power regulation method provided in the present application is introduced below in conjunction with an exemplary user interface.

[0114] Figure 1 The electronic device 10 provided in the embodiment of the present application runs a user interface of a primary scene and a secondary scene. The electronic device 10 may be a notebook computer.

[0115] like Figure 1As shown in (A), 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, and 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, PgDn to switch pages of the word document, 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 key is a first-level event. Therefore, in Figure 1 In (A), the operating scenario of the electronic device 10 is a first-level scenario.

[0116] exist Figure 1 In the first-level scenario shown in (A), if the user opens the hardware detection application through the electronic device 10, the application window 103 of the hardware detection application can show the user the hardware information and performance of the electronic device at this moment. It can be seen from the hardware information displayed in the dotted box in the application window 103 that the maximum power supply gear 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 gear is the maximum gear. The actual system total power of the electronic device is 40.545W, and the average system total power is 41.795W; wherein the actual system total power is the system total power of the electronic device at the current moment, and the average system total power is the average value of the system total power of the electronic device in the past fixed period of time. It can be understood that although the maximum power supply of the CPU is 45W at this time, the actual power of the CPU may be 40W at this time. In addition to the CPU, there may be some hardware such as GPU in the electronic device 10 that will also generate power consumption, so the system total power will be greater than 45W.

[0117] like Figure 1 As shown in (B), 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 that during the entire process of watching the video, no primary event is triggered in the electronic device 10. Then, combined with the above description, it can be seen that Figure 1 In (B), the operation scenario of the electronic device 10 is the secondary scenario. In the secondary 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 the CPU of the electronic device 10 can supply is still 45W, the actual total system power is 25.375W, and the average total system power is 28.550W.

[0118] from Figure 1It can be seen from the hardware information shown in (A) and (B) that the maximum power supply position of the CPU of the electronic device 10 is the maximum position in both the first-level scenario and the second-level scenario, and the corresponding power value is 45 W. However, in these two scenarios, the actual working power of the CPU in the electronic device 10 does not reach 45 W, that is, when the maximum power supply position of the CPU is set to the maximum position, the actual working power of the CPU in the electronic device 10 may not reach 45 W.

[0119] for Figure 1 For the first-level scenario shown in (A), 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.

[0120] But for Figure 1 For the secondary scenario shown in (B) of FIG. 1 , there is a large gap between the actual total system power of the electronic device and the maximum power that the CPU can supply, that is, the actual power of the CPU does not reach 45W during the entire operation of the electronic device 10 when the electronic device 10 is running in the secondary scenario. Figure 1 For the secondary scenario shown in (B), without affecting the user experience, if the actual working 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 working 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.

[0121] 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 according to the main and secondary scenarios 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 use time of the electronic device.

[0122] 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. And these parameters of the main secondary scene jointly reflect the degree of demand for the performance of the electronic device by the secondary scene. 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.

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

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

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

[0126] The electronic device shown in the embodiment of the present application may be a mobile phone, an on-board device (such as an on-board unit (OBU)), a tablet computer (pad), a computer with data transceiver function (such as a laptop, a PDA, etc.), a mobile Internet device (mobile internet device, MID), a terminal in a smart city, a terminal in a smart home, a terminal device in a 5G network, or a terminal device in a public land mobile network (PLMN) to be evolved in the future, etc. It is understandable that the present application does not limit the specific form of the above-mentioned electronic devices.

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

[0128] S102: When in the main secondary scene, the electronic device collects valid data.

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

[0130] 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.

[0131] Specifically, for any main secondary scene scene_x in which the electronic device is located, when the electronic device is in the main secondary scene for the first time, the electronic device can explore the advantages and disadvantages of each gear, that is, in the main secondary scene, the gear of the maximum power that the CPU can supply is adjusted to multiple power gears in succession; 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 30s. In the main secondary scene scene_x, when the electronic device starts to use a new power gear PL1_x to operate, the electronic device will record the starting time t_start of the operation at the power gear PL1_x; after the operating time reaches the specified operating time T, the electronic device will record the operating 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 maximum power that the CPU can supply from PL1_x to another gear PL1_y. It can be understood that in the main secondary scene scene_x, the stall duration corresponding to the gear position PL1_x accounts for duration_delay / duration_ttl.

[0132] Preferably, for a main secondary scene, the electronic device can explore each power gear in a high-to-low manner. 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 adjusted down by one gear to continue exploring. If a freeze occurs within the specified time T, the maximum power gear that the CPU can supply is adjusted up by one gear to continue exploring after the freeze occurs. That is to say, for a main secondary scene, 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 scene, so the electronic device will not continue to explore a lower power gear, but will explore a higher power gear. Based on this, when the total operating time of the electronic device in a main secondary scene reaches Ts (Ts can be set to 600s), the electronic device can determine the optimal power gear for the main secondary scene.

[0133] In the actual exploration process, in the same main secondary scene scene_x, the electronic device may run the exploration in the same gear PL1_x for multiple times. For example, when the electronic device is running at the gear position PL1_x and a freeze occurs and the gear is adjusted up one gear to PL1_x+1, after running at the gear position PL1_x+1 and the running time reaches T, the gear is adjusted down one gear again to PL1_x; or when the electronic device is running at the gear position 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), 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 the gear position PL1_x again; correspondingly, the last time the electronic device switched from the main secondary scene scene_y to other scenes, the electronic device recorded 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 level electronic devices, multiple duration_delay and multiple duration_ttl will be recorded accordingly, and the proportion of the freeze duration corresponding to the power level PL1_x can be calculated as DURATION_DELAY / DURATION_TTL; wherein DURATION_TTL is the sum of the running durations of the electronic device each time the power level PL1_x runs, and DURATION_DELAY is the sum of the freeze durations of the electronic device each time it runs scene_x at the power level PL1_x.

[0134] For a main secondary scene, when the optimal power gear of the main secondary scene is determined (or when the total operating time of the electronic device in the main secondary scene is long enough), the electronic device can record a valid data corresponding to the main secondary scene, and the main secondary scene that has obtained valid data is called "valid main secondary scene". The valid data includes: the parameters of the main secondary scene, the multiple power gears explored, and the corresponding freeze duration ratio under the power gear.

[0135] S103, the electronic device trains a power prediction model.

[0136] The above 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.

[0137] When using the power prediction model to make predictions, the input of the power prediction model is the main secondary scenario parameters of the main secondary scenario, and the output is the probability of the user experience being impaired when the electronic device is running at each power gear in the main secondary scenario. Exploration.

[0138] It should be understood that the amount of data required for model training is very large. Therefore, when the number 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 scenes is greater than or equal to X, the electronic device will train the above power prediction model based on the collected valid data. Specifically, the above X can be set to 50,000, 100,000 or other values, which can be set based on the performance requirements of the above power prediction model, and this application does not limit this.

[0139] Figure 3 A schematic diagram of the training process of the above prediction model is shown. Figure 3 As shown, the training process of the power prediction model may specifically include: data conversion 301 and model training 302. Among them:

[0140] Since the power prediction model output provided by the present application is the probability of impaired user experience corresponding to each gear in the secondary scenario, the data conversion 301 mainly includes converting the proportion of the freezing time corresponding to each gear in the valid data into a binary mark of whether it is harmful to the user experience, and splitting a valid data into multiple 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 focus application name recorded in the valid data), the data conversion 301 can also include an encoding operation of mapping the non-numeric data in the valid data to a numerical value, that is, creating a mapping table to store the mapping relationship between discrete feature values ​​and custom numerical values.

[0141] Figure 4 The process of the electronic device numbering, marking and reconstructing the collected valid data according to the gear position is shown.

[0142] like Figure 4 As shown, the valid data table 40 includes multiple valid data, and the specific data volume may be tens of thousands or hundreds of thousands, wherein any valid data records the main secondary scene parameters of a main secondary scene, and the proportion of the freeze time when the electronic device runs at different power gears in the main secondary scene.

[0143] 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: focus application name - 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 gears, the download speed of the electronic device - 1 gear, whether to use the camera - 0 (the parameter value of the camera is "1" to indicate the use of the camera, "0" to indicate the non-use of the camera), screen brightness - 10 gears...; in this main secondary scene, the proportion of the freeze time of the electronic device running at each power gear is from 10 gears to 2 gears: 0, 0, 0, 0.01, 0.02, 0.03, 0.04, 0.05, 0.01 (among which the freeze time proportions corresponding to 6 gears, 4 gears and 3 gears are not included in the text due to space limitations). Figure 5 As shown in the figure); from the percentage of the freezing time corresponding to each power gear, it can be seen that as the gear of the maximum power that the CPU can supply is reduced, the probability of freezing of the electronic device when running the secondary scene also increases accordingly.

[0144] 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 1 gear. Because a large amount of experimental data shows that for most secondary scenarios, after the gear of the maximum power that the CPU of the electronic device can supply is adjusted to 1 gear, 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 secondary scenario, the electronic device does not need to adjust the power gear to 1 gear, that is, the electronic device does not need to collect the percentage of jamming duration when running at 1 gear, and only needs to explore the power gear to the lowest gear 2 for a main secondary scenario.

[0145] After collecting multiple valid data and obtaining the valid data table 40, the electronic device will further convert the focus application name in each valid data into a digital code, such as Figure 4 The mapping relationship table 41 shown in . 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 main 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.

[0146] 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 if it is 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 scenes in the mapping relationship table 41, the electronic device can set a damage threshold, and the electronic device can compare the proportion of the jamming duration corresponding to each gear recorded by it with the damage threshold - if the proportion 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 is not impaired when running at this power gear, and the electronic device can update the numerical value corresponding to the power gear (i.e., the proportion of the jamming duration, the same below) to the label value "1"; conversely, if the proportion of the jamming duration corresponding to a certain power gear is greater than the above-mentioned damage threshold, it means that the user experience is impaired when running at this power gear, and the electronic device can update the numerical value corresponding to the power gear to the label value "0". The specific 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" may also be referred to as the "first threshold".

[0147] The mapping data 411 in the mapping relationship table 41 and the above damage threshold value of 0.03 are used as an example for description. Figure 4 The gear marking table 42 shown in the figure, 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".

[0148] 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 the 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-mentioned valid data table 40 can also be referred to as a "valid data set", the above-mentioned training set 43 can also be referred to as a "training data set", and the data in the training set 43 can be referred to as "training data". The above-mentioned label value "1" can be referred to as a "second label value", and the above-mentioned label value "0" can be referred to as a "first label value".

[0149] The gear mark data 421 in the gear mark 42 is taken 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 in the training set 43 can be obtained (some of the sub-data are not included in this article due to space limitations). Figure 4 ). In addition to recording the corresponding gear and the tag value corresponding to the gear, each piece of sub-data also records the main and secondary scene parameters recorded in the gear tag data 421, such as the focus application number-"0", the window size-8, the download speed-1 gear, etc. It can be understood that in the training set 43, the information recorded in the 9 pieces of sub-data obtained from the same gear tag data is the same except for the gear and the gear tag value.

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

[0151] It should be noted that the model training process has great requirements 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 charging and the screen is off (but the electronic device is still in the on state). 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.

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

[0153] The electronic device determines the current operation scene by detecting whether a primary event occurs. If a primary event occurs, it indicates that the electronic device is in the primary scene, and the electronic device can execute step S105; otherwise, it indicates that the electronic device is in the secondary scene, and the electronic device can execute step S106.

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

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

[0156] When a first-level event such as "mouse click" or "keyboard shortcut key input" is triggered, the electronic device determines that the current operating scenario is a first-level scenario. Based on the high performance requirements of the first-level scenario for electronic devices, the electronic device will directly adjust the maximum power supply of the CPU to the maximum power gear to ensure 100% supply of the electronic device's performance.

[0157] In the following N seconds, the electronic device will always keep the gear of the maximum power supply 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 in the following N seconds, the electronic device will always keep the gear of the maximum power supply at the maximum power gear, and so on, until the electronic device does not trigger a level one event within N consecutive seconds, the electronic device will determine that the level one scene has ended, and the running scene is the level two scene, and the electronic device can execute step S106. Specifically, the above N can be 5 or other values, and this application does not limit this.

[0158] S106. When the operating scenario is a 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.

[0159] like Figure 6 As shown, when the electronic device is in the secondary scene, the electronic device can obtain all the main secondary scene parameters of the current main secondary scene, including: focus application, focus application window size and other parameters. Afterwards, the electronic device can input all the main secondary scene parameters of the current main secondary scene into the above power prediction model, and the power prediction model can output the probability of impaired user experience in the current main secondary scene at each power level.

[0160] Furthermore, the electronic device can compare from the highest power level to the lowest power level, and take 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. After that, the electronic device can adjust the CPU's maximum power level to the optimal power level.

[0161] Figure 7 The figure shows the process of processing the collected data when the electronic device determines the optimal power gear of the current primary and secondary scene based on the above power prediction model.

[0162] like Figure 7As shown in the main-secondary scene feature table 70 in the figure, 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 acquiring 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 may also be referred to as the "first main-secondary scene".

[0163] After obtaining all the primary and secondary scene parameters of scene 701, the power prediction model can construct a prediction sample table of 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 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 save the prediction result of the probability of impaired user experience corresponding to each subsequent candidate power gear.

[0164] Next, the power prediction model can predict the prediction samples in the prediction sample table 71, and the output is the probability of the user experience being impaired when the electronic device runs scene 701 at each candidate power level. For details, please refer to Figure 7 The prediction output table 72 shown in . It can be seen from the prediction output table 72 that 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 is running at various power gears (10 gears-2 gears) under scene 701, the probability of impaired user experience is 0, 0, 0.01, 0.06, 0.23, 0.48, 0.59, 0.67, 0.71 respectively. In the embodiment of the present application, the "prediction result" recorded in the above 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".

[0165] Afterwards, the electronic device can search from the highest power gear 10 in descending order 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 the present application, "the probability of user experience damage of 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 scene 701, the gear with the last user damage probability 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".

[0166] Understandable, Figure 4 , Figure 7 The specific format of the data set involved in the model training and prediction process is shown only for the convenience of readers' understanding and does not represent its format in actual scenarios. For example, in actual application scenarios, the data recorded in the valid data table 40, the mapping relationship table 41, and the gear mark table 42 in the above description may not exist in the electronic device in the form of a table, but may be stored in the electronic device in the form of program code. The specific format of these data in the electronic device is not limited by this application.

[0167] In the subsequent operation process, when the operation scenario of the electronic device changes, the electronic device can adjust the maximum power supply level of the CPU again. The changes in the operation scenarios mentioned here include: 1. The operation scenario of the electronic device changes from the current secondary scenario to the primary scenario. 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 execute the subsequent step S107.

[0168] S107. The main secondary scene of the electronic device changes from the current main secondary scene to a new main secondary scene. The electronic device determines the optimal power gear of the new main 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 main secondary scene.

[0169] Combined with the above description, it can be known that when any one 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 to another new main-secondary scene. At this time, the electronic device can determine the optimal power gear of the new main-secondary scene based on the above-mentioned power prediction model, and can adjust the gear of the maximum power that the CPU can supply to the optimal power gear of the new main-secondary scene. For specific operations, please refer to the above-mentioned description of step S106, which will not be repeated here.

[0170] Figure 8 It shows the adjustment effect of the maximum power that can be supplied to the CPU after the electronic device changes from the current main-secondary scene to the new main-secondary scene. Figure 8 The electronic device shown may be an electronic device in which the above power prediction model is deployed in the present method. It is also assumed here that the power value corresponding to the maximum gear of power that its CPU can supply is 45W.

[0171] exist Figure 8 In (A), the electronic device opens the "video" application to start watching the video that has been downloaded to the electronic device, and the application window 801 is the application window of the "video" application. At this time, the electronic device does not trigger 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 in the above description can be the same main secondary scene.

[0172] In order to reduce the power consumption of the device, the electronic device will collect all the main and secondary scene parameters of scene 81 as the input of the above power prediction model, which will output the probability of user experience impairment under each CPU's maximum power supply level for scene 81. The electronic device can determine the optimal power level for scene 81 based on the probability of user experience impairment at each level. Assuming that the power value corresponding to the optimal power level for scene 81 is 15W, Figure 8 As shown in (A), it can be seen from the hardware information shown in the application window 802 that the maximum power supply of the CPU of the electronic device has been adjusted to 15W. Correspondingly, the total system power of the electronic device is 15.411W, and the average system power is 16.305W. Although the performance of the CPU will decrease as the maximum power supply of the CPU decreases, the electronic device can still play the video smoothly at this time, and the screen of the electronic device, the mouse cursor, etc. are not stuck, and the user experience is not affected.

[0173] In the subsequent operation process, the user operates the electronic device to play music through the music application, and the electronic device is listening to songs through the "music" application, and the application window 803 is the application window of the "music" application. After the focus application is switched from the video application to the music application, the electronic device does not trigger a primary event during the process of playing music, and the electronic device is in the main secondary scene 82 at this time. Since the operation scene of the electronic device is switched from the main secondary scene 81 to the new main secondary scene 82, the performance requirements of the main secondary scene 82 and scene 81 are likely to be different. Therefore, the electronic device will obtain the optimal power gear of the new main-secondary scene scene 82; specifically, the electronic device will also collect all the main-secondary scene parameters of scene82 as the input of the above-mentioned power prediction model, and the above-mentioned power prediction model will output the probability of impaired user experience of scene82 at each CPU's maximum power supplyable power gear (in the embodiment of the present application, the probability of impaired user experience of scene 82 at each CPU's maximum power supplyable power gear can be referred to as the "second prediction result"). The electronic device can determine the optimal power gear of scene 82 according to the probability of impaired user experience at each gear, and adaptively adjust the gear of the CPU's maximum power supplyable power. It is assumed here that the power value corresponding to the optimal power gear of scene 82 is 10W, then Figure 8 As shown in (B), it can be seen from the hardware information shown in the application window 804 that the maximum power supply of the CPU of the electronic device 10 has been adjusted to 10W. Correspondingly, the total system power is reduced to 10.411W, and the average system power is also reduced to 11.305W. Similarly, although the performance of the CPU will be reduced due to the reduction of the maximum power supply of the CPU, the electronic device can still play music smoothly, the screen of the electronic device and the mouse cursor are not stuck, and the user experience will not be affected.

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

[0175] Take the download speed of an electronic device as an example, and combine it with Fig. 9 The specific meaning of the above discretization processing is explained. For ease of understanding, it is assumed that the download speed of the electronic device is 0kb / s at the minimum and 2028kb / s at the maximum. Fig. 9 As shown, the download speed interval of the electronic device is [0, 2028]. The interval can be divided into 4 sub-intervals, which are sub-interval 901, sub-interval 902, sub-interval 903 and sub-interval 904, and their corresponding interval ranges are [0, 500], [400, 1024], [900, 1500], [1400, 2028], and their corresponding download speed gears are 1st gear, 2nd gear, 3rd gear and 4th gear.

[0176] When judging the secondary scene, only when the gear corresponding to the download speed value changes, that is, when the download speed value changes to a certain extent, it is considered to switch from one main secondary scene to another. In addition, in order to avoid the value corresponding to the download speed changing back and forth at the junction of two adjacent intervals, causing the gear position to change continuously, there is a part of the overlapping area in the interval range corresponding to each two adjacent gears in the above four gears. When judging the gear, if the current download speed value falls into the overlapping area of ​​the two sub-intervals, the gear corresponding to the download speed at this moment will be judged to be consistent with the gear corresponding to the download speed at the previous moment. For example, suppose that at a certain moment, the download speed of the electronic device is 250kb / s, and this value falls within the interval [0, 500], so its corresponding gear is 1; at the next moment, the download speed of the electronic device changes to 450kb / s, and this value falls within both the interval [0, 500] and [400, 1024], but because the download speed at the previous moment falls within the interval [0, 500], the electronic device will still determine that the interval to which 450 belongs is [0, 500], that is, the corresponding download speed gear is still 1. If at the next moment, the download speed of the electronic device changes to 600kb / s, this value only falls within the interval [400, 1024], and its corresponding download speed gear is 2, then the electronic device will determine that the secondary scene feature of the download speed has changed, that is, the main secondary scene has changed.

[0177] Similarly, for parameters such as the focus application window size, the focus application memory usage, and the screen brightness, the electronic device can also discretize them to obtain multiple gears, and only when the gears corresponding to these parameters change is it determined that the main and secondary scenes have changed. Fig. 9 The division of gear intervals is only for ease of understanding. In actual application scenarios, the endpoint values ​​of sub-intervals obtained by dividing the secondary characteristic interval by the electronic device may be different, and the number of sub-intervals may also be different. This application does not limit this.

[0178] Since the electronic device has sufficient power supply in the charging state, the electronic device does not need to adjust the gear of the maximum power supply of the CPU based on the operation scenario, but always keeps the gear of the maximum power supply of the CPU at the maximum gear, giving priority to ensuring the performance requirements of the electronic device. Therefore, in some embodiments, the electronic device may execute steps S101, S102, and S104-S107 only when it is not charged.

[0179] In the present application, the electronic device can also adjust the maximum operable 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 jamming duration under different CPU maximum operable frequency gears by adjusting the maximum operable frequency gear of the CPU. After collecting enough valid data, the electronic device can also train the power prediction model (specifically, refer to the relevant description of 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 operable frequency gears), and adjust the CPU maximum operable frequency gear to the above-mentioned optimal frequency gear.

[0180] 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 train the valid data collected by electronic device A through electronic device B (electronic device B and electronic device A may be the same device or different devices) 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.

[0181] 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 electronic device can complete the collection of valid data together with other electronic devices of the same model. That is to say, the number of valid data collected by the 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 for model training to obtain the power prediction model. Afterwards, the server can uniformly send the power prediction model to multiple electronic devices of the same model including the 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 electronic device can also be greater than or equal to X. In this case, the server can train the power prediction model for the valid data (greater than or equal to X) collected by the electronic device alone and send the power prediction model to the electronic device, so that the power prediction model in the electronic device can be more adapted to the personalized needs and usage habits of the user, and its prediction performance will be better.

[0182] 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 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 first-level event, the electronic device can also collect corresponding valid data in such a first-level scenario, and train a prediction model suitable for such a first-level scenario based on the valid data; when the subsequent electronic device is in such a first-level scenario with relatively low performance requirements, the electronic device can also determine the optimal power gear for such a first-level scenario based on the above prediction model. The specific process of collecting the training data of the prediction model and model training can refer to the aforementioned description of steps S102-step S103, which will not be repeated here.

[0183] It is understandable that for electronic devices such as computers, users may open multiple applications at the same time when using them, including focus applications and background applications. Therefore, during the operation of electronic devices, electronic devices not only need to meet the focus performance requirements, but also need to meet the performance requirements of background applications. In some cases, the performance requirements of background applications for electronic devices are even higher than the corresponding performance requirements of focus applications.

[0184] 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 maximum power gear among the corresponding (N+1) optimal power gears in the main secondary scene and the auxiliary secondary scene as the optimal power gear of the secondary scene, thereby further meeting the performance requirements of the background application while meeting the performance requirements of the focus application.

[0185] Combined with the above description, next Fig.10 The following describes another power adjustment method provided by an embodiment of the present application. Fig.10 , the method may include the following steps:

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

[0187] The electronic device shown in the embodiment of the present application may be the aforementioned Figure 2 The power prediction model in the embodiment of the present application can be the aforementioned Figure 2 The specific training process and application process of the power prediction model in Figure 2 The relevant descriptions of steps S101 to S103 are not repeated here.

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

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

[0190] Combined with the above description, it can be known that the main secondary scene and the auxiliary secondary scene can exist simultaneously in the 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 are different from the main secondary scene parameters of the main secondary scene in terms of 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 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 aforementioned operation process of determining the optimal power gear of the main secondary scene, and will not be repeated here.

[0191] Preferably, the background applications corresponding to the above M auxiliary secondary scenarios may be the M background applications with the largest CPU performance consumption among the background applications. Specifically, the value of M may be 3 or other values, which is not limited in this application.

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

[0193] S203. The electronic device determines the optimal power gear of the main secondary scene and the largest power gear among the M optimal power gears of the 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.

[0194] In order to ensure that the final power level set can meet the needs of both background applications and focus applications, 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 CPU's maximum power supply level to the optimal power level of the current secondary scene.

[0195] Fig.11 The process of an electronic device determining a common optimal power gear for a primary secondary scenario and an auxiliary secondary scenario is shown.

[0196] like Fig.11 As shown, it is assumed that at this time in the electronic device, the focus application corresponds to number 0, and the three background applications with the largest CPU performance consumption correspond to numbers 1, 2, and 3 respectively. Scene 01 is the main secondary scene running on the electronic device at this time, and scene 02, scene 03, and scene 04 are the three auxiliary secondary scenes running on the electronic device at this time. In the embodiment of the present application, the above scene 01 can also be referred to as the "first main secondary scene", and any auxiliary secondary scene among the above scene 02, scene 03, and scene 04 can be referred to as the "first auxiliary secondary scene".

[0197] 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 the main secondary scene parameter table 010. Similarly, for the currently running three auxiliary secondary scenes scene02, 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 the auxiliary secondary scene parameter table 011.

[0198] After obtaining the main secondary scene parameters of the main secondary scene scene 01, the electronic device can determine the optimal power level PL11 of scene 01 based on the main secondary scene of scene 01 and the prediction model. Figure 2 In the embodiment of the present application, the above-mentioned optimal power gear PL11 may also be referred to as "first optimal power".

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

[0200] After obtaining the optimal power gears PL11, PL12, PL13, and PL14 of the above four scenarios, the electronic device can determine the largest power gear among the four optimal power gears as the optimal power gear in the current scenario. For example, assuming PL11>PL12>PL13>PL14, the electronic device will eventually determine PL11 as the optimal power gear in the current secondary scenario, and adjust the maximum power gear that the CPU can supply to PL11.

[0201] 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.

[0202] The current secondary scene changes to a new secondary scene, including one or more of the following two situations: 1. The current main secondary scene changes to a new main secondary scene. 2. When the background applications corresponding to the above M auxiliary secondary scenes are the three background applications with the largest CPU performance consumption, the M applications with the largest CPU performance consumption among the background applications running on the electronic device change, resulting in changes in the M auxiliary secondary scenes.

[0203] 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 is not limited to this.

[0204] When the main secondary scene and / or the M auxiliary secondary scenes start to change, it means that the current secondary scene has changed to a new secondary scene. The electronic device can re-determine the optimal power gear of the new secondary scene based on the relevant operations in the aforementioned steps S201 to S203, and adjust the gear of the maximum power that the CPU can supply to the optimal power gear of the new secondary scene.

[0205] It is understandable that the application APP in the electronic device will be constantly updated, so the demand of these applications for the performance of the electronic device may also change with the update of the version, and the degree of change in its performance demand is generally not too large. Therefore, in some embodiments, after the above-mentioned power prediction model is trained, for any main and secondary scenes, after determining the optimal power gear of the main and secondary scenes 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 optimal power gear, a higher gear adjacent to the optimal power gear, and a lower gear adjacent to the optimal power gear. Correspondingly, in the subsequent operation process, the electronic device will also count the feedback data, and the feedback data may include the running time and the freezing time of the electronic device under the last adjustment gear. Finally, the electronic device can update the valid data corresponding to the main and secondary scenes based on the obtained feedback data, and update the above-mentioned power prediction model based on the updated valid data, that is, use the updated valid data to train the new prediction model, so that the above-mentioned power prediction model can still maintain the accuracy of the prediction results when the application APP is constantly updated. Fig.12 The updating process of the above prediction model is shown exemplarily.

[0206] like Fig.12 As shown, in Fig.12 In the example, the power prediction model may be a model trained by the electronic device based on multiple valid data in the valid data table 12A, wherein 12A1 is valid data of the primary secondary scene scene12 collected by the electronic device.

[0207] After the power prediction model is trained, when the electronic device is in scene 12 again, the electronic device can determine the optimal power level PL1 of scene 12 based on the power prediction model and the primary and secondary scene parameters of scene 12. x .

[0208] Here it is assumed that the power gear is PL1 x The next higher power gear is PL1 (x+1) , and power level PL1 x The next lower power gear is PL1 (x-1)In the embodiment of the present application, the electronic device can obtain a random number that falls within the main interval [1, 100] based on the random number function. If the random number falls within the sub-interval [1, 5], the power level PL1 to be adjusted is y Determined as PL1 (x-1) ; If the random number falls in the sub-interval [96, 100], the power level to be adjusted will be PL1 y Determined as PL1 (x+1) If the random number falls within the subinterval [5, 95], the power level PL1 to be adjusted will be y Determined as PL1 x Understandably, PL1y was identified as PL1 (x-1) , PL1 x and PL1 (x+1) The probabilities of are 5%, 90%, and 5% respectively. In the embodiment of the application, the main secondary scene scene 12 can be called the "first main secondary scene", PL1 x Can be called the optimal power, PL1 x-1 Can be called the fourth power, PL1 x-1 It can be called the fifth power.

[0209] Regardless of PL1 y Identified as PL1 (x-1) , PL1 x and PL1 (x+1) No matter which power gear you choose, the electronic device will record the running time and the freezing time when running at that gear. x 7th gear, PL1 y For PL1 (x+1) , that is, take the 8th gear as an example. Assuming that the running time of the electronic device when running at the power gear 8 is 100s, and the freeze time during the operation is 1s, the electronic device will take the running time of 100s and the freeze time of 1s as the feedback data of scene12 running at the 8th gear. Afterwards, the electronic device can use the feedback data to update the valid data 12A1 of scene12. As shown in the valid data 12A2 in the valid data table 12A, the proportion of freeze time corresponding to the 8th gear in the valid data corresponding to scene12 has been updated from the original 0 to 0.01.

[0210] It is understandable that when the electronic device is running in other primary and secondary scenarios, the electronic device can also use the above method to update the valid data of other primary 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 the previous training. In addition, in some embodiments, PL1 (x-1) , PL1 x and PL1 (x+1) Identified as PL1 y The probability of 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.

[0211] It should be noted that after an application APP in an electronic device is updated, the electronic device may not be able to perceive whether the performance requirements of the application APP have increased, decreased, or remained unchanged. Therefore, after determining the optimal power gear for the primary and secondary scenarios based on the prediction model, the electronic device may adjust the last adjustment gear to PL1 if the performance requirements of the focus application increase. (x-1) , it is also possible to adjust the last adjustment gear to PL1 when the focus application has lower performance requirements (x+1) . Although in these two cases the electronic device cannot determine the last adjusted gear as the power gear that is truly most suitable for the current main and secondary scenes, the feedback data obtained when the last adjusted gear is running, the recorded percentage of the electronic device's freezing time in this gear is objective, and it can still truly reflect whether the last adjusted gear has damaged the user experience for the current main and secondary scenes. For example, suppose the current optimal power gear determined for scene 12 based on the prediction model is 7, and the focus application corresponding to scene 12 has been updated. The actual optimal power gear for scene 12 is 7, but the electronic device finally adjusts the last gear to PL1 based on the above method. yDetermined to be level 6. In this case, although the electronic device may freeze more frequently when running at power level 6 in scene 12, the collected feedback data is also collected for level 6. After the effective data is updated using the feedback data, the percentage of freezing duration recorded by the effective data increases, which reflects 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 last adjusted level as the power level that is truly most suitable for the current main and secondary scenes, the feedback data obtained in the subsequent process is real and objective. After the corresponding effective data is updated using the feedback data, the prediction performance of the new power prediction model retrained by the electronic device using the updated effective data will be improved.

[0212] In the aforementioned Figure 2 and Fig.10 In the method embodiment shown, 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 number of valid data (i.e., the number of valid secondary scenes) obtained by the electronic device in these three stages is different, which leads to different ways for the electronic device to determine the power gear to be adjusted for the main secondary scene. Among them:

[0213] ① [Cold start phase] Valid data: 0, gear determination method: optimal power exploration strategy - that is, for a main-secondary scenario, the electronic device operates in multiple power gears in the main-secondary scenario in succession, and the optimal power gear of the main-secondary scenario is determined by recording the smoothness of operation at each gear.

[0214] The cold start phase can be considered as the phase in which the electronic device starts and runs the main secondary scene for the first time after leaving the factory. In this phase, for any main secondary scene, the electronic device can successively run in multiple power gears under the main secondary scene, and obtain the jamming probability of each main secondary scene under 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.

[0215] Take the main secondary scene scene_x as an example. In the main secondary scene scene_x, every time the electronic device starts to run 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 at gear PL1_x, and the duration duration_delay of the electronic device being stuck when running at gear PL1_x, and adjust the gear of the maximum power that the CPU can 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 gear PL1_x is duration_delay / duration_ttl.

[0216] 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 order 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 adjusted down by one gear to continue exploring downward; if a freeze occurs within the specified time T, the maximum power supply of the CPU is immediately adjusted up by one gear after the freeze occurs and then continue exploring downward. The gear exploration rules can be specifically set as follows:

[0217] 1) When the electronic device runs at the power level PL1_x for T1 (T1≤T), the operating scenario changes to the first-level scenario;

[0218] 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 and the freeze time at the power gear PL1_x under scene_x (the freeze time is 0s at this time); that is, for the tuple (scene_x, PL1_x), save the running time T1 and the freeze time (0s).

[0219] 2) The main secondary scene scene_x has not changed to another scene, and the electronic device has been running at the power level PL1_x for a specified time T without any lag;

[0220] The electronic device saves the current gear exploration progress PL1_x, and 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 freeze (the duration of freeze is 0s at this time); that is, for the tuple (scene_x, PL1_x), save the corresponding operation duration T and freeze duration (0s). In the 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".

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

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

[0223] 4) The vehicle is operated at power level PL1_x for a duration of T3 (T3≤T), and is stuck for a duration of T4 (T4≤T3) within the duration of T3;

[0224] The electronic device saves the exploration progress PL1_x, raises the power gear by one gear to gear PL1_x+1; and saves the running time T3 and the freezing time T4 of running at the power gear PL1_x under scene_x; that is, for the tuple (scene_x, PL1_x), saves the corresponding running time T3 and the corresponding freezing time T4. In the embodiment of the present application, the power gear PL1_x+1 can be called the "third power".

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

[0226] 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.

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

[0228] 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 freezing time of the electronic device at different power gears of scene_x as valid data of scene_x.

[0229] Wherein, Ts is greater than or equal to n×T, where n is the number of all adjustable power gears of the maximum adjustable power of the CPU. 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".

[0230] It can be seen from the above gear exploration rules that for a main and secondary scene, 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 operating durations duration_delay and multiple freeze durations duration_ttl accordingly, then 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 operating 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.

[0231] In addition, combined with the aforementioned gear exploration rules, it can be known 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 for the secondary scenario, the electronic device may not completely lower the CPU's maximum power supply gear in the direction from 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 the randomness of the data on the accuracy of the results.

[0232] 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 ran for 30s and froze 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 not be updated again, so 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 freezing when the electronic device is running at gear PL1_x+1 in the main secondary scene scene_x is even smaller, and there is a high probability that freezing will not occur within 30s, so after 30s, the electronic device will lower the power gear by one gear and return to gear PL1_x. Since the probability of the electronic device freezing when running the secondary scene scene_x at gear PL1_x is very small, the electronic device will most likely not freeze within 30 seconds when running at gear PL1_x again, and the total running time and total freezing time corresponding to power gear PL1_x will be updated to 60s and 3s respectively. The freezing time percentage corresponding to power gear PL1_x is calculated to be 3 / 60=0.05, which is closer to the actual freezing probability corresponding to power gear PL1_x, thereby reducing or even avoiding the impact of randomness of the data on the accuracy of the results.

[0233] Fig.13 The process of the electronic device performing gear exploration on the primary and secondary scenes according to the aforementioned gear exploration rules during the cold start phase is exemplarily shown.

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

[0235] Assume that scene 131 is the first main secondary scene entered at time t1 after the electronic device is started up from the factory. Fig.13 As shown in (A) in FIG. 1 , the original data 1301 will be stored in the original data table 1300 as the first original data. Fig.13 Not shown in the figure, the electronic device will store the main and secondary scene parameters of scene 131 in the original data 1301. In addition, the electronic device will also record all gears of the maximum power that the CPU can supply in the original data 1301 (100% is gear 10, 90% is gear 9, and so on, the same below). Each gear forms a tuple with scene 131, which is used to record the operating time and freeze time (the proportion of freeze time) of the electronic device under its corresponding power gear. Since the electronic device has not explored scene 131 before time t1, Fig.13 In the original data 1301 shown in (A), the information corresponding to each gear is empty.

[0236] At time t1, the electronic device starts 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 maximum power that the CPU can supply to the highest gear 10 and run it. After running for 30 seconds, at time t2, if the electronic device does not freeze during the entire operation, the exploration of gear 10 ends. According to the gear exploration rules, the electronic device will save the current gear exploration progress of gear 10, record the total running time of 30 seconds and the freeze time of 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.

[0237] like Fig.13 As shown in (B), 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 the 10th gear under scene 131 is 30s, and the total stall is 0s. In addition, the electronic device can mark the gear to save the gear exploration progress. For example, Fig.13 In the original data 1301 shown in (B), there is an exploration progress mark on the 10th gear, indicating that the current gear exploration progress of the electronic device for scene1 is 10th gear. Fig.13 The exploration progress mark shown in (B) is only for the convenience of explanation and understanding. In actual application scenarios, it may exist in the electronic device in the form of code or in a form perceptible to other electronic devices. This application does not limit this.

[0238] At time t2, the electronic device starts to run at gear 9. After running for 10 seconds, at time t3, if the electronic device does not freeze during the entire operation, but the first-level event is triggered at this time, the operation scene of the electronic device changes from scene 131 to the first-level scene. According to the exploration rules, the electronic device saves the current gear exploration progress of gear 9, records the total operation time of 10 seconds and the freeze time of 0 seconds corresponding to the exploration process of gear 9, and directly adjusts the power gear to the maximum gear 10.

[0239] like Fig.13 As shown in (C), at time t3, the data area corresponding to the 9th gear of the original data 1301 has stored the duration information (10,0), which means that as of time t3, the total duration of the electronic device running scene 131 at the 9th gear is 10s, and the total freeze is 0s.

[0240] Assuming that the electronic device does not trigger a primary event again within 5 seconds after time t3, the primary scene ends. The electronic device re-enters the secondary scene. Here, it is assumed that the main secondary scene where the electronic device is located after the primary scene ends is scene131. Then, after 5 seconds from time t3, at time t4, the electronic device re-enters the main secondary scene scene 131. At this time, the electronic device will continue to perform gear exploration on scene131 with the gear exploration progress of 9 gears for scene 131 saved in the original data 1301.

[0241] like Fig.13 As shown in (D), at time t4, the data in the original data 1301 has not changed compared to time t3, and the electronic device continues to run at gear 9 in scene 131. After running for 30 seconds, at time t5, the electronic device has no freeze during the entire running process. According to the gear exploration rule, the electronic device will save the gear exploration progress as gear 9, record the running time of running at gear 9 for 30 seconds and the freeze time of 0 seconds, and reduce the power gear by one gear to gear 8, and continue the gear exploration.

[0242] like Fig.13 As shown in (E), at time t5, the data area corresponding to the 9th gear of the original data 1301 has saved the duration information (40,0), which means that as of time t5, the total duration of the electronic device running at 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 at 9th gear for the first time, and the duration information (30,0) obtained when running at 9th gear for the second time. The electronic device can merge the two duration information to obtain the following: Fig.13The duration information (40,0) shown in (E) is obtained and recorded in the original data 1301. The two duration information (40,0) and (10,0) can also be recorded in the original data 1301 respectively, and this application does not limit this.

[0243] At t5, the electronic device starts to run at gear 8 in scene 131. After running for 20 seconds, at t6, the electronic device freezes during the entire operation process, and the freeze lasts for 0.3 seconds (the 0.3 seconds is 19.7 seconds to 20 seconds from t5). According to the exploration rules, the electronic device saves the current gear exploration progress of gear 8, records the total operation time of 20 seconds and the freeze time of 0.3 seconds corresponding to the exploration process of gear 8, and increases the power gear to gear 9 to continue the exploration.

[0244] like Fig.13 As shown in (F), at time t6, the data area corresponding to the 8th gear of the original data 1301 has stored the duration information (20, 0.3), which means that as of time t6, the total duration of the electronic device running scene 131 at the 8th gear is 20 seconds, and the total freeze is 0.3 seconds.

[0245] 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 does not freeze during the entire operation process, but the main secondary scene in which the electronic device is running changes from scene 131 to main scene 132 (here it is assumed that the electronic device enters main scene 132 for the first time). Then, 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 freeze 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 gears of scene 132.

[0246] like Fig.13As shown in (G), at time t7, the data area corresponding to the 9th gear of the original data 1301 has saved the duration information (50,0), which means that as of time t7, the total duration of the electronic device running in the 10th gear under scene 131 is 50s, and the total freeze is 0s. Similarly, the duration information (50,0) is obtained by merging three duration information, namely (10,0), (30,0) and (10,0). For details, please refer to the above description, which will not be repeated here and in subsequent embodiments. In addition, a new original data 1302 is added to the original data table 1300, but because the electronic device has not yet explored the gear position of scene 132 before time t7, Fig.13 The information corresponding to each gear in the original data 1302 shown in (G) is empty.

[0247] At t7, the electronic device starts gear exploration for scene 132. Similarly, the electronic device adjusts the gear of the maximum power that the CPU can supply to the highest gear 10 and runs. After running for 30 seconds, at t8, the electronic device does not freeze during the entire operation. The electronic device saves the current gear exploration progress 10 gears, records the total running time 30 seconds and freeze time 0 seconds corresponding to the exploration process of 10 gears, and lowers the power gear by one gear to 9 gears to continue the exploration.

[0248] like Fig.13 As shown in (H), at time t8, the data area corresponding to the 10th gear of the original data 1302 has stored the duration information (30,0), which means that as of time t8, the total duration of the electronic device running at the 10th gear under scene 132 is 30 seconds, and the total stall is 0 seconds. In addition, the electronic device can mark the 10th gear to save the gear exploration progress of scene 132.

[0249] 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 secondary scene, when the total operating time of the electronic device in the main secondary scene reaches 600s, it can be regarded that the electronic device has completed the gear exploration process of the main secondary scene, that is, the electronic device can basically determine the optimal power gear of the main secondary scene through the acquired data. At this time, the raw data corresponding to the main secondary scene is valid data, and the main secondary scene can be called a valid main secondary scene. After any main secondary scene obtains its corresponding valid data, the cold start phase also ends accordingly, and the electronic device enters the statistical phase.

[0250] It should be noted here that for a valid main-secondary scene that has obtained valid data, the electronic device does not necessarily need to explore all power gears in the main-secondary scene. For example, suppose there is a secondary scene scene 133, and the electronic device is exploring the new secondary scene scene 132 using the optimal power exploration strategy. Assume that each time the scene 133 is operated in the 4th gear, the electronic device is stuck, and because the electronic device needs to increase the gear by one gear to the 5th gear when the jam occurs, it is very likely that after the total operating time of the electronic device in scene 133 reaches 600s, the electronic device does not operate in the 3rd and 2nd gears 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 at 4th gear in scene 133, it is highly likely that freezing will occur frequently when running at gears below 4th gear in scene 133, that is, running at 3rd gear or 2nd gear in scene 133 will seriously damage the user experience, and 3rd gear and 2nd gear are highly likely not the optimal power gears for scene 133, so it is not important whether to explore 3rd gear and 2nd gear in scene 133. In the subsequent model training process, when processing the valid data to obtain the gear mark data, 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.

[0251] ② [Statistical stage] Valid data: [1, X), gear determination method: For non-valid main and secondary scenarios, the optimal power exploration strategy is used to explore the gear; for valid main and secondary scenarios, the optimal frequency gear reading method is used, that is, based on the jamming probability of each gear in the 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.

[0252] Unlike the cold start phase, in the statistical phase, the electronic device has stored valid data for some primary and secondary scenarios (the number of valid data is less than X, where X is the minimum value of valid data required for model training). In this phase, there are still some ineffective primary and secondary scenarios, including primary and secondary scenarios that the electronic device has not encountered yet, and primary and secondary scenarios that the electronic device has encountered but the total running time has not reached 600s.

[0253] 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.

[0254] However, when the main secondary scene is an ineffective main secondary scene, the electronic device cannot determine the optimal power gear for the ineffective main secondary scene. Therefore, the electronic device will continue to explore the gear for the ineffective main secondary scene according to the above-mentioned optimal exploration strategy, that is, operate according to the gear saved in the gear exploration progress; for the secondary scenes that have never been encountered, the exploration starts from the highest power gear of the maximum power that the CPU can supply provided by the electronic device.

[0255] Fig.14 The specific content of the original data table stored in the electronic device at a certain moment in the statistical stage is shown. Fig.14 As shown, the original data table 1400 records the original data of multiple secondary scenes. Among them:

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

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

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

[0259] It should be noted that the running time information and the freezing time information recorded in each gear in the original data table 1400 have been converted into freezing time ratio (freezing probability). In addition, the original data 1403 shown in the original data table 1400 is only for the convenience of explanation; in fact, if the scene 143 has not been encountered, the original data table 1400 may not store the original data 1403.

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

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

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

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

[0264] The electronic device can query the original data table 1400 based on the main secondary scene parameters of scene 141, and after obtaining the valid data 1401 of scene 14, determine the optimal power gear of scene 141 according to the valid data 1401. Here, 0.03 is used as a threshold value for explanation. Assuming that in the valid data of a main secondary scene, when the proportion of the freezing time corresponding to a power gear is less than or equal to 0.03, it means that when the main secondary scene is running at this gear, it will not cause damage to the user experience, otherwise it will cause damage to the user experience. For scene 141, the electronic device can start from the highest gear in the valid data 1401 and search in sequence to the lower gear, 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.

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

[0266] The electronic device can query the original data table 1400 based on the main secondary scene parameter of scene 142, and determine the original data 1402 corresponding to scene 142. After determining that the original data 1402 is not valid data, the electronic device will obtain the saved gear exploration progress (6 gears) of scene 142, adjust the gear of the maximum power that the CPU can supply to 6, and continue to complete the gear exploration process for scene 142 according to the gear exploration rules in the above description.

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

[0268] The electronic device can query the original data table 1400 based on the main secondary scene parameter of scene 143. After determining that scene 143 is a scene that has never been encountered, the electronic device can create a new original data 1403 in the original data table 1400. At this time, the data areas corresponding to all gears in the original data 1403 are empty. Afterwards, the electronic device can perform gear exploration for scene 143 starting from the highest CPU maximum power supply gear 10 according to the gear exploration rules in the above description, and record the proportion of the freeze duration under each gear.

[0269] ③

Prediction stage

[0270] In the prediction stage, the electronic device obtains enough (≥X) valid data and trains the 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 main secondary scene, whether the main secondary scene is a valid secondary scene or an ineffective 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 impaired user experience when running at each power gear in the main secondary scene. Afterwards, the electronic device can use a certain threshold (for example, 0.5) as a reference, 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 maximum power that the CPU can supply to the optimal power gear.

[0271] It should be noted that in the above three stages, the operation of adjusting the maximum power level of the CPU for different primary and secondary scenarios can only occur when the electronic device is unplugged (i.e., not charged). When the electronic device is in the charging state, since the electronic device has sufficient power supply, the electronic device does not need to adjust the maximum power level of the CPU based on the operating scenario, but always keeps the maximum power level of the CPU at the maximum level, giving priority to the performance requirements of the electronic device.

[0272] Fig.15 The logical architecture diagram of a power prediction method provided in an embodiment of the present application shows the specific logic of an electronic device determining the power gear to be adjusted for a secondary scenario, determining the user experience after adjusting the power gear, and updating the power adjustment algorithm according to the user experience. Fig.15 As shown in the figure, the logical architecture includes: operating environment, operating scenario, AI algorithm, adjustment strategy and result feedback.

[0273] 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.

[0274] The operation scenario can be considered as an operation 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 operation environment. These data are combined together to obtain a unique operation scenario. Among them, when the data corresponding to the operation environment indicates that a primary event such as a mouse click or a keyboard shortcut key is operated occurs, the operation scenario is a primary scenario. When the data corresponding to the operation environment indicates that a primary event has not occurred, the operation scenario is a secondary scenario. At this time, the electronic device can also obtain all secondary scenario parameters corresponding to the secondary scenario based on the data corresponding to the operation environment.

[0275] 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 aforementioned description under the primary scenario, and the method for determining the power level to be adjusted in the secondary scenario. For details, please refer to the aforementioned relevant descriptions, which 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 secondary scenario, the AI ​​algorithm uses the scene parameters of the secondary scene (the scene parameters include the main secondary scene parameters, and may also include the auxiliary secondary scene parameters) as input, and the output is the power level to be adjusted.

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

[0277] The result feedback is the result feedback generated by adjusting the maximum power level that the CPU can supply to the power level that is to be adjusted. The operating environment is affected by it. The result feedback can be divided into positive feedback and negative feedback according to the flow rate of the electronic device when it is running. Among them, positive feedback means that the power level that is to be adjusted just issued by the AI ​​brings positive benefits (that is, the electronic device does not freeze when running at the power level that is to be adjusted), and negative feedback means that it brings negative benefits (that is, the electronic device freezes when running at the power level that is to be adjusted).

[0278] AI will further iterate the optimization 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, after the running time reaches T without freezing, 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 by one gear; if the electronic device freezes when running in this gear before running to 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 by one gear. For another 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 freezing 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 feedback data obtained.

[0279] Fig.16 A system architecture provided by an embodiment of the present application is shown, and the system architecture can be used to train and run the above prediction model. Fig.16 As shown, the electronic device 100 may be the electronic device provided by the present application in the foregoing description. The electronic device 100 may be connected to multiple input devices 200 (such as a mouse, a keyboard, etc.) Fig.16 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 notebook computer, the keyboard included in the input device 200 can be integrated with the electronic device 100 on the same device body.

[0280] 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:

[0281] 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.

[0282] 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. Figure 4 The relevant instructions will not be repeated here.

[0283] The data storage module 1003 is used to store the valid data collected by the data collection module 1001. In addition, the data storage module is also used to store the data obtained when the data processing module 1002 pre-processes the valid data, such as a mapping relationship table for recording the mapping relationship between the focus application name and the focus application number, a gear mark table for recording whether the power gear causes damage to the user experience, and finally a training set for input into the prediction model for training, etc. (For details, please refer to the aforementioned Figure 4 ).

[0284] 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 .

[0285] 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.

[0286] The power prediction model 1007 can predict the probability of impaired user experience corresponding to each gear when the electronic device is running at each power gear under the main secondary scene according to the main secondary scene parameters of the main secondary scene currently running. Further, the calculation module 1006 can determine the optimal power gear of the secondary scene according to the probability of impaired user experience corresponding to each gear when the electronic device is running at each power gear under the secondary scene output by the power prediction model, and the lowest gear with a probability of impaired less than or equal to 0.5, and send the optimal power gear to the CPU performance adjustment module 1009.

[0287] After receiving the above-mentioned optimal power gear, the CPU performance adjustment module 1009 can adjust the gear of the maximum power that can be supplied by the CPU of the electronic device 100 to the above-mentioned optimal power gear.

[0288] In addition, when the 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 key, it can be regarded as the electronic device 100 triggering a first-level event, and the scene in which the electronic device 100 is running is a first-level scene. 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 that can be supplied by 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, which can include a storage address, which is used to record the gear value of the current maximum power that can be supplied by 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 that can be supplied by the CPU, the CPU performance adjustment module 1009 can change the gear value of the current maximum power that can be supplied by the CPU of the electronic device based on the above-mentioned storage address to complete the adjustment of the gear of the maximum power that can be supplied by the CPU.

[0289] 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 gear issued by the calculation module 1006 as a reference to adjust the gear of the CPU's maximum power supply. That is, when the electronic device 100 is in a charging state, the power supply is sufficient, the prediction model 1007 may no longer take effect, and the CPU performance adjustment module 1009 may directly adjust the gear of the CPU's maximum power supply to the maximum power gear, and keep the maximum power gear running, giving priority to ensuring the performance requirements of the electronic device. When the control instruction indicates that the electronic device 100 is currently in an uncharged state, the CPU performance adjustment module 1009 will once again use the optimal power gear issued by the calculation module 1006 as a reference to adjust the gear of the CPU's maximum power supply of the electronic device 100 to the optimal power gear, ensuring the balance between the performance and power consumption of the electronic device 100.

[0290] Understandably, Fig.15 This 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 Fig.16 In the embodiment, the data storage module 1003 is an internal memory in the electronic device 100. In other cases, the data storage module 1003 may also be placed outside the electronic device 100.

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

[0292] The electronic device may be a mobile phone, a tablet computer, a wearable device, a vehicle-mounted 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, a card camera), etc. The present application does not impose any restrictions on the specific type of the electronic device.

[0293] Fig.17 The structure of the electronic device is exemplarily shown.

[0294] 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.

[0295] It is to be understood that the structure illustrated in the embodiment of the present invention does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figure, or combine some components, or separate some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

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

[0297] 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.

[0298] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.

[0299] The charging management module 140 is used to receive charging input from a charger. The charger may be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 may receive charging input from a wired charger through the USB interface 130. In some wireless charging embodiments, the charging management module 140 may receive wireless charging input through a wireless charging coil of the electronic device 100. While the charging management module 140 is charging the battery 142, it may also power the electronic device through the power management module 141.

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

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

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

[0303] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function, such as storing music, video and other files in the external memory card.

[0304] 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.

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

[0306] 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 arranged in the processor 110, or some functional modules of the audio module 170 can be arranged in the processor 110.

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

[0308] The receiver 170B, also called a "earpiece", is used to convert audio electrical signals into sound signals. When the electronic device 100 receives a call or voice message, the voice can be received by placing the receiver 170B close to the human ear.

[0309] Microphone 170C, also called "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 microphone 170C to input the sound signal into 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 sound source, realize directional recording function, etc.

[0310] The earphone interface 170D is used to connect a wired earphone and can be a USB interface 130, or a 3.5 mm open mobile terminal platform (OMTP) standard interface or a cellular telecommunications industry association of the USA (CTIA) standard interface.

[0311] The key 190 includes a power key, a volume key, etc. The key 190 may be a mechanical key or a touch key. The electronic device 100 may receive key input and generate key signal input related to user settings and function control of the electronic device 100.

[0312] Indicator 192 may be an indicator light, which may be used to indicate charging status, power changes, messages, missed calls, notifications, etc.

[0313] The processor 110 is used to collect valid data of the primary and secondary scenes in the primary and secondary scenes, and train the power prediction model according to the collected valid data. The electronic device 100 can store the collected valid data in the memory of the processor 110 or in the external memory connected through the external memory interface 120.

[0314] Specifically, when the amount of valid training data is sufficient, the charging management module 140 may send the first information to the processor 110, and the display screen 194 may send the second information to the processor 110 through the corresponding interface. 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), the processor 110 will trigger the process of training the above-mentioned power prediction model.

[0315] 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 gear of the maximum supplyable power at the maximum power gear.

[0316] If the electronic device 100 is in a power-off state, the processor 110 can identify the operating scenario characteristics of the electronic device 100 and determine the power value or power gear that needs to be adjusted for the maximum power that the processor 110 can supply according to the operating scenario category. Figure 2 , Fig.12 as well as Fig.13 Related instructions.

[0317] An embodiment of the present application also provides an electronic device, which includes: one or more processors and a memory; wherein 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 shown in the aforementioned embodiment.

[0318] 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 (the stated condition or event) is detected" may be interpreted to mean "if determining..." or "in response to determining..." or "upon detecting (the stated condition or event)" or "in response to detecting (the stated condition or event)", depending on the context.

[0319] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, 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 devices. 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 site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. 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 contains one or more available media integration. 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), etc.

[0320] Those skilled in the art can understand that to implement all or part of the processes in the above-mentioned embodiments, the processes can be completed by computer programs to instruct related hardware, and the programs can be stored in computer-readable storage media. When the programs are executed, they can include the processes of the above-mentioned method embodiments. The aforementioned storage media include: ROM or random access memory RAM, magnetic disk or optical disk and other media that can store program codes.

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 power between the first optimal power and the first optimal power, and 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

  • Control method, control device and electronic equipment

    CN111190471A

  • Power distribution method, device, and system of image processor

    CN112005218A

  • Resource scheduling method and electronic equipment

    CN116028205A

Cited By

  • Server power control method and electronic equipment

    CN121028980A