Power adjustment method and related device

By running at the maximum power supply of multiple CPUs in the same scenario of electronic devices and determining the optimal power based on the proportion of stuttering time, the problem of insufficient CPU performance in the energy-saving mode is solved, and the situation without affecting the user experience is achieved Reduce power consumption and extend usage time.

CN119440217APending Publication Date: 2025-02-14HONOR DEVICE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

The CPU performance of existing electronic devices in energy-saving mode cannot meet the needs of certain usage scenarios, resulting in lag in runtime and affecting the user experience.

Method used

By operating at the maximum power supply of multiple different CPUs in the same scenario, the optimal power is determined based on the proportion of jamming duration to effectively reduce power consumption without damaging the user experience.

Benefits of technology

It realizes the adjustment of electronic equipment performance in different operating scenarios, avoiding lags, extending the service life of the equipment, and effectively saving electricity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119440217A_ABST
    Figure CN119440217A_ABST
Patent Text Reader

Abstract

The invention provides a power adjustment method and a related device. By implementing the method, the electronic equipment can operate at the maximum available power of a plurality of different CPUs in the same scene, and the optimal power is determined for the scene based on the jamming duration proportion when the electronic equipment operates at the maximum available power of each CPU, so that the electronic equipment can effectively reduce power consumption and prolong the service time under the scene on the premise of not damaging the user experience.
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] In order to extend the use time of electronic devices, most electronic devices provide users with energy-saving modes. In energy-saving mode, the electronic device will reduce the brightness of the electronic device screen, reduce the performance of the CPU, and other operations to reduce the power consumption of the electronic device, thereby extending the use time of the electronic device. However, in energy-saving mode, the performance of the CPU of the electronic device may not meet the performance requirements of certain usage scenarios, so the electronic device may freeze when running in these scenarios, giving users a bad user experience.

[0004] Therefore, how to adjust the performance of electronic devices to an appropriate size according to different operating scenarios, so as to effectively save the power of electronic devices without affecting the user experience, is an urgent problem to be solved. Summary of the invention

[0005] The purpose of this application is to provide a power adjustment method and related devices. By implementing this method, an electronic device can operate with multiple different CPU maximum power supplies in the same scenario, and determine the optimal power for the scenario based on the proportion of freezing time when each CPU is operated with the maximum power supply, so that the electronic device can effectively reduce power consumption and extend the usage time in the scenario without damaging the user experience.

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

[0007] In a first aspect, the present application provides a power adjustment method, including: obtaining valid data of a first main-secondary scenario, the first main-secondary scenario including a scenario related to a focus application when the electronic device does not detect an interaction event, the valid data including an operating time and a freeze time of the electronic device running at multiple different CPU maximum power supplies in the first main-secondary scenario; determining the minimum CPU maximum power supply in the valid data of the first main-secondary scenario in which the freeze time ratio is less than a first threshold as the optimal power of the first main-secondary scenario, the freeze time ratio being the ratio of the freeze time to the operating time; and adjusting the CPU maximum supply power of the electronic device according to the optimal power of the first main-secondary scenario.

[0008] In this method, the first main secondary scene can be any main secondary scene, and the main secondary scene includes an event in which the electronic device runs a focus application when no primary event is detected. For any main secondary scene including the first main secondary scene, the electronic device can run at the maximum power supply of the multiple CPUs in a main secondary scene, and record the running time and the freezing time of each CPU maximum power supply in the multiple CPU maximum power supply. It can be understood that the larger the freezing time ratio (that is, the ratio of freezing time to running time) corresponding to the maximum power supply of a CPU is, the less the maximum power supply of the CPU can meet the performance requirements of the corresponding scene, and the user experience will also be bad. Therefore, after obtaining the running time and freezing time of each CPU maximum power supply in the multiple CPU maximum power supply, the electronic device can determine that the CPU maximum power supply with a freezing time ratio greater than the first threshold value damages the user experience, and the CPU maximum power supply with a freezing time ratio less than or equal to the first threshold value in the multiple CPU maximum power supply does not damage the user experience. Among them, the smallest CPU maximum supply power among the CPU maximum supply power whose freeze duration ratio is less than or equal to the first threshold has the lowest power consumption for the electronic device. Therefore, determining it as the optimal power of the main-secondary scenario can ensure that when the electronic device runs in the main-secondary scenario, it will not damage the user experience and can effectively reduce power consumption.

[0009] Optionally, the first threshold may be 0.03.

[0010] Optionally, in the present method, for different scenarios, the electronic device can adjust the maximum power that the CPU can supply to different power values. It should be understood that different operating scenarios have different performance requirements for electronic devices. For example, when other conditions are the same, the performance requirements of the electronic device when the user is watching a video may be higher than when the user is not watching a video; for example, when the electronic device has multiple external devices, the performance requirements may be higher than when there are no external devices. In these scenarios, the secondary scene is an operating scene with lower performance requirements for the electronic device. When the electronic device does not detect a primary event, it can be considered that the electronic device has entered the secondary scene. Since the focus application is the scene with the highest user attention, in the present method, the electronic device can give priority to the performance requirements of the main secondary scene related to the focus application in the secondary scene. In the present method, the electronic device can uniquely determine a main secondary scene by parameters related to performance requirements (hereinafter referred to as main secondary scene parameters). These parameters may include one or more of the focus application, the size of the focus application window, the memory usage of the focus application, whether to watch a video, the download speed, whether to use a camera, whether to play audio, the type of external device, whether to use a keyboard, the device screen brightness, the device available memory RAM, the integrated graphics card load rate, the independent graphics card load rate, and the hard disk write speed. It may also include other parameters, which are not limited in this application.

[0011] Optionally, the electronic device may execute this method only when it is in an uncharged state, that is, the electronic device may determine the optimal power based on the valid data of the first primary and secondary scenarios only when it is in an uncharged state, and adjust the maximum power that can be supplied by the CPU of the electronic device based on the optimal power. Since the electronic device has sufficient power supply in the charging state, the electronic device does not need to adjust the maximum power that can be supplied by the CPU based on the operating scenario, but always keeps the maximum power that can be supplied by the CPU at the maximum power, giving priority to ensuring the performance requirements of the electronic device.

[0012] In combination with the first aspect, in a possible implementation, the obtaining of valid data of the first main-secondary scenario 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 second power being the power that is less than the first power and has the smallest difference with the first power among the maximum power supply of the multiple different central processing units CPU, the valid data set includes the 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 running at the first power and the second power respectively in the first main-secondary scenario.

[0013] In some embodiments, the electronic device can gradually reduce the maximum power that can be supplied by the CPU from high to low to obtain valid data in the first main and secondary scenes. It should be understood that when an electronic device runs with a maximum power that can be supplied by a CPU in a main and secondary scene, the smoother the electronic device runs (i.e., the less jamming occurs), the more the performance provided by the maximum power that can be supplied by the CPU can meet the performance requirements of the main and secondary scenes. This also means that the performance provided by the electronic device may have redundant performance after meeting the performance requirements of the main and secondary scenes. In this case, the electronic device can appropriately reduce the maximum power that can be supplied by 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 runs with the maximum power that can be supplied by 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.

[0014] In this way, the maximum power that can be supplied by the CPU of the electronic device can quickly approach the optimal power of the first main-secondary scenario, and operate at 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.

[0015] In combination with the first aspect, in a possible implementation, the acquisition of valid data for the first main-secondary scenario includes: in the first main-secondary scenario, operating with the CPU's maximum supplyable power as the first power; when the duration of operation at the first power does not reach the first duration and a freeze occurs, adjusting the CPU's maximum supply power to a third power, the third power being the power among the multiple different central processing unit CPU's maximum supplyable powers that is greater than the first power and having the smallest difference with the first power, the valid data for the first main-secondary scenario include the operating duration and freeze duration of running at the first power and the third power respectively in the first main-secondary scenario.

[0016] In this embodiment, when a jam occurs, the electronic device will increase the power, which can effectively avoid the influence of the randomness of the data on the accuracy of the result. Taking the above-mentioned first duration of 30s as an example, assuming that in the first main and secondary scenarios, the probability of jamming when the electronic device runs at the first power is very small, which is actually 0.05. However, when running at the first power, the electronic device ran for 30s and jammed 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 when the electronic device runs 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 proportion 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.

[0017] In combination with the first aspect, in a possible implementation, the acquisition of valid data of the first main-secondary scene includes: in the first main-secondary scene, operating with the maximum power that the CPU can supply as the first power; when the duration of operation at the first power has not reached the first duration and no lag occurs, detecting entry into the second scene, and saving the exploration progress of the first main-secondary scene as the first power; detecting that the first main-secondary scene is entered again, adjusting the maximum power that the CPU can supply to the power corresponding to the exploration progress of the first main-secondary scene, and the valid data of the first main-secondary scene include the operating duration and the lag duration of operation at the first power in the first main-secondary scene.

[0018] It is understandable that during the actual operation of the electronic device, the operation scene 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 scene, 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 scene, the main secondary scene in which the electronic device is located may change from the first main secondary scene to another scene (the scene may be a main secondary scene or a primary scene). Therefore, in this embodiment, when the operation scene in which the electronic device is located changes from the first main secondary scene to another scene, the electronic device can save the operation time and the jamming time of this operation at the first power, and record the exploration progress (i.e., the first power) in the first main secondary scene, so that when the scene in which the electronic device is located changes to the first main secondary scene 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 scene.

[0019] In combination with the first aspect, in a possible implementation, after the detection of entering the second scene, the method also includes: when the second scene is a second main-secondary scene, adjusting the maximum power that can be supplied by the CPU to the power corresponding to the exploration progress of the second scene, the second main-secondary scene includes a scene related to the focus application when the electronic device does not detect an interaction event, and the second main-secondary scene is different from the first main-secondary scene; when the second scene is a first-level scene, adjusting the maximum power that can be supplied by the CPU to the maximum power, and the first-level scene includes an operating scene in which the electronic device detects an interaction event.

[0020] In this implementation manner, after the electronic device switches from the first main-secondary scene to the second scene, the electronic device can determine the maximum power supply value of the CPU that needs to be adjusted according to the type of the second scene.

[0021] In the case where the second scenario is a first-level scenario, since the first-level scenario has a high performance requirement for the electronic device, the electronic device will directly adjust the maximum power that the CPU can supply to the maximum power in the first-level scenario to ensure 100% supply of the electronic device performance. Optionally, in some embodiments, as long as a first-level event is detected in the second scenario, the second scenario can be determined to be a first-level scenario, and the first-level event may include but is not limited to the following events: 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 can include the keyboard Ctrl key, Win key, Shift key, Alt key, Esc key, F1-F12 key, Fn key, Enter key, PrtSc key, PgUp key, PgDn key, etc., and can also include other shortcut keys, as well as shortcut keys obtained by combining multiple shortcut keys in these shortcut keys), the user switches the focus application operation, etc. 2. High load events of the electronic device. For example, the event that the CPU of the electronic device is in a high load state, the event that the electronic device enters the game mode, etc.

[0022] In the case where the second scene is the main-secondary scene, when the electronic device last switched from the second main-secondary scene to other scenes, it would also record the power exploration progress in the second main-secondary scene (if it is the first time entering the second main-secondary scene, the default power exploration progress is the maximum power). Therefore, after entering the second main-secondary scene, the electronic device will start with the power corresponding to the 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.

[0023] In combination with the first aspect, in a possible implementation, the acquisition of valid data of the first main-secondary scene includes: in the first main-secondary scene, operating with the first power as the maximum power that the CPU can supply; when the duration of operation at the first power does not reach the first duration and no lag occurs, detecting that the operating scene has changed from the first main-secondary scene to the third scene; if the last saved exploration progress of the first main-secondary scene is the first power, then the number of explorations of the first power in the first main-secondary scene is added by 1, and the exploration progress of the first main-secondary scene is saved as the first power; if the last saved exploration progress of the first main-secondary scene is not the first power, then the number of explorations of the first power in the first main-secondary scene is set to 1, and the exploration progress of the first main-secondary scene is saved as the first power; the exploration progress The degree represents the maximum power that can be supplied by the CPU of the electronic device last used in the main-secondary scenarios; when it is detected that the operating scenario has changed to the first main-secondary scenario, if the number of explorations of the power corresponding to the exploration progress of the first main-secondary scenario is less than or equal to the second threshold, the maximum power that can be supplied by the CPU is adjusted to the power corresponding to the exploration progress of the first main-secondary scenario; when the number of explorations of the power corresponding to the exploration progress of the first main-secondary scenario is greater than the second threshold, the maximum power that can be supplied by the CPU is adjusted to the second power, the second power being the power that is less than the power corresponding to the exploration progress and has the smallest difference with the power corresponding to the exploration progress among the multiple different maximum power that can be supplied by the CPU, and the valid data of the first main-secondary scenario include the operating time and the freeze time of running at the first power and the second power respectively in the first main-secondary scenario.

[0024] In combination with the above description, it can be known that for a main-secondary scene, the electronic device can save the exploration progress of the first main-secondary scene when the main-secondary scene changes from the first main-secondary scene to the second main-secondary scene, and in the second main-secondary scene, continue to operate from high to low with different maximum CPU power supplies starting from the exploration progress of the second main-secondary scene. In the subsequent process, if the operation scene of the electronic device is switched back to the first main-secondary scene, the electronic device will start again from the exploration progress of the first main-secondary scene and continue to operate from high to low with different maximum CPU power supplies to complete the acquisition of valid data for each main-secondary scene.

[0025] However, for some main-secondary scenes, the duration of each time is relatively short, and the duration of each time may be less than the above-mentioned first duration. In this case, in the process of obtaining valid data of these main-secondary scenes, the scene in which the electronic device is located may frequently switch from these main-secondary scenes to other scenes. Assuming that the duration of each time of the first main-secondary scene is less than the first duration, then each time the electronic device switches back to the first main-secondary scene from other scenes, since the duration of each time of the first main-secondary scene cannot meet the duration required for the electronic device to actively reduce the maximum power supply of the CPU (i.e., the first duration), then in the first main-secondary scene, each time the electronic device switches from the first main-secondary scene to other scenes, the exploration progress of the first main-secondary scene is the same maximum power supply of the CPU, and the electronic device will also always run at the maximum power supply of the CPU, and cannot continue to obtain the operation time and freeze time corresponding to the lower maximum power supply of the CPU.

[0026] Therefore, in this embodiment, when obtaining valid data of the first main-secondary scene, if the first main-secondary scene is switched to the third scene, in addition to saving the exploration progress of the first main-secondary scene, the electronic device will also determine whether the exploration progress saved this time is the same as the exploration progress recorded last time. If they are the same, the number of explorations of the power corresponding to the exploration progress + 1 is recorded (indicating the number of times the electronic device has continuously operated at this power + 1); otherwise, the number of explorations of the power corresponding to the exploration progress is set to 1. Each time the operating scene is switched to the first main-secondary scene, the electronic device will obtain the current exploration progress in the first main-secondary scene and the number of explorations of the power corresponding to the exploration progress. If the number of explorations is greater than the second threshold, the electronic device may not operate at the power corresponding to the current exploration progress, but may reduce the maximum power that the CPU can supply to the second power; if the number of explorations is less than or equal to the second threshold, it will operate at the power corresponding to the exploration progress.

[0027] Specifically, the second threshold value may be 5 or other values, which is not limited in the present application.

[0028] In combination with the first aspect, in a possible implementation, the obtaining of valid data of the first main-secondary scenario includes: in the first main-secondary scenario, operating with the maximum power that can be supplied by the CPU as the first power; when the duration of operation at the first power does not reach the first duration and a jam occurs, the number of jams corresponding to the first power is increased by 1, and the maximum power supplied by the CPU is adjusted to a third power, the number of jams represents the number of jams that occur in all the times when a CPU maximum power can be supplied is used to operate, and the third power is the power that is greater than the first power and has the smallest difference with the first power among the maximum power that can be supplied by the multiple different central processing units CPU; when the duration of operation at the third power reaches the first duration and no jam occurs, determining whether to adjust the maximum power that can be supplied by the CPU to the first power or to maintain it at the third power according to the number of jams corresponding to the first power; wherein, the more jams the first power corresponds to, the smaller the probability of adjusting the maximum power that can be supplied by the CPU to the first power, and the valid data of the first main-secondary scenario include the operating duration and jam duration of operation at the first power and the third power respectively in the first main-secondary scenario.

[0029] In the process of obtaining valid data of a primary and secondary scenario, if an electronic device freezes while operating at a certain power, even if the freeze is a probabilistic event, it is still of reference significance to a certain extent, that is, the freeze indicates to a certain extent that the electronic device may freeze when operating at the maximum power that the CPU can supply in the primary and secondary scenario. In particular, for the maximum power that the CPU can supply that is used multiple times, the more freezes occur, the more likely the maximum power that the CPU can supply will damage the user experience.

[0030] Combined with the above description, it can be known that if the electronic device runs at a certain power for a period of time that reaches the first period of time and no jamming occurs, the electronic device will reduce the maximum CPU power supply to a lower maximum CPU power supply. If the electronic device has previously run at this lower maximum CPU power supply, and the electronic device has jammed every time it ran at a lower maximum CPU power supply, then if the electronic device still chooses to directly reduce the maximum CPU power supply, the electronic device will most likely jam during subsequent operation, and the user may not be able to use the electronic device normally.

[0031] Therefore, in the present application, when the electronic device needs to lower the maximum power that the CPU can supply to a certain power, if the electronic device has previously been stuck when running at this power, the electronic device can choose whether to lower the maximum power that the CPU can supply to this power. That is, for any main-secondary scene, when obtaining valid data for the main-secondary scene, if the duration of operation at the first power reaches the duration and no stuck occurs, the electronic device can determine whether it is necessary to increase the maximum power that the CPU can supply to the third power according to the number of explorations in which stuck occurs in all the times of running at the third power. Specifically, it is assumed here that the number of stucks in all the times of running at the third power is n, then in the embodiment of the present application, the electronic device can obtain a random number falling in the interval [0,1] based on the random number function random(), and if this random number is less than or equal to 1 / 2n, the electronic device will adjust the maximum power that the CPU can supply to the third power; if this random number is greater than 1 / 2n, the electronic device will keep the maximum power that the CPU can supply to the first power. In this way, the probability of electronic devices being stuck can be reduced in obtaining valid data, further improving the user experience.

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

[0033] In order to avoid endless adjustment of the maximum power that can be supplied by the CPU in a main secondary scene, in this embodiment, for any main secondary scene, when the total operating time of the electronic device in the main secondary scene reaches the second time, it can be regarded that the electronic device has basically been able to determine the optimal power of the main secondary scene through the data obtained in the main secondary scene. At this time, the original data corresponding to the main secondary scene is valid data, and the main secondary scene can be called a valid main secondary scene.

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

[0035] In combination with the first aspect, in a possible implementation, the adjusting the maximum supply power of the CPU of the electronic device according to the optimal power of the first main-secondary scenario 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 a target power, wherein the target power is any one of 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 optimal power, the fifth power is greater than the optimal power, the fourth power and the fifth power belong 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 third threshold.

[0036] 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 primary and secondary scenarios based on valid data, the electronic device can adjust 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.

[0037] 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 of the first main-secondary scenario, the method further includes: collecting feedback data, the feedback data including the operating time and the freezing time of running at the adjusted maximum CPU supply power; updating the valid data of the first main-secondary scenario according to the feedback data.

[0038] 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 scenes based on the acquired feedback data, so as to ensure the optimal power accuracy of the valid data acquisition of the primary and secondary scenes when the application APP is continuously updated.

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

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

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

[0042] 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

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

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

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

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

[0047] Figure 5 A schematic diagram of a gear exploration process for a primary and secondary scene provided in an embodiment of the present application;

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

[0049] Figure 7 A schematic diagram of discretized data provided in an embodiment of the present application;

[0050] Figure 8 A schematic diagram of a gear exploration process for a primary and secondary scene with a short duration provided in an embodiment of the present application;

[0051] Fig. 9 A schematic diagram of a gear exploration process for a primary and secondary scene provided in an embodiment of the present application;

[0052] Fig.10 A schematic diagram of a process for updating valid data provided in an embodiment of the present application;

[0053] Fig.11 A schematic diagram of a process for determining an optimal power gear based on a primary and secondary auxiliary scenario provided in an embodiment of the present application;

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

[0055] Fig.13 An architectural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

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

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

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

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

[0060] 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).

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

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

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

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

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

[0066] (2) Focus application and background application

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

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

[0069] (3) Primary scenario and secondary scenario

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

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

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

[0073] 1. Main secondary scene.

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

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

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

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

[0078] 2. Auxiliary secondary scene.

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

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

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

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

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

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

[0085] Combined with the above description, it can be known that the maximum power that can be supplied by the CPU of an electronic device has an upper limit for adjustment, and this upper limit is determined when the electronic device leaves the factory. Here, it is assumed that the power value corresponding to the upper limit is Pm, and then the corresponding power level can be set for the maximum power that can be supplied by the CPU based on the power value Pm. For details, please refer to the example in the following table:

[0086] Table 1

[0087]

[0088] 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 gears can also be set in other ways, for example, more or fewer power gears can be set compared to Table 1.

[0089] (5) Optimal power

[0090] Different maximum CPU power supplies provide different performance limits for electronic devices. When the electronic device runs at different maximum CPU power supplies in a scenario, the power consumed may also be different.

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

[0092] In some implementations, 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 main and secondary scenes. When adjusting the power, the power is adjusted to the optimal power gear for the main and secondary scenes according to the gear, which can make the adjustment process of the electronic device more convenient and quick.

[0093] The following embodiments all take the power level as an example to explain the process of adjusting the power of the electronic device to the optimal power level. For how to determine the optimal power in a primary and secondary scenario, please refer to the following method embodiments.

[0094] (6) Lightweight Gradient Boosting Machine Model

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

[0096] 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 parameters corresponding to the main and secondary scenes 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, if the number of samples is too high and the number of features is too large, the performance of the model may be seriously affected.

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

[0098] The present application provides a power determination method. When the method is implemented, when the operation scenario of the electronic device is a primary-secondary scenario, for each primary-secondary scenario, the electronic device will operate at multiple different gears of the maximum power that the CPU can supply, and the optimal power gear of the primary-secondary scenario is determined according to the proportion of the freezing time of the electronic device running at different power gears. In the subsequent operation process, when the electronic device is in a certain primary-secondary scenario, the electronic device can adjust the gear of the maximum power that the CPU can supply to the optimal power gear corresponding to the primary-secondary scenario, effectively saving the power of the electronic device without affecting the user experience.

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

[0100] Figure 1 A user interface for an electronic device running a primary scene and a secondary scene is provided in an embodiment of the present application.

[0101] Figure 1 The electronic device 10 in the embodiment may be a notebook computer.

[0102] Figure 1 (A) shows the user interface of the electronic device 10 in the primary secondary scene scene 1. Figure 1 In (A), the user is watching a video that has been downloaded (cached) in the electronic device through the "Video" application, and the application window 101 is the application window of the "Video" application. Figure 1In the main secondary scene scene1 shown in (A), if the user opens the hardware detection application through the electronic device 10, the application window 102 of the hardware detection application can show the user the hardware information and performance of the electronic device at the moment. It can be seen from the hardware information displayed in the dotted box in the application window 102 that the maximum power supply of the CPU of the electronic device 10 (i.e., PL1, the same below) is 45W (assuming that this power value corresponds to the maximum power level 10 of the maximum power supply of the CPU), and the total system power is 25.411W, and the average system power is 26.305W.

[0103] At a certain moment, the electronic device 10 is still in the main secondary scene scene1, but due to insufficient power, the user turns on the power saving mode of the electronic device 10. Figure 1 As shown in (B) in FIG. 1 , it can be seen from the hardware information displayed in the dotted box of the application window 104 of the hardware detection application that in the power saving mode, the maximum power that the CPU of the electronic device 10 can supply is reduced to 20W, and the total system power is correspondingly reduced to 25.411W, and the average system power is 26.305W. Although the power consumption of the electronic device 10 is reduced at this time, it can be seen from the video screen played in the application window 103 that the electronic device 10 has obvious freezes when playing the video, resulting in the following video screen: Figure 1 The blurred area 1031 shown in (B) affects the normal use of the user and seriously impairs the user experience. This means that the CPU does not provide enough performance for the electronic device 10 to enable the electronic device 10 to run smoothly in scene 1, and also means that the power saving mode is not applicable to every operation scene.

[0104] In the method provided in the present application, the optimal power levels determined for electronic devices in different main and secondary scenarios can be different. The optimal power level determined for any main and secondary scenario can allow the electronic device to effectively reduce its own power consumption without affecting the user experience.

[0105] like Figure 2 As shown, Figure 2 (A) shows the user interface of the electronic device 10 in the main secondary scene scene1. Figure 1 The main secondary scene scene1 shown in (A) is the same main secondary scene. Figure 2The application window 202 of the detection application shown in (A) shows the hardware information of the electronic device 10 at this moment. It can be seen that at this moment, the maximum CPU power supply determined by the power determination method provided by the present application for scene 1 is 25W (this power value corresponds to the 5th level of the maximum CPU power supply). Correspondingly, at this moment, the total system power also changes to 25.325W, and the average system power changes to 25.525W. It can be seen that compared with Figure 1 In (A), the maximum power that the CPU of the electronic device 10 can supply is reduced to 20W, and the total system power is correspondingly reduced to 25.411W, and the average system power is 26.305W. Although the power consumption and performance of the electronic device 10 are reduced at this time, it can be seen from the video screen played in the application window 201 that the electronic device 10 can still play the video smoothly, and the screen displayed by the electronic device 10 and the mouse cursor are not stuck, so the user experience is not impaired. This means that when the CPU working power is 25W, it is enough to provide sufficient performance for the electronic device 10 so that the electronic device 10 can run smoothly in scene 1.

[0106] At some point, the operating scenario of the electronic device 10 changes. Figure 2 As shown in (B), at this time, the electronic device 10 plays music through the music application. After switching the focus application from the video application to the music application, the electronic device does not trigger a primary event during the process of playing music. At this time, the electronic device 10 is in the main secondary scene scene2, and the application window 203 is the application window of the "Music" application. It can be seen from the hardware information shown in the application window 204 of the hardware detection application that at this time, the maximum CPU power supply determined by the electronic device 10 for the main secondary scene scene2 is 10W (this power value corresponds to the 2nd gear of the maximum CPU power supply). Correspondingly, the total system power is reduced to 10.325W, and the system average power is also reduced to 11.525W. Although in the main secondary scene scene2, the total system power and the system average power of the electronic device are different and lower than those in scene1, the electronic device 10 can still play music smoothly at this time, and the screen of the display screen of the electronic device 10 and the mouse cursor are not stuck, and the user experience will not be impaired.

[0107] The power adjustment method provided by the present application is described in detail below.

[0108] Figure 3 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 determination method provided in the embodiment of the present application, the electronic device can determine the optimal power level of the main secondary scene in the secondary scene, giving priority to ensuring the performance requirements of the focus application. Figure 3 , the method may include the following steps: referring to Figure 3 , the method may include the following steps:

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

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

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

[0112] S102: The electronic device determines the current operating scenario.

[0113] During the operation of the electronic device after it is put into use, the operation scenario of the electronic device will constantly change under the operation of the user, and the operation scenario includes the primary scenario and the secondary scenario.

[0114] The electronic device can determine the current operation scene by detecting whether a primary event occurs. If a primary event occurs, it means that the electronic device is in the primary scene, and the electronic device can execute step S103; otherwise, it means that the electronic device is in the secondary scene, and the electronic device can execute step S104.

[0115] S103: 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.

[0116] like Figure 4 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.

[0117] 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 CPU's maximum power supply to the maximum power level to ensure 100% supply of the electronic device's performance.

[0118] 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 S104. Specifically, the above N can be 5 or other values, and this application does not limit this.

[0119] S104: When the operating scenario is a secondary scenario, the electronic device obtains valid data of the primary and secondary scenarios based on an optimal power exploration strategy.

[0120] When the electronic device is in any secondary scene, the electronic device can obtain all main secondary scene parameters of the main secondary scene in the secondary scene, including the focus application and the focus application window size, and use the obtained main secondary scene parameters as part of the valid data corresponding to the main secondary scene, so that the corresponding valid data can be successfully obtained when it is in the main secondary scene again later.

[0121] Afterwards, the electronic device will obtain valid data of the secondary scene based on the optimal power exploration strategy in the main secondary scene. The specific operation corresponding to the optimal exploration strategy is: in the main secondary scene, the electronic device operates with multiple different CPU maximum power supply levels, that is, the electronic device sequentially adjusts the CPU maximum power supply level to power levels with different power sizes. In the process of running at various power levels, the electronic device can record the proportion of the freeze time at each power level (that is, the proportion of the freeze time in the running time), and determine the optimal power level of the secondary scene based on the freeze time proportion corresponding to each power level.

[0122] Specifically, for any main secondary scene scene_x in which the electronic device is located, the electronic device can successively operate at all optional power levels of the maximum power that the CPU can supply. For each power level, the electronic device can set the same operating duration T, for example, T can be 30s. Under the main secondary scene scene_x, when the electronic device starts to use a new power level PL1_x to operate, the electronic device will record the starting time t_start of the operation at the power level PL1_x; during the operation, the electronic device will record the duration duration_ttl of the operation at the level PL1_x, and the duration duration_delay of the electronic device being stuck when running at the level PL1_x. After the operating time reaches the specified operating time T, the electronic device can adjust the level of the maximum power that the CPU can supply from PL1_x to another unexplored level PL1_y. It can be understood that the percentage of the stuck duration corresponding to the level PL1_x in the main secondary scene scene_x is duration_delay / duration_ttl, and at this time duration_ttl is T duration.

[0123] Preferably, in some embodiments, when using the optimal power exploration strategy to obtain valid data of scene_x, the electronic device can be operated in all optional gears of the maximum power supply of the CPU provided by the electronic device from high to low. During the entire gear exploration process, 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 will be lowered by one gear after the running time reaches T to continue exploring; but if a freeze occurs within the specified time T, the electronic device will immediately increase the maximum power supply of the CPU by one gear after the freeze occurs (the time when the freeze occurs and the running time at the gear may not reach T time) and continue to explore to a lower gear. In addition, if the running scene of the electronic device changes from scene_x to other scenes during the exploration process, the electronic device will record the current gear exploration progress under scene_x (in some other embodiments of the present application, "gear exploration progress" may also be referred to as "exploration progress"), and if the electronic device re-enters scene_x later, it will continue to explore at the gear corresponding to the gear exploration progress. The specific gear exploration rules are set as follows:

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

[0125] 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).

[0126] 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 freeze;

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

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

[0129] The electronic device saves the duration of operation at power level PL1_x and the duration of freeze under scene_x (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), the corresponding operating duration and freeze duration (0s) are saved; in addition, the electronic device will continue to explore lower gears based on the new main secondary scene scene_y, starting from the gear exploration progress PL1_y saved under scene_y.

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

[0131] The electronic device saves the exploration progress PL1_x, and raises the power level by one level to level PL1_x+1; and saves the running time T3 and the freezing time T4 at the power level 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.

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

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

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

[0135] The electronic device ends the gear exploration process for scene_x, and saves the main and secondary scene parameters corresponding to scene_x and the proportion of the freezing time of the electronic device at different power gears when in scene_x as valid data of scene_x.

[0136] Wherein, Ts is greater than or equal to n×T, and n is the number of all adjustable power levels of the maximum adjustable power of the CPU. Preferably, Ts=2n×T.

[0137] In the embodiment of the present application, the main secondary scene scene_x can be referred to as the "first main secondary scene", the main secondary scene scene_y can also be referred to as the "second main secondary scene", and the valid data of scene_x can be referred to as the valid data of the "first main secondary scene". The maximum power that can be supplied by the CPU corresponding to the power level PL1_x can be referred to as the "first power", the maximum power that can be supplied by the CPU corresponding to the power level PL1_x-1 can be referred to as the "second power", and the maximum power that can be supplied by the CPU corresponding to the power level PL1_x+1 can be referred to as the "third power", the duration T can be referred to as the "first duration", and Ts can be referred to as the "second duration".

[0138] It can be seen from the above gear exploration rules that for a secondary scene, if the electronic device freezes when running at a certain power gear, this power gear and the power gear lower than this power gear are unlikely to be the optimal power gear for the secondary scene. Therefore, the electronic device will not continue to explore lower power gears, but will explore higher power gears. In the same main secondary scene scene_x, the electronic device may explore the same gear PL1_x multiple times, and the corresponding electronic device will also record multiple duration_delay and multiple duration_ttl. At this time, duration_ttl is not necessarily T duration. At this time, the proportion of freezing duration corresponding to power gear PL1_x can be calculated as DURATION_DELAY / DURATION_TTL; where DURATION_TTL is the sum of the running duration of the electronic device each time it runs at power gear PL1_x, and DURATION_DELAY is the sum of the freezing duration of the electronic device each time it runs scene_x at power gear PL1_x.

[0139] Based on this, when the total operating time of the electronic device in a main secondary scene reaches Ts, the electronic device can determine the optimal power gear of the main secondary scene based on the proportion of the freeze time corresponding to each gear in the main secondary scene. Optionally, when the above-mentioned duration T is 30s, the duration Ts can be set to 600s. At this time, 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 the "valid main secondary scene". The valid data includes: the main secondary scene parameters of the main secondary scene, multiple power gears explored in the main secondary scene, and the corresponding freeze time ratio under each power gear.

[0140] In addition, combined with the above-mentioned gear exploration rules, it can be known that the electronic device gradually lowers the CPU's maximum power supply gear from high to low, which is only a large adjustment trend. In the actual gear exploration process of the main and secondary scenes, the electronic device may not completely lower the CPU's maximum power supply gear in the direction of adjustment from high to low - when a jam occurs, the electronic device will raise the power gear by one gear, which can effectively avoid the impact of the randomness of the data on the accuracy of the results. For example, assuming that the probability of jamming when the electronic device runs at gear PL1_x in the main and secondary scene scene_x is very small, actually 0.05, but when exploring at gear PL1_x, the electronic device runs for 30s and jams for 3s (a small probability event occurs). If the power gear is simply continued to be lowered, the total running time and total jamming time corresponding to the power gear PL1_x will not be updated, so the proportion of jamming time corresponding to the power gear PL1_x calculated by the electronic device is 3 / 30=0.1, which is twice the actual jamming probability. However, if the power level is raised by one level to PL1_x+1, and the probability of the electronic device being stuck when running at level PL1_x+1 in the main secondary scene scene_x is even lower, there is a high probability that no stuck will occur within 30 seconds. Therefore, after 30 seconds, the electronic device will lower the power level by one level and return to level PL1_x. Since the probability of the electronic device being stuck when running the main secondary scene scene_x at level PL1_x is very small, there is a high probability that no stuck will occur within 30 seconds when the electronic device runs at level PL1_x again. The total running time and total stuck time corresponding to the power level PL1_x will be updated to 60s and 3s, respectively. The percentage of stuck time corresponding to the power level PL1_x is calculated to be 3 / 60=0.05, which is closer to the actual stuck probability corresponding to the power level PL1_x, thereby reducing or even avoiding the impact of the randomness of the data on the accuracy of the results.

[0141] It is understandable that for a main secondary scene scene_x, if the electronic device frequently freezes when running at a certain gear PL1_x, the electronic device needs to adjust the power gear up by one gear when exploring the gear, and the power gear will be adjusted up by one gear when exploring the gear later because of the freeze. In this case, even after the total running time of the electronic device under the scene_x reaches Ts, the electronic device may still not explore the gear lower than PL1_x under scene_x, and it is impossible to obtain the proportion of the freeze duration of the electronic device when running at a gear lower than PL1_x under scene_x. Therefore, the information recorded in these gears in the valid data corresponding to scene_x is also empty. However, since the electronic device freezes every time it runs at PL1_x under scene_x, it is very likely that freezes will frequently occur when running at a gear lower than PL1_x under scene_x. That is to say, running at PL1_x or a gear lower than PL1_x under scene_x will seriously damage the user experience. Therefore, PL1_x and a gear lower than PL1_x are most likely not the optimal power gear for scene_x. Therefore, even if the percentage of the freezing time of these gears does not exist in the valid data, it is not important. In the subsequent process, for the gears with no percentage of freezing time in the valid data, the electronic device will assume that these gears will definitely damage the user experience.

[0142] Figure 5 The process of the electronic device performing gear exploration on the primary and secondary scenes according to the aforementioned gear exploration rules is exemplarily shown.

[0143] Here we assume that T is 30s, Ts is 600s, and the number of adjustable gears for the maximum power supply of the CPU is 10 (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 made). Figure 5 As shown, the raw data table 500 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 each main and secondary scene. In the raw data table 500, each main and secondary scene corresponds to a single 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 500 is empty.

[0144] Assume that scene 51 is the first main secondary scene entered at time t1 after the electronic device is started up from the factory. Figure 5 As shown in (A) in FIG. 5 , the original data 501 will be stored in the original data table 500 as the first original data. Figure 5Not shown, the electronic device will store the main and secondary scene parameters of scene 51 in the original data 501. In addition, the electronic device will also record in the original data 501 all the gears of the maximum power that the CPU can supply (100% is 10 gears, 90% is 9 gears, and so on, the same below). Each gear forms a tuple with scene 51, and the tuple is used to record the running time and the freezing time (the freezing time ratio) of the electronic device when it runs in the power gears that constitute the tuple under scene 51. Because the electronic device has not explored scene 51 before time t1, Figure 5 In the original data 501 shown in (A), the information corresponding to each gear is empty.

[0145] At time t1, the electronic device starts the power gear exploration process for scene 51. 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 to continue the exploration.

[0146] like Figure 5 As shown in (B), at time t2, the data area corresponding to the 10th gear of the original data 501 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 51 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, Figure 5 In the original data 501 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. Figure 5 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.

[0147] 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 51 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.

[0148] like Figure 5 As shown in (C), at time t3, the data area corresponding to the 9th level of the original data 501 has stored the duration information (10,0), which means that as of time t3, the total duration of the electronic device running scene 51 in the 9th level is 10s, and the total freeze is 0s.

[0149] 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 main secondary scene. Here, it is assumed that the main secondary scene where the electronic device is located after the primary scene ends is scene 51. Then, after 5 seconds from time t3, at time t4, the electronic device re-enters the main secondary scene scene 51. At this time, the electronic device will continue to perform gear exploration on scene 51 with the gear exploration progress of 9 gears for scene 51 saved in the original data 501.

[0150] like Figure 5 As shown in (D), at time t4, the data in the original data 501 has not changed compared to time t3, and the electronic device continues to run at gear 9 in scene 51. After running for 30 seconds, at time t5, the electronic device does not freeze during the entire running process. According to the gear exploration rule, the electronic device saves the gear exploration progress as gear 9, records the running time of running at gear 9 for 30 seconds and the freezing time of 0 seconds, and lowers the power gear by one gear to gear 8, and continues the gear exploration.

[0151] like Figure 5 As shown in (E), at time t5, the data area corresponding to the 9th gear of the original data 501 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 51 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: Figure 5The duration information (40,0) shown in (E) is obtained and recorded in the original data 501. The two duration information (40,0) and (10,0) can also be recorded in the original data 501 respectively, and this application does not limit this.

[0152] At t5, the electronic device starts to run at gear 8 under scene 51. 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 by one gear to gear 9 to continue the exploration.

[0153] like Figure 5 As shown in (F), at time t6, the data area corresponding to the 8th level of the original data 501 has stored the duration information (20, 0.3), which means that as of time t6, the total duration of the electronic device running scene 51 at the 8th level is 20 seconds, and the total delay is 0.3 seconds.

[0154] At time t6, the electronic device resumes operation at gear 9 under scene 51. 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 51 to main scene 52 (here it is assumed that the electronic device enters main scene 52 for the first time). According to the exploration rules, the electronic device will save the gear exploration progress of scene 51 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 51. In addition, the electronic device will also start gear exploration of the new main secondary scene scene 52, and create a new raw data 502 in the raw data table 500 to save the information obtained when exploring the gears of scene 52.

[0155] like Figure 5 As shown in (G), at time t7, the data area corresponding to the 9th gear of the original data 501 has saved the duration information (50,0), which means that as of time t7, the total duration of the electronic device running at gear 10 under scene 51 is 50s, and the total freeze is 0s. Similarly, the duration information (50,0) is obtained by merging 3 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 502 is added to the original data table 500, but because the electronic device has not yet explored the gear position of scene 52 before time t7, Figure 5 The information corresponding to each gear in the original data 502 shown in (G) is empty.

[0156] At t7, the electronic device starts gear exploration for scene 52. 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 the 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.

[0157] like Figure 5 As shown in (H), at time t8, the data area corresponding to the 10th gear of the original data 502 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 52 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 52.

[0158] 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 500 will also increase. Similarly, in the subsequent operation process, the electronic device will be in the same main and secondary scene many times. For example, the main and secondary scene of the electronic device may switch back to scene 51 again in the subsequent operation process. When the total operation time of the electronic device under scene 51 reaches 600s, it can be regarded that the gear exploration process of the electronic device for scene 51 has been completed, that is, the electronic device can basically determine the optimal power gear of scene 51 through the acquired data. At this time, the raw data corresponding to scene 51 is valid data, and scene 51 can be called a valid main and secondary scene.

[0159] It should be understood that in the present application, the stage in which the electronic device has not yet acquired valid data for any main-secondary scene can be referred to as the cold start stage, during which the electronic device has not yet completed the gear exploration process for any main-secondary scene. Therefore, for any main-secondary scene, the electronic device needs to use the above-mentioned optimal power exploration strategy to complete the corresponding gear exploration process. Accordingly, for any main-secondary scene, when the total operating time of the electronic device in the main-secondary scene reaches the Ts duration, that is, when the electronic device successfully acquires valid data in any main-secondary scene, the cold start stage also ends accordingly, and the electronic device enters the statistical stage.

[0160] S105. After obtaining valid data of the above-mentioned main-secondary scene, if the electronic device is in the main-secondary scene again, the electronic device determines the optimal power level of the main-secondary scene based on the valid data of the main-secondary scene, and adjusts the maximum power that can be supplied by the CPU to the optimal power level of the main-secondary scene.

[0161] It should be understood that in some scenarios, electronic devices may freeze even when running at the highest power level. Therefore, for any main-secondary scenario, when an electronic device runs at a certain power level, it does not mean that the user experience is impaired as long as the electronic device freezes. It is still necessary to determine whether the user experience is impaired based on the probability of the electronic device freezing when running at this power level. This probability can be reflected by the proportion of freezing duration when the electronic device runs at this power level. Therefore, after obtaining the valid data of the above-mentioned main-secondary scenarios, the electronic device can query the proportion of freezing duration corresponding to each level from high to low starting from the highest power level of the valid data, and take the lowest power level with a freezing duration ratio less than or equal to a certain threshold as the optimal power level. Specifically, the threshold is set to 0.03, and can also be set to other values, which are not limited in this application.

[0162] Afterwards, the electronic device can adjust the maximum power level that the CPU can supply to the optimal power level.

[0163] S106: The electronic device scene changes from the current main-secondary scene to a new scene, and the electronic device determines a power level of the maximum power that can be supplied by the CPU that needs to be adjusted based on the type of the new scene.

[0164] like Figure 6 As shown, the electronic device can always keep the gear of the maximum power supply of the CPU as the optimal power gear of the current main secondary scene in the current main secondary scene. If the current main secondary scene changes to another new scene, the electronic device can determine the power gear of the maximum power supply of the CPU that needs to be adjusted based on the type of the new scene, and start to operate at the new power gear of the maximum power supply of the CPU.

[0165] The new scene may be a primary scene or a new primary secondary scene.

[0166] When the above new scenario is a first-level scenario, for example, when the electronic device triggers a first-level event such as "mouse click" or "keyboard shortcut key input", the electronic device will directly adjust the CPU's maximum power supply level to the maximum power level based on the first-level scenario's high performance requirements for the electronic device, to ensure 100% supply of the electronic device's performance. For details, please refer to the above-mentioned description of step S103, which will not be repeated here.

[0167] When the above-mentioned new scene is a new secondary scene, the electronic device will determine whether the new main secondary scene is a valid main secondary scene or an invalid main secondary scene. If the new main secondary scene is a valid main secondary scene, the electronic device will determine the optimal power gear of the new main secondary scene based on the valid data of the new main secondary scene, and determine the gear of the maximum power that the CPU can supply as the optimal power gear of the new main secondary scene. If the new main secondary scene is an invalid main secondary scene, the electronic device will use the above-mentioned optimal exploration strategy to explore the new main secondary scene, that is, starting from the gear corresponding to the gear exploration progress recorded in the new main secondary scene, the gear of the maximum power that the CPU can supply is reduced from high to low, and the proportion of the lag time of the electronic device under each gear is recorded.

[0168] It should be noted that among the main-secondary scene parameters, parameters such as the focus application window size, the focus application memory usage, download speed, screen brightness, memory RAM, integrated graphics card load rate, independent graphics card load rate, and 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 the CPU can supply 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.

[0169] Take the download speed of an electronic device as an example, and combine it with Figure 7 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. Figure 7 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 701, sub-interval 702, sub-interval 703 and sub-interval 702, and their corresponding interval ranges are [0, 500], [400, 1024], [900, 1500], [1400, 2028], and their corresponding download speed gears are 1, 2, 3 and 4.

[0170] 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 main secondary scene. 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 into 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 into both the interval [0, 500] and [400, 1024], but because the download speed at the previous moment falls into 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 into 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.

[0171] 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. Figure 7 The division of the gear intervals is only for ease of understanding. In actual application scenarios, the endpoint values ​​of the sub-intervals obtained by dividing the secondary feature interval by the electronic device may be different, and the number of sub-intervals may also be different. This application does not limit this.

[0172] In addition, the electronic device is already in the statistical stage when executing step S106. In this stage, other valid main-secondary scenes besides the above-mentioned main-secondary scenes may exist in the electronic device. Of course, most of the ineffective main-secondary scenes may also exist in this stage. Therefore, in the statistical stage, the adjustment method of the electronic device to the maximum power supply level of the CPU in the main-secondary scene can also be divided into two types: 1. For the ineffective main-secondary scene, the electronic device uses the above-mentioned optimal power exploration strategy to perform gear exploration on the ineffective main-secondary scene. 2. For the effective main-secondary scene, the electronic device can use the optimal frequency level table reading method, that is, based on the proportion of the freeze time of each level in the corresponding effective data, the lowest level that is less than or equal to a certain threshold is determined as the optimal power level.

[0173] In some embodiments, when the valid data collected by the electronic device is greater than or equal to X, that is, when the valid main secondary scenes are greater than or equal to X, the electronic device can also use the valid data of multiple valid main secondary scenes to train and obtain a power prediction model. After obtaining the above power prediction model, the electronic device can be regarded as entering the prediction stage. In the prediction stage, when the electronic device is in any main secondary scene, regardless of whether the main secondary scene is a main secondary scene that the electronic device has encountered before, the power prediction model can use the main secondary scene parameters of the main secondary scene as input, and output the probability of the electronic device experiencing impaired user experience when running at each power level in the main secondary scene. Afterwards, the electronic device can start from the highest power level and traverse from high to low to explore, and determine the lowest power level with a probability of user damage less than a certain threshold (for example, 0.5) as the optimal power level corresponding to the main secondary scene, and adjust the maximum power level that the CPU can supply to the optimal power level. Specifically, the above power prediction model can be 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.

[0174] 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 can perform steps S101-S106 in the uncharging state; in the charging state, since the electronic device has sufficient power supply, no matter what operation scenario the electronic device is in, the electronic device can adjust the gear of the maximum power supply of the CPU to the maximum power gear to operate, providing better performance for the electronic device.

[0175] In some embodiments, the electronic device can also adjust the maximum operating frequency of the CPU to achieve the purpose of reducing the power consumption of the device without affecting the user experience. Accordingly, when collecting valid data for any secondary scene, the electronic device can also collect the proportion of the freeze time under different CPU maximum operating frequency gears by adjusting the maximum operating frequency gear of the CPU. In the subsequent operation process, for the effective secondary scene, the electronic device can also determine the optimal frequency gear of the main secondary scene based on the effective data of the effective main secondary scene (that is, for the main secondary scene, without affecting the user experience, the power gear with the lowest power consumption among all the CPU maximum operating frequency gears), and adjust the CPU maximum operating frequency gear to the above-mentioned optimal frequency gear.

[0176] Combined with the gear exploration rules in the above description, it can be known that for a secondary scene, when the current main secondary scene changes from scene_x to a new main secondary scene scene_y, the electronic device will save and store the gear exploration progress PL1_x under scene_x, and based on the new main secondary scene scene_y, continue to explore lower gears with the gear exploration progress PL1_y saved under scene_y. In the subsequent process, if the operating scene of the electronic device switches back to scene_x, the electronic device will restart the exploration process of the main secondary scene scene_x, and continue to explore lower gears with the gear exploration progress PL1_x saved under scene_x.

[0177] However, for some main-secondary scenes, the duration of each time is relatively short, and the duration of each time may be less than the above-mentioned T duration. In this case, the electronic device may frequently switch to other scenes during the process of gear exploration of these main-secondary scenes. Since the duration of each of these main-secondary scenes is less than T duration, each time you switch back to these main-secondary scenes from other scenes, the duration of the scene cannot meet the duration required for the electronic device to actively lower the gear (i.e., duration T). In these main-secondary scenes, the gear exploration progress saved each time the electronic device switches to other scenes is the same gear, and the electronic device will also repeatedly explore the same gear and will not be able to explore lower power gears.

[0178] In view of the above defects, in some embodiments, in the cold start phase and the statistical phase, for any non-valid main secondary scene scene_x, when performing gear exploration on scene_x, if scene_x switches to a new scene, the electronic device will not only save the gear exploration progress PL1_x under scene_x, but also determine whether the gear exploration progress PL1_x recorded this time is the same as the gear exploration progress recorded last time, that is, when the main secondary scene scene_x where the electronic device was last located switched to another scene, whether the gear exploration progress recorded for the main secondary scene scene_x was also PL1_x. If the gear exploration progress PL1_x recorded this time is the same as the gear exploration progress recorded last time (if the main secondary scene scene_x is entered for the first time to perform gear exploration, the gear exploration progress recorded last time is assumed to be 10 gears, and the number of explorations for each gear is assumed to be 0 times), then the number of explorations of the gear PL1_x + 1 is recorded (indicating that the number of times the electronic device has continuously explored the gear + 1); otherwise, the number of gear explorations of the gear progress PL1_x is set to 1. Each time the running scene is switched to scene_x, the electronic device will obtain the current gear exploration progress in scene_x and the number of explorations of the gear corresponding to the gear exploration progress. If the number of times this power gear has been explored continuously recently is greater than Y times, the electronic device may not continue to explore in the gear corresponding to the current gear exploration progress, but actively downgrade one gear to continue exploring, to the lowest gear 2; if the number of times this power gear has been explored continuously recently is less than or equal to Y times, then the gear corresponding to the current gear exploration progress is selected to continue exploring. Specifically, the value of the above Y can be 5, 6, or other values, and this application does not limit this.

[0179] In the embodiment of the present application, the gear exploration rule may be:

[0180] 1) In the main secondary scene scene_x, when the electronic device runs at the power level PL1_x for T1 (T1≤T), the running scene changes to the primary scene;

[0181] 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).

[0182] 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 freeze;

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

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

[0185] The electronic device saves the duration of operation at power level PL1_x and the duration of freeze (the duration of freeze is 0s at this time) under scene_x, and saves the gear exploration progress PL1_x under scene_x; that is, for the tuple (scene_x, PL1_x), the corresponding operation duration and freeze duration (0s) are saved; in addition, the electronic device will continue to explore lower gears based on the new main secondary scene scene_y, starting from the gear exploration progress PL1_y saved under scene_y;

[0186] In addition, if the gear exploration progress PL1_x currently saved by the electronic device is the same as the gear exploration progress recorded last time, the electronic device adds 1 to the exploration times of PL1_x; otherwise, the gear exploration times of the gear progress PL1_x is set to 1.

[0187] 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;

[0188] The electronic device saves the exploration progress PL1_x, and raises the power level by one level to level PL1_x+1; and saves the running time T3 and the freezing time T4 at the power level 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.

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

[0190] The electronic device restarts the exploration process of the main secondary scene scene_x, and obtains the gear exploration progress saved under scene_x. If the number of explorations corresponding to the gear exploration progress is greater than Y, the electronic device adjusts the power gear to a lower adjacent gear of the gear exploration progress and continues to explore the lower gear; if the number of explorations corresponding to the gear exploration progress is less than or equal to Y, the electronic device adjusts the power gear to the gear exploration progress saved under scene_x and continues to explore the lower gear.

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

[0192] 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. Figure 8 The process of the electronic device performing gear exploration for the main and secondary scenes with a shorter duration according to the gear exploration rule is exemplified.

[0193] Here we take the above Y as 5 and T as 30s as an example. Figure 8 As shown, the original data table 800 is used to record the information obtained by the electronic device when exploring each power gear in each main-secondary scenario. This information includes the main-secondary scenario parameters of the main-secondary scenario, and the operating time and freeze time of the electronic device at each gear in each main-secondary scenario.

[0194] Assume that scene 80 is an electronic device at t 80 A main secondary scene at the moment. Figure 8 As shown in (A) in the figure, the original data 801 will be stored in the original data table 800 as a piece of original data. At this time, the electronic device will store the main and secondary scene parameters of scene 80 in the original data 8001. In addition, the electronic device will also record all the gears of the maximum power that the CPU can supply in the original data 8001 (100% is the 10th gear, 90% is the 9th gear, and so on). At this time, the gear information column corresponding to the 10th gear of the original data 8001 also stores the default exploration number (0) of the electronic device for the 10th gear.

[0195] In t 80 At this moment, the electronic device starts the power level exploration process for scene 80. According to the aforementioned level exploration rules, at the beginning of the exploration, the electronic device will adjust the level of the maximum power that the CPU can supply to the highest level 10 and operate.

[0196] Since the duration of each main secondary scene 80 is very short, the electronic device will frequently switch from the main secondary scene 80 to other scenes and switch from other scenes back to the main secondary scene 80 during subsequent operation. 80Starting from the moment, the electronic device continues to run at gear 10 in scene 80 for 10 seconds. During the entire operation, the electronic device does not freeze, but the main secondary scene of the electronic device switches from scene 80 to other scenes. According to the exploration rule, the electronic device will save the gear exploration progress of 10 gears in scene 80, and record the running time of 10s and the freeze time of 0s when running at gear 10 in scene 80. In addition, since the gear exploration progress of 10 gears currently saved by the electronic device is the same as the gear exploration progress recorded last time (the gear exploration progress recorded last time when the electronic device is in the main secondary scene scene80 for the first time defaults to the maximum gear 10 gears), the electronic device will record the exploration times of gear 10 + 1, for a total of 1 time.

[0197] like Figure 8 As shown in (B), at t 81 At time t, the running scene of the electronic device switches back to the main secondary scene 80. At this time, the data area corresponding to the 10th level of the original data 8001 has stored the duration information (10,0), which means that the time period from t to t is 0. 81 At this moment, the total time that the electronic device runs at gear 10 under scene 80 is 10 seconds, and the total freeze time is 0 seconds. In addition, the gear information column corresponding to gear 10 of the original data 8001 also stores the number of times (1) the electronic device explored gear 10.

[0198] From 81 Starting from the moment, the electronic device continues to run at gear 10 in scene 80 for 15 seconds. During the entire operation, the electronic device does not freeze, but the main secondary scene of the electronic device switches from scene 80 to other scenes. According to the exploration rule, the electronic device will save the gear exploration progress of 10 gears in scene 80, and record the running time of 10s and the freeze time of 0s when running at gear 10 in scene 80. In addition, since the gear exploration progress of 10 gears currently saved by the electronic device is the same as the gear exploration progress recorded last time, the electronic device will record the exploration times of gear 10 + 1, for a total of 2 times.

[0199] like Figure 8 As shown in (C), at t 82 At time t, the running scene of the electronic device switches back to the main secondary scene 80. At this time, the data area corresponding to the 10th level of the original data 8001 has saved the duration information (25,0), which means that the time period from t to t is 25. 82 At this moment, the total time that the electronic device runs at gear 10 under scene 80 is 25 seconds, and the total freeze time is 0 seconds. In addition, the gear information column corresponding to gear 10 of the original data 8001 also stores the number of times (2) the electronic device explored gear 10.

[0200] In the subsequent exploration process, the duration of each operation of the electronic device at 10 gears in the main secondary scene 80 does not exceed 30 seconds. Each time the operation scene switches from the main secondary scene 80 to other scenes, the gear exploration progress saved by the electronic device is 10 gears. Each time the operation scene switches back to the main secondary scene 80, the electronic device can only operate at 10 gears again. However, each subsequent time the operation scene switches from the main secondary scene 80 to other scenes, the exploration progress of the electronic device at 10 gears in the main secondary scene 80 will be +1. Until t 83 At time t, the running scene of the electronic device switches to the main secondary scene 80 for the seventh time. When the electronic device obtains that the current gear exploration progress of scene 80 is 10 gears, and the electronic device reads from the original data 8001 that the electronic device has explored 10 gears in scene 80 for 6 consecutive times, and the number of consecutive explorations has exceeded the set exploration number threshold (5 times), then at t 83 At this moment, the electronic equipment no longer starts exploring from gear 10, but chooses to actively lower one gear, that is, to continue the gear exploration starting from gear 9.

[0201] like Figure 8 As shown in (D), at t 83 At time t, the running scene of the electronic device switches back to the main secondary scene 80. At this time, the data area corresponding to the 10th level of the original data 8001 has stored the duration information (60,0), which means that the time period from t to t is 0. 83 At the moment, the electronic device ran at level 10 under scene 80 for a total of 60 seconds, with a total of 0 seconds of lag. 83 At this time, the gear exploration progress recorded in the original data 8001 is still 10 gears, but the electronic device will adjust the gear of the CPU's maximum power supply to 9 gears and continue the gear exploration process for scene 80. At this time, the gear information column corresponding to gear 9 also stores the default exploration number (0) of the electronic device for gear 10.

[0202] From 83At the beginning of the moment, the electronic device runs continuously at gear 9 in scene 80 for 20 seconds. During the entire operation, the electronic device does not freeze, but the main secondary scene of the electronic device switches from scene 80 to other scenes. According to the exploration rule, the electronic device will save the gear exploration progress of 9 gears in scene 80, and record the running time of 20 seconds and the freeze time of 0 seconds when running at gear 9 in scene 80. In addition, since the gear exploration progress of 9 gears currently saved by the electronic device is different from the gear exploration progress of 10 gears recorded last time, the electronic device will set the exploration times of gear 10 to 1, for a total of 1 time.

[0203] like Figure 8 As shown in (E), at t 84 At time t, the running scene of the electronic device switches back to the main secondary scene 80. At this time, the data area corresponding to the 9th level of the original data 8001 has stored the duration information (20,0), which means that the time interval from t to t is 0. 84 At this moment, the total time that the electronic device ran at gear 10 under scene 80 was 20 seconds, and the total freeze time was 0 seconds. In addition, the gear information column corresponding to gear 9 of the original data 8001 also stores the number of times (1) the electronic device explored gear 9.

[0204] Similarly, in the subsequent gear exploration process, for some gears, the electronic device may still explore the same gear multiple times in succession. For any gear, the electronic device can record the number of consecutive explorations of each gear according to the above gear exploration rules, and decide whether to actively lower a gear to continue exploring when switching back to the main secondary scene next time based on the number of consecutive explorations of each gear, until the total operating time in the main secondary scene reaches Ts, then stop the gear exploration process for the main secondary scene.

[0205] In some embodiments of the present application, the main-secondary scene scene 80 can be referred to as the "first main-secondary scene", the maximum CPU supply power corresponding to power level 10 can be referred to as the "first power", and the maximum CPU supply power corresponding to power level 9 can be referred to as the "second power".

[0206] However, in the process of gear exploration for a primary and secondary scenario, if the electronic device freezes while running in a certain gear, even if the freeze is a probabilistic event, it is still of reference significance to a certain extent, that is, the freeze indicates to a certain extent that the electronic device may freeze when running in the gear in the above primary and secondary scenarios. In particular, for gears that have been explored multiple times, the more times the freeze occurs, the more likely it is that the gear will damage the user experience.

[0207] However, combined with the aforementioned gear exploration rules, if the electronic device runs at a certain gear for a period of time T without freezing, the electronic device will lower the gear to continue exploring. If the gear that needs to be lowered has been explored by the electronic device before, and the electronic device has frozen during the previous exploration process, if the electronic device still chooses to directly lower the gear, then the electronic device will most likely freeze during the subsequent operation, and the user may not be able to use the electronic device normally.

[0208] In response to the above defects, the present application further optimizes the gear exploration rules for non-valid secondary scenes: for any non-valid main secondary scene scene_x, when exploring the gears of scene_x, if the operation time in a certain gear reaches T time and no lag occurs, the electronic device can decide whether to downgrade to this gear based on the number of exploration times of the next gear that has lags in the total number of exploration times. Specifically, it is assumed here that the number of exploration times of the next gear that has lags in the total number of exploration times is n. In this embodiment of the present application, the electronic device can obtain a random number in the interval [0,1] based on the random number function random(). If this random number is less than or equal to 1 / 2 n , the electronic device will adjust the gear to the next gear; if this random number is greater than 1 / 2 n , the electronic device will keep running at the current gear. In this way, when a gear is explored more times with stuck, the value of n will be larger, and the probability of the gear damaging the user experience will be greater. Correspondingly, the probability of the electronic device downgrading from the previous gear to the gear will be smaller, which can reduce the probability of the electronic device stuck during the gear exploration process and further improve the user experience.

[0209] In the embodiment of the present application, the above gear search rule can be set as follows:

[0210] 1) In the main secondary scene scene_x, when the electronic device runs at the power level PL1_x for T1 (T1≤T), the running scene changes to the primary scene;

[0211] 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).

[0212] 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 freeze;

[0213] The electronic device saves the current gear exploration progress PL1_x, and saves the running time at the power gear PL1_x under scene_x and the freezing time (the freezing time is 0s at this time); that is, for the tuple (scene_x, PL1_x), the corresponding running time T and freezing time (0s) are saved.

[0214] In addition, the electronic device will also obtain a random number in the interval [0,1] based on the random number function random(), and obtain the number of explorations n in which the jam occurs in the total number of explorations of the next gear PL1_x-1. If the above random number is less than or equal to 1 / 2 n , the electronic device will adjust the gear to the next gear PL1_x-1; if this random number is greater than 1 / 2 n , the electronic equipment will continue to operate at the current gear PL1_x.

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

[0216] The electronic device saves the duration of operation at power level PL1_x and the duration of freeze (the duration of freeze is 0s at this time) under scene_x, and saves the gear exploration progress PL1_x under scene_x; that is, for the tuple (scene_x, PL1_x), the corresponding operation duration and freeze duration (0s) are saved; in addition, the electronic device will continue to explore lower gears based on the new main secondary scene scene_y, starting from the gear exploration progress PL1_y saved under scene_y;

[0217] In addition, if the gear exploration progress PL1_x currently saved by the electronic device is the same as the gear exploration progress recorded last time, the electronic device adds 1 to the exploration times of PL1_x; otherwise, the electronic device sets the exploration times of PL1_x to 0.

[0218] 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;

[0219] The electronic device saves the exploration progress PL1_x, increases the power level by one level to level PL1_x+1, and saves the running time T3 and the freezing time T4 under scene_x at the power level PL1_x. That is, for the tuple (scene_x, PL1_x), the corresponding running time T3 and the corresponding freezing time T4 are saved.

[0220] In addition, the electronic device will increase the number of explorations of PL1_x where the lag occurs by 1.

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

[0222] The electronic device restarts the exploration process of the main secondary scene scene_x, and obtains the gear exploration progress saved under scene_x. If the number of explorations corresponding to the gear exploration progress is greater than Y, the electronic device adjusts the power gear to a lower adjacent gear of the gear exploration progress and continues to explore the lower gear; if the number of explorations corresponding to the gear exploration progress is less than or equal to Y, the electronic device adjusts the power gear to the gear exploration progress saved under scene_x and continues to explore the lower gear.

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

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

[0225] Fig. 9 The process of the electronic device performing gear exploration on the primary and secondary scenes according to the gear exploration rules is exemplified.

[0226] Here we also take the above T of 30s as an example. Fig. 9 As shown, the original data table 900 is used to record the information obtained by the electronic device exploring each power gear in each main-secondary scenario. This information includes the main-secondary scenario parameters of the main-secondary scenario, and the operating time and freeze time of the electronic device running at each gear in each main-secondary scenario.

[0227] Assume scene 90 is an electronic device at t 90 A main secondary scene at the moment. Fig. 9 As shown in (A) in FIG. 1 , the raw data 901 will be stored as a raw data in the raw data table 900. At this time, the electronic device will store the main and secondary scene parameters of scene 90 in the raw data 9001. In addition, the electronic device will also record all gears of the maximum power that the CPU can supply in the raw data 9001 (100% is 10 gears, 90% is 9 gears, and so on).

[0228] In t 90At this time, the original data 9001 has saved the running time and the freezing time collected by exploring some gears. It can be seen from the original data 9001 that the electronic device did not freeze when running at gears 10 to 7 in scene 90. 90 At this moment, the electronic device switches the CPU's maximum power supply from 7 gears to 6 gears.

[0229] Assume that from t 90 At the beginning of the moment, the electronic device continued to run at 6th gear for 20 seconds under scene 90 until t 91 At that moment, there was a 0.2s freeze. According to the above gear exploration rules, the electronic device will save the gear exploration progress of scene 90 at gear 6, record the running time of 20s and the freeze time of 0.2s when running at gear 6 under scene 90, and add 1 to the number of explorations corresponding to the freeze at gear 6. At this time, the total number of explorations with freezes at gear 6 is 1. In addition, the electronic device will raise the gear to gear 7 to continue the exploration.

[0230] like Fig. 9 As shown in (B), at t 91 At this time, the data area corresponding to the 6th level of the original data 9001 has stored the duration information (20,0.2), which means that up to t 91 At this moment, the total duration of the electronic device running at gear 6 under scene 90 is 20 seconds, and the total freeze is 0 seconds. In addition, the data area corresponding to gear 6 in the original data 9001 also stores the total number of explorations in which the electronic device freezes when exploring at gear 6, which is 1.

[0231] From 91 Starting from time t, after running for 30 seconds, it reaches t 92 At this moment, if the electronic device does not freeze during the entire operation, according to the above gear exploration rules, the electronic device will save the current gear exploration progress 7 gears, and record the total running time 60s and freeze time 0s corresponding to the exploration process of gear 7. In addition, the electronic device will obtain a random number in the interval [0,1] based on the random number function random(), and obtain the number of explorations n (n is equal to 1 at this time) of the next gear 6 that freezes. If the above random number is less than or equal to 1 / 2 n , the electronic device will adjust the gear to gear 6; otherwise, the electronic device will continue to operate at the current gear 7. Here, it is assumed that when n=1, the random number obtained by the electronic device is less than or equal to 1 / 2 n , the electronic equipment will adjust the gear to 6th gear to continue exploring.

[0232] like Fig. 9 As shown in (C), at t92 At this time, the data area corresponding to the 7th level of the original data 9001 has stored the time length information (60,0), and the data area corresponding to the 6th level has stored the time length information (20,0.2), which means that as of t 92 At this moment, the electronic device ran for a total of 60 seconds at level 7 under scene 90, with a total of 0 seconds of lag; the total running time at level 7 was 20 seconds, with a total of 0.2 seconds of lag.

[0233] Assume that from t 92 At the beginning of the moment, the electronic device continued to run at 6th gear for 15 seconds under scene 90 until t 93 At that moment, there was a 0.1s freeze. According to the above gear exploration rules, the electronic device will save the gear exploration progress of scene 90 at gear 6, record the running time of 15s and the freeze time of 0.1s when running at gear 6 under scene 90, and add 1 to the number of explorations corresponding to the freeze at gear 6. At this time, the total number of explorations with freezes at gear 6 is 2. In addition, the electronic device will also increase the gear by one gear to gear 7 to continue the exploration.

[0234] like Fig. 9 As shown in (D), at t 93 At this time, the data area corresponding to the 6th level of the original data 9001 has stored the duration information (35,0.3), which means that up to t 93 At this moment, the total time that the electronic device runs at gear 6 under scene 90 is 35 seconds, and the total freeze is 0.3 seconds. In addition, the data area corresponding to gear 6 in the original data 9001 also stores the total number of explorations in which the electronic device freezes when exploring at gear 6, which is 2 times.

[0235] From 93 Starting from time t, after running for 30 seconds, it reaches t 94 At this moment, if the electronic device does not freeze during the entire operation, according to the above gear exploration rules, the electronic device will save the current gear exploration progress 7 gears, and record the total running time 90s and freeze time 0s corresponding to the exploration process of gear 7. Similarly, the electronic device will obtain a random number in the interval [0,1] based on the random number function random(), and obtain the number of explorations n (n is equal to 2) of the next gear 6 that freezes. If the above random number is less than or equal to 1 / 2 n , the electronic device will adjust the gear to 6th gear; otherwise, the electronic device will continue to operate at the current gear 7th gear.

[0236] Here, it is assumed that when n=2, the random number obtained by the electronic device is less than or equal to 1 / 2 n , the electronic device will adjust the gear to gear 6 to continue exploring. Fig. 9 As shown in (E), at t 94 At this time, the data area corresponding to the 7th level of the original data 9001 has stored the time length information (90,0), and the data area corresponding to the 6th level has stored the time length information (35,0.3), which means that as of t 92 At this moment, the electronic device ran for a total of 90 seconds at gear 7 under scene 90, with a total of 0 seconds of lag; the total running time at gear 7 was 35, with a total of 0.3 seconds of lag.

[0237] Assume that from t 94 At the beginning of the moment, the electronic equipment continued to run at 6th gear for 25 seconds under scene 90 until t 95 At that moment, there was a 0.2s freeze. According to the above gear exploration rules, the electronic device will save the gear exploration progress of scene 90 at gear 6, record the running time of 25s and the freeze time of 0.2s when running at gear 6 under scene 90, and add 1 to the number of explorations with freezes at gear 6. At this time, the total number of explorations with freezes at gear 6 is 3. In addition, the electronic device will raise the gear to gear 7 to continue the exploration.

[0238] like Fig. 9 As shown in (F), at t 95 At this time, the data area corresponding to the 6th level of the original data 9001 has stored the duration information (35,0.3), which means that up to t 95 At this moment, the total time that the electronic device runs at gear 6 under scene 90 is 60 seconds, and the total freeze is 0.5 seconds. In addition, the data area corresponding to gear 6 in the original data 9001 also stores the total number of explorations in which the electronic device freezes when exploring at gear 6, which is 3 times.

[0239] From 95 Starting from time t, after running for 30 seconds, it reaches t 96 At this moment, if the electronic device does not freeze during the entire operation, according to the above gear exploration rules, the electronic device will save the current gear exploration progress 7 gears, and record the total running time 120s and freeze time 0s corresponding to the exploration process of gear 7. In addition, the electronic device will obtain a random number in the interval [0,1] based on the random number function random(), and obtain the number of explorations n (n is equal to 3 at this time) of the next gear 6 that freezes. If the above random number is less than or equal to 1 / 2 n , the electronic device will adjust the gear to 6th gear; otherwise, the electronic device will continue to operate at the current gear 7th gear.

[0240] Here we assume that when n=3, the random number obtained by the electronic device is greater than 1 / 2 n, the electronic device will keep the gear at the current gear 7 and continue exploring. 96 time( Fig. 9 (not shown), at this time, the data area corresponding to the 7th level of the original data 9001 stores the time length information (120,0), and the data area corresponding to the 6th level stores the time length information (35,0.3), which means that as of t 96 At this moment, the electronic device ran for a total of 120 seconds at level 7 under scene 90, with a total of 0 seconds of lag; the total running time at level 7 was 35 seconds, with a total of 0.3 seconds of lag.

[0241] In the subsequent gear exploration process, for any gear, if the electronic device runs in the gear for 30 seconds without freezing, the electronic device will determine whether to lower the gear by one gear based on the random number function random() and the number of explorations of freezing in the next gear, until valid data of scene90 is successfully obtained. Similarly, for other non-valid secondary scenes, the electronic device can also complete the gear exploration process for the non-valid secondary scene according to the above gear exploration rules, which will not be described one by one here.

[0242] In some embodiments of the present application, main-secondary scene scene 90 can be referred to as the "first main-secondary scene", the maximum CPU supply power corresponding to power level 6 can be referred to as the "first power", and the maximum CPU supply power corresponding to power level 7 can be referred to as the "third power".

[0243] 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 general. Therefore, in some embodiments, in the above-mentioned statistical stage, for any valid main secondary scene, after determining the optimal power gear of the main secondary scene based on the valid data of the valid main secondary scene, 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, which may include the running time and the freeze time of the electronic device under the last adjustment gear. Finally, the electronic device can update the valid data corresponding to the main secondary scene based on the obtained feedback data, so that the optimal power gear obtained according to the valid data can still be applicable to the current main secondary scene when the application APP is constantly updated. Fig.10 The updating process of valid data in the statistical phase is shown as an example.

[0244] like Fig.10 As shown, in Fig.10 In the example, the original data table 10A may include multiple valid data, wherein 10A1 is valid data of the valid primary secondary scene 10 collected by the electronic device.

[0245] After the electronic device acquires the valid data 10A1 of the valid primary secondary scene 10, when the electronic device is in the scene 10 again, the electronic device can determine the optimal power level PL1 of the scene 10 based on the valid data 10A1. x .

[0246] Here it is assumed that the power level is PL1 x The next higher power level is PL1 (x+1) , and power level PL1 x The next lower power level is PL1 (x-1) In the embodiment of the present application, the electronic device can obtain a random number falling 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 within the sub-interval [96, 100], the power level PL1 to be adjusted will be 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 are 5%, 90%, and 5% respectively.

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

[0248] It is understandable that when the electronic device operates 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 10A can be continuously updated. (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.

[0249] 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 the effective data of the main and secondary scenes determine the optimal power level of the main and secondary scenes, the electronic device may adjust the last adjustment level 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 at 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, assuming that the optimal power gear for scene 10 is currently determined to be gear 7 based on valid data, and the focus application corresponding to scene 10 has been updated, the actual optimal power gear for scene 10 is gear 7, but the electronic device finally adjusts the last gear to PL1 based on the above method. yDetermined as level 6. In this case, although the electronic device may freeze more frequently when running at power level 6 in scene 10, 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 in the effective data increases, which reflects that power level 6 is less suitable for the current main-secondary scene 10 than before. This reflection is accurate and reliable for the current scene 10. 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-secondary scene, the feedback data obtained in the subsequent process is true and objective. After the corresponding effective data is updated using the feedback data, the optimal power level determined by the electronic device using the updated effective data is still accurate and reliable.

[0250] In some embodiments of the present application, the main secondary scene scene 10 can be referred to as the "first main secondary scene", and the power level PL1 (x-1) The corresponding maximum power that the CPU can supply can be called the "fourth power", power level PL1 x The corresponding maximum power that the CPU can supply can be called the "first power", power level PL1 (x+1) The corresponding maximum supplyable power of the CPU may be referred to as the “fifth power”.

[0251] 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 the electronic device, the electronic device may not only need to meet the focus performance requirements, but also the performance requirements of the background applications. In some cases, the performance requirements of the background applications for the electronic device are even higher than the corresponding performance requirements of the focus applications.

[0252] Combined with the above description, it can be known that when the electronic device is in the secondary scene, the electronic device can be in a main secondary scene and multiple auxiliary secondary scenes. In the same secondary scene, the auxiliary secondary scene parameters of any auxiliary secondary scene are different from the main secondary scene parameters of the main secondary scene in only three parameters: application, application window size, and application memory usage, and the rest of the parameters are the same. And the focus application and the background application can be converted to each other before, so the auxiliary secondary scene parameters of an auxiliary secondary scene may be exactly the same as the main secondary scene parameters of a main secondary scene. On this basis, assuming that the electronic device is currently in the secondary scene scene_x, the main secondary scene contained in scene_x is scene_primary1, and an auxiliary secondary scene contained in scene_x is scene_secondary1. It can be understood that the background application corresponding to the auxiliary secondary scene scene_secondary may be the focus application in the previous operation of the electronic device, so the electronic device may have been in a main secondary scene scene_primary2, and its main secondary scene parameters are exactly the same as the auxiliary secondary scene parameters of the auxiliary secondary scene whose auxiliary secondary scene is scene_secondary. When the main secondary scene scene_primary2 is a valid main secondary scene, the electronic device can further determine the optimal power gear of scene_primary2 based on the valid data of the main secondary scene scene_primary2, and use the optimal power gear as the optimal power gear of the auxiliary secondary scene scene_secondary1.

[0253] Therefore, in some embodiments, after the electronic device enters the statistical stage, when the electronic device is in the secondary scene, if the main secondary scene in which the electronic device is located is a valid main secondary scene, the electronic device can determine an optimal power gear corresponding to the main secondary scene based on the valid data of the valid main secondary scene. In addition, the electronic device will also obtain the M background applications that consume the most CPU performance in the background applications, and the optimal power gears of the M auxiliary secondary scenes corresponding to the M background applications. It should be noted that there may be only N (0≤N≤M) valid main secondary scenes in the M main secondary scenes with the same auxiliary secondary scene parameters as the above-mentioned M auxiliary secondary scenes. In this case, the electronic device can only obtain the valid data of the N valid main secondary scenes, and determine the optimal power gears of the N auxiliary secondary scenes corresponding to the above-mentioned M auxiliary secondary scenes based on the N valid data. Finally, the electronic device will compare the N optimal power gears of the N auxiliary secondary scenes and the 1 optimal power gear of the main secondary scene, and determine the largest power gear among these optimal power gears as the optimal power gear of the above-mentioned secondary scene. In this way, the electronic device can further meet the performance requirements of the background application while meeting the performance requirements of the focus application.

[0254] Fig.11 The diagram shows a process in which the electronic device determines the optimal power gear based on both the effective primary secondary scenario and multiple auxiliary secondary scenarios during the statistical phase.

[0255] It is assumed here that the value of M is 3, and at this time in the electronic device, the focus application corresponds to number 1, and the three background applications that consume the most CPU performance among the background applications correspond to numbers 2, 3, and 4 respectively.

[0256] Scene 11 is the main secondary scene currently running on the electronic device, and scene 12', scene 13' and scene 14' are three auxiliary secondary scenes currently running on the electronic device.

[0257] For the currently running main secondary scene scene 11, the electronic device can collect the main secondary scene parameters of scene 11, as shown in data 1101 in the main secondary scene parameter table 110. Similarly, for the currently running three auxiliary secondary scenes scene 12', scene 13' and scene 14', the electronic device can also collect the auxiliary secondary scene parameters of these three auxiliary secondary scenes, as shown in data 1112, data 1113 and data 1114 in the auxiliary secondary scene parameter table 111.

[0258] The original data table 112 records the original data obtained after the electronic device performs gear exploration in the main secondary scenes scene 11, scene 12, scene 13 and scene 14. Among them, the gear exploration process of the main secondary scenes scene 11, scene 12 and scene 13 has been completed (the total running time reaches 600s), so the original data 1120, original data 1121 and original data 1123 corresponding to the main secondary scenes scene 11, scene 12 and scene 13 in the original data table 112 are all valid data. It should be noted that the scene parameters of the main secondary scene scene 11 recorded in the original data table 112 are the same as the main secondary scene parameters recorded in scene 11 in the main secondary scene parameter table 110, and the main secondary scene parameters recorded in the main secondary scenes scene 12, scene 13 and scene 14 recorded in the original data table 112 are the same as the auxiliary secondary scene parameters recorded in data 1111, data 1112 and data 1113 in the auxiliary secondary scene parameter table 111.

[0259] Here, it is assumed that the proportion of the freezing duration corresponding to the gear is less than or equal to 0.03, which means that the user experience will not be impaired. Combined with the above description, it can be seen that after obtaining the main secondary scene parameters of the main secondary scene scene 80, the electronic device can determine that the optimal power gear of scene 11 is PL11 (4 gears) based on the main secondary scene parameters of scene 11 and the original data 1121 in the original data table. Correspondingly, the electronic device can determine that the optimal power gear of the auxiliary secondary scene scene 12' is PL12 (5 gears) based on the auxiliary secondary scene parameters of scene 12' and the original data 1122, and determine that the optimal power gear of the auxiliary secondary scene scene 13' is PL13 (4 gears) based on the auxiliary secondary scene parameters of scene 13' and the original data 1122. For the auxiliary secondary scene scene 14', since its corresponding main secondary scene in the original data table 112 is scene 14, which is a non-valid secondary scene, the electronic device cannot obtain the corresponding valid data to determine the optimal frequency gear for it, so the electronic device can ignore the auxiliary secondary scene scene 14'.

[0260] After obtaining the optimal power levels freqPL11, freqPL12 and freqPL13 for the above three scenarios, the electronic device can determine the largest power level (i.e. level 5) among the three optimal power levels as the optimal power level under the current secondary scenario, and adjust the maximum power level that the CPU can supply to this level.

[0261] In the subsequent operation process, the electronic device can periodically detect the M background applications with the largest performance consumption among 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). In the case where the main secondary scene and / or the M auxiliary secondary scenes start to change, the electronic device can re-determine the optimal power gear of the new secondary scene based on the aforementioned related operations, and adjust the gear of the maximum power that the CPU can supply to the optimal power gear of the new secondary scene. Optionally, the duration of the above cycle can be set to 30s, or to other durations, which is not limited in this application.

[0262] Fig.12 It is shown that the embodiment of the present application provides a system architecture, which can be used to perform gear exploration for any primary and secondary scenes and save the information collected during the gear exploration process, and adjust the maximum power gear that can be supplied by the CPU to the optimal power gear of the valid primary and secondary scenes based on the valid data of the valid primary and secondary scenes. Fig.12 As shown, the electronic device 100 may be the electronic device provided by the present application in the foregoing description.

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

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

[0265] The data processing module 1002 is used to pre-process all valid data collected by the data collection module 1001. For example, the running time and the freezing time corresponding to each gear in the valid data are converted into the freezing time ratio of the gear.

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

[0267] The execution module 1004 can obtain the valid data of the currently running main and secondary scenes stored in the data storage module 1003, and determine the most effective power gear of the main and secondary scenes according to the valid data. Specifically, after obtaining the valid data of the above-mentioned main and secondary scenes, the calculation module 1005 in the execution module 1004 can query the corresponding lag time ratio of each gear from high to low starting from the highest power gear of the valid data, and take the lowest power gear with a lag time ratio less than or equal to a certain threshold (for example, 0.03) as the optimal power gear, and send the optimal power gear to the CPU performance adjustment module 1007.

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

[0269] In addition, when the user operates through the interface provided by the I / O interface 1006, 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 1006 can send the corresponding instruction or information to the CPU performance adjustment module 1007, and the CPU performance adjustment module 1007 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 1007 can exist in the electronic device 100 in the form of program code, and it can include a storage address, which is used to record the gear value of the current maximum power that can be supplied by the CPU of the electronic device. When the CPU performance adjustment module 1007 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 1007 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.

[0270] Optionally, the CPU performance adjustment module 1007 may also receive a control instruction issued by the charging module 1008, 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 1007 may no longer use the optimal power gear issued by the calculation module 1005 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, and the CPU performance adjustment module 1007 can 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 1007 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, so as to ensure the balance between the performance and power consumption of the electronic device 100.

[0271] Understandably, Fig.12 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.12 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.

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

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

[0274] Fig.13 The structure of the electronic device is exemplarily shown.

[0275] The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a button 190, an indicator 192, a camera 193, a display screen 194, etc.

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

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

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

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

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

[0281] The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140, and supplies power to the processor 110, the internal memory 121, the display screen 194, the camera 193, and the wireless communication module 160. The power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle number, battery health status (leakage, impedance), etc. In some other embodiments, the power management module 141 can also be set in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 can also be set in the same device.

[0282] The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.

[0283] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.

[0284] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to the electronic device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.

[0285] The modem processor may include a modulator and a demodulator. Among them, the modulator is used to modulate the low-frequency baseband signal to be sent into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After the low-frequency baseband signal is processed by the baseband processor, it is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to a speaker 170A, a receiver 170B, etc.), or displays an image or video through a display screen 194. In some embodiments, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 110 and be set in the same device as the mobile communication module 150 or other functional modules.

[0286] The wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to the electronic device 100. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates the electromagnetic wave signal and filters it, and sends the processed signal to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate the frequency, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.

[0287] The electronic device 100 implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.

[0288] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.

[0289] The camera 193 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then passes the electrical signal to the ISP to be converted into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In some embodiments, the electronic device 100 may include 1 or N cameras 193, where N is a positive integer greater than 1.

[0290] NPU is a neural network (NN) computing processor. By drawing on the structure of biological neural networks, such as the transmission mode between neurons in the human brain, it can quickly process input information and can also continuously self-learn. Through NPU, applications such as intelligent cognition of electronic device 100 can be realized, such as image recognition, face recognition, voice recognition, text understanding, etc.

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

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

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

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

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

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

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

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

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

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

[0301] The processor 110 is used to collect valid data of the main secondary scene in the main secondary scene, and determine the optimal power gear of the main secondary scene according to the collected valid data. The specific operation can refer to the above Figure 3 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 .

[0302] 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 first message to the processor 110, and the first information is used to notify the processor 110 that the electronic device 100 is currently in a charging state, so that the processor 110 maintains the maximum supplyable power level at the maximum power level.

[0303] 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 level that needs to be adjusted for the maximum power that the processor 110 can supply according to the operating scenario category. Figure 4 as well as Figure 6 Related instructions.

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

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

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

[0307] 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: include: Acquire valid data of a first primary and secondary scenario, where the first primary and secondary scenario includes a scenario related to a focus application when the electronic device does not detect an interaction event, and the valid data includes an operating time and a freeze time of the electronic device running at a maximum power supply of multiple different CPUs in the first primary and secondary scenario; Determine the minimum CPU maximum supply power for which the percentage of freeze duration in the valid data of the first primary and secondary scenarios is less than a first threshold as the optimal power for the first primary and secondary scenarios, where the percentage of freeze duration is a ratio of freeze duration to running duration; The maximum power supplied by the CPU of the electronic device is adjusted according to the optimal power of the first primary-secondary scenario.

2. The method according to claim 1, characterized in that The obtaining of valid data of the first primary and secondary scenes 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, where the second power is a power among the maximum supply powers of the multiple different central processing units CPUs that is less than the first power and has the smallest difference with 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 running at the first power and the second power respectively in the first main-secondary scene.

3. The method according to claim 1, characterized in that The obtaining of valid data of the first primary and secondary scenes 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 does not reach the first duration and a freeze occurs, the maximum CPU supply power is adjusted to a third power, wherein the third power is a power among the maximum supply powers of the multiple different central processing units CPUs that is greater than the first power and has the smallest difference with the first power, and the valid data of the first main-secondary scenario include the operating duration and the freeze duration respectively running at the first power and the third power in the first main-secondary scenario.

4. The method according to claim 1, characterized in that: The obtaining of valid data of the first primary and secondary scenes 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 does not reach the first duration and no freeze occurs, entering the second scene is detected, and the exploration progress of the first primary and secondary scenes is saved as the first power; When it is detected that the first main-secondary scene is entered again, the maximum power that the CPU can supply is adjusted to the power corresponding to the exploration progress of the first main-secondary scene. The valid data of the first main-secondary scene includes the operating time and the lag time at the first power in the first main-secondary scene.

5. The method according to claim 4, characterized in that After detecting entering the second scene, the method further includes: When the second scene is a second main-secondary scene, adjusting the maximum power that can be supplied by the CPU to the power corresponding to the exploration progress of the second scene, the second main-secondary scene includes a scene related to the focus application when the electronic device does not detect an interaction event, and the second main-secondary scene is different from the first main-secondary scene; When the second scenario is a level one scenario, the maximum power that can be supplied by the CPU is adjusted to the maximum power, and the level one scenario includes an operation scenario in which the electronic device detects an interactive event.

6. The method according to claim 1, characterized in that The obtaining of valid data of the first primary and secondary scenes 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 does not reach the first duration and no freeze occurs, detecting that the operating scene changes from the first primary-secondary scene to the third scene; If the exploration progress of the first main-secondary scene saved last time is the first power, the number of explorations of the first power in the first main-secondary scene is increased by 1, and the exploration progress of the first main-secondary scene is saved as the first power; if the exploration progress of the first main-secondary scene saved last time is not the first power, the number of explorations of the first power in the first main-secondary scene is set to 1, and the exploration progress of the first main-secondary scene is saved as the first power; the exploration progress represents the maximum power that can be supplied by the CPU last used by the electronic device in the main-secondary scene; It is detected that the operating scenario has changed to the first main-secondary scenario, and when the number of explorations of the power corresponding to the exploration progress of the first main-secondary scenario is less than or equal to the second threshold, the maximum power that can be supplied by the CPU is adjusted to the power corresponding to the exploration progress of the first main-secondary scenario; when the number of explorations of the power corresponding to the exploration progress of the first main-secondary scenario is greater than the second threshold, the maximum power that can be supplied by the CPU is adjusted to the second power, and the second power is the power among the multiple different maximum power that can be supplied by the CPU that is less than the power corresponding to the exploration progress and has the smallest difference with the power corresponding to the exploration progress. The valid data of the first main-secondary scenario include the operating time and the freeze time of running at the first power and the second power respectively in the first main-secondary scenario.

7. The method according to claim 1, characterized in that The obtaining of valid data of the first primary and secondary scenes 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 does not reach the first duration and a freeze occurs, the number of freezes corresponding to the first power is increased by 1, and the maximum supply power of the CPU is adjusted to a third power, wherein the number of freezes represents the number of freezes occurring in all the times of operation using the maximum supply power of a CPU, and the third power is the maximum supply power of the multiple different central processing units CPUs, which is greater than the first power and has the smallest difference with the first power; When the duration of operation at the third power reaches the first duration and no lag occurs, the maximum supplyable power of the CPU is determined to be adjusted to the first power or maintained at the third power according to the number of lags corresponding to the first power; wherein, the more the number of lags corresponding to the first power, the smaller the probability of adjusting the maximum supplyable power of the CPU to the first power, and the valid data of the first main-secondary scenario include the operation duration and lag duration of running at the first power and the third power respectively in the first main-secondary scenario.

8. The method according to any one of claims 1 to 7, 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.

9. The method according to any one of claims 1 to 8, characterized in that: The first duration is 30 seconds, and / or the second duration is 600 seconds.

10. The method according to any one of claims 1 to 9, characterized in that: The step of adjusting the maximum power supplied by the CPU of the electronic device according to the optimal power of the first primary and secondary scenarios includes: 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 a target power, the target power being the maximum supply power of the CPU among the optimal power, the fourth power and the fifth power, the fourth power being less than the optimal power, the fifth power being greater than the optimal power, the fourth power and the fifth power belonging 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 third threshold.

11. The method according to any one of claims 1 to 10, characterized in that: After adjusting the maximum supply power of the CPU of the electronic device according to the optimal power of the first primary and secondary scenarios, 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; Update the valid data of the first primary-secondary scene according to the feedback data.

12. 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 11.

13. 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-11.

14. 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 11.