Control method and electronic equipment

By monitoring the CPU usage of the backend application and limiting its CPU resource usage when the threshold is reached, the device lag and heating problems caused by excessive CPU resources occupied by the backend application is solved, and the device performance and user experience are improved.

CN119440790APending Publication Date: 2025-02-14HUAWEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310970759.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-08-02
Publication Date
2025-02-14

AI Technical Summary

Technical Problem

Background applications occupy a large amount of CPU resources during runtime, resulting in device stuttering and fast heating, affecting the scheduling and user experience of front-end applications.

Method used

By monitoring the CPU usage of the backend application, if the occupancy data is greater than or equal to the set threshold, reduce the CPU resources used by the backend application and/or reduce the time it uses CPU resources, such as limiting the use of small core CPUs or adding them to the limit Group.

Benefits of technology

It effectively reduces the use of CPU resources by backend applications, releases more CPU resources for frontend applications, reduces device lag and heating problems, and improves device performance and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119440790A_ABST
    Figure CN119440790A_ABST
Patent Text Reader

Abstract

The invention provides a control method and electronic equipment. The method comprises the following steps: determining that a first application is in a background running state; determining first load data, wherein the first load data is used for indicating CPU (Central Processing Unit) occupation information of the first application; if it is determined that the first load data is larger than or equal to a set first threshold value, CPU resources used by the first application are reduced and / or the time for the first application to use the CPU resources is shortened; wherein the first threshold value is associated with the first application. By means of the method, the problems of equipment jamming and fast heating caused by the fact that a large number of CPU resources are occupied when background applications run can be relieved or avoided, and then the equipment performance is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of electronic equipment, and in particular to a control method and electronic equipment. Background Art

[0002] Some background applications in electronic devices running without regard to the foreground user experience may forcibly occupy the central processing unit (CPU) load of the electronic device, resulting in some foreground schedulable threads being unable to be scheduled, which in turn causes problems such as the entire device freezing and heating.

[0003] For the above problems, the CPU computing power can be increased by increasing the maximum frequency of CPU operation, thereby alleviating the lag problem. However, the increase in CPU frequency will increase the loss related to CPU power consumption, affect the battery life of the whole machine, and accelerate the heating of the device in high-load scenarios. Therefore, the processing effect of this solution is poor. Summary of the invention

[0004] The present application provides a control method and an electronic device for solving the problem of device freezing and rapid heating caused by a large amount of CPU resources occupied when background applications are running, thereby improving device performance.

[0005] In a first aspect, an embodiment of the present application provides a control method, which is applied to an electronic device, and the method includes: determining that a first application is in a background running state; determining first load data, wherein the first load data is used to indicate the central processing unit CPU occupancy information of the first application; if it is determined that the first load data is greater than or equal to a set first threshold, reducing the CPU resources used by the first application and / or reducing the time the first application uses the CPU resources; wherein the first threshold is associated with the first application.

[0006] In this method, when the electronic device determines that the first application is in the background running state, if it is determined that the first load data corresponding to the first application is greater than or equal to the set first threshold value, it means that the first application occupies a high degree of CPU when running in the background. Therefore, by reducing the CPU resources used by the first application and / or reducing the time the first application uses CPU resources, the degree of CPU resource occupancy by the first application can be reduced, and then more CPU resources can be given to the foreground application to use, providing more sufficient and efficient CPU resource support for the foreground application, thereby alleviating or avoiding problems such as foreground application jamming and rapid heating of the device. When the background running application occupies the CPU seriously, the electronic device can limit the CPU occupancy of the background running application according to this method, thereby alleviating or avoiding the problem of device jamming and rapid heating caused by the large amount of CPU resources occupied by the background application when it is running, thereby improving device performance.

[0007] In one possible design, reducing the computing power CPU resources used by the first application includes: allowing the first application to use a small-core CPU, and prohibiting the first application from using a large-core CPU or a medium-core CPU; or, adding the first application to an application background BG group; reducing the time the first application uses CPU resources includes: reducing the number of time slices allocated to the first application; or, adding the first application to a restricted group.

[0008] In this method, by limiting the use of small-core CPUs by background applications, or limiting background applications to BG groups, the better-performing medium-core and large-core CPUs can be given to foreground applications, thereby more effectively alleviating or avoiding the problem of foreground application running lags. By reducing the time that background applications use CPU resources, or limiting the background to restricted groups, more CPU usage time can be given to foreground applications, thereby more effectively alleviating or avoiding the problem of foreground application running lags.

[0009] In one possible design, the first load data is the occupancy rate of the CPU computing power occupied by the first application to the total CPU computing power in a first time period.

[0010] In this method, the occupancy rate of the CPU computing power occupied by the application in a certain period of time to the total CPU computing power can more accurately reflect the occupancy of the CPU resources by the application, and then the occupancy of the CPU resources by the application can be controlled based on the data.

[0011] In one possible design, determining the first load data includes: obtaining first computing power data, the first computing power data is used to indicate the CPU computing power occupied by the first application at a first time; wherein the first time is the start time of the first time period; obtaining second computing power data, the second computing power data is used to indicate the CPU computing power occupied by the first application at a second time; wherein the second time is the end time of the first time period; obtaining third computing power data, the third computing power data is used to indicate the total CPU computing power of the electronic device in the time period between the first time and the second time; obtaining the CPU computing power occupied by the first application in the first time period according to the first computing power data and the second computing power data; obtaining the first load data according to the CPU computing power occupied by the first application in the first time period and the third computing power data.

[0012] In this method, the CPU computing power of the first application calculated based on the start time and end time of the first time period can more accurately determine the CPU computing power occupied by the first application in the first time period. According to the CPU computing power occupied by the first application in the first time period and the total CPU computing power, the first load data can be determined more accurately.

[0013] In a possible design, obtaining the first computing power data includes: calculating the first computing power data according to the following formula at the first time:

[0014]

[0015] Among them, data1 is the first computing power data, ∑ is the summation symbol, t is the number of applications, and n is the number of CPU cores of the electronic device; dmips[j] is a CPU computing power ratio parameter used to indicate the number of operation instructions processed by the j-th CPU core of the electronic device per second; m is the number of frequencies at which the CPU of the electronic device can run, frequency[k] is the k-th frequency; runtime[k] is the running time of the CPU core at the k-th frequency.

[0016] In this method, dmips[j]*frequency[k]*runtime[k] represents the computing power of the first application at the kth frequency point of the jth CPU core. Based on this method, the computing power of the first application at each frequency point of each CPU core can be calculated. By summing the computing power of the first application at each frequency point of each CPU core, the computing power of the first application on the CPU can be accurately obtained. Therefore, this method has high accuracy.

[0017] In a possible design, obtaining the third computing power data includes: calculating the third computing power data according to the following formula:

[0018]

[0019] Among them, the data3 is the third computing power data, the ∑ is the summation symbol, the value of n is the number of CPU cores of the electronic device; the dmips[j] is a CPU computing power ratio parameter used to indicate the number of operation instructions processed by the j-th CPU core of the electronic device per second; the maxfrequency[j] represents the maximum frequency of the j-th CPU core, the T2 is the second time, the T1 is the first time, and the second time is later than the first time.

[0020] In this method, dmips[j]*maxfrequency[j]*(T2-T1) represents the computing power of the jth CPU core in the first time period. Based on this method, the computing power of each CPU core in the first time period can be calculated. By summing the computing power of each CPU core in the first time period, the total CPU computing power in the first time period can be obtained. This method has high accuracy.

[0021] In a possible design, before determining the first load data, the method further includes: determining that the first application belongs to a set application.

[0022] Based on this method, load data can be determined for the set application and subsequent CPU resource limitation and other processing can be performed. Therefore, by setting the set application, the application that needs to perform the above processing can be flexibly controlled, which is highly practical.

[0023] In a possible design, the electronic device includes a first control unit, a second control unit and a monitoring unit; wherein the monitoring unit is in the kernel layer of the electronic device; the determining that the first application is in the background running state includes: determining that the first application is in the background running state through the first control unit; the determining the first load data includes: obtaining the computing power data of the first application through the monitoring unit, and sending the computing power data of the first application to the second control unit; determining the first load data according to the computing power data of the first application through the second control unit; determining that the first load data is greater than or equal to the set first threshold includes: sending the first load data to the first control unit through the second control unit; determining that the first load data is greater than or equal to the first threshold through the first control unit; reducing the CPU resources used by the first application and / or reducing the time the first application uses the CPU resources includes: controlling the first control unit to reduce the CPU resources used by the first application and / or reducing the time the first application uses the CPU resources. Based on this method, the electronic device can complete the control method provided by the present application through different functional services. Among them, the monitoring unit in the kernel layer can efficiently realize the collection of computing power data, which helps to improve the overall processing efficiency.

[0024] In a possible design, the first control unit is located in the application framework layer of the electronic device, and the second control unit is a system component of the electronic device.

[0025] In this method, the first control unit is located at the application framework layer, which facilitates the control processing of the application such as CPU resource limitation. Through the system components, the communication of functional services at different levels can be efficiently realized. Therefore, this method helps to improve the overall processing efficiency.

[0026] In a possible design, before sending the first load data to the first control unit through the second control unit, the method further includes: determining, through the second control unit, that the first load data is greater than or equal to a set second threshold.

[0027] In this method, the second control unit determines that the load data is reported when it is greater than a certain threshold, and can preliminarily screen out some applications with high CPU occupancy for reporting, thereby further improving the pertinence of application control and improving processing efficiency.

[0028] In a possible design, before determining that the first application is in the background running state, or before determining the first load data, the method further includes: determining a start time of a set time period.

[0029] In this method, by periodically executing the control method, control processing can be continuously combined with actual scenarios, and adjustments can be made easily, which can improve the practicality of the solution.

[0030] In one possible design, the method also includes: determining that the second application is in a background running state; determining second load data, wherein the second load data is used to indicate the CPU occupancy information of the second application; if it is determined that the second load data is greater than or equal to a set second threshold, reducing the CPU resources used by the second application and / or reducing the time the second application uses CPU resources; wherein the second threshold is associated with the second application, and the second threshold is different from the first threshold.

[0031] In this method, different applications have different corresponding conditions for limiting CPU resources, which makes it easy to perform different controls on different applications, and has high flexibility and practicality.

[0032] In a second aspect, the present application provides an electronic device, comprising a memory and one or more processors; wherein the memory is used to store computer program code, and the computer program code comprises computer instructions; when the computer instructions are executed by one or more processors, the electronic device executes the method described in the above-mentioned first aspect or any possible design of the first aspect.

[0033] In a third aspect, the present application provides a computer-readable storage medium storing a computer program. When the computer program runs on an electronic device, the electronic device executes the method described in the first aspect or any possible design of the first aspect.

[0034] In a fourth aspect, the present application provides a computer program product, which includes a computer program or instructions. When the computer program or instructions are run on an electronic device, the electronic device executes the method described in the first aspect or any possible design of the first aspect.

[0035] For the beneficial effects of the second to fourth aspects, please refer to the description of the beneficial effects of the first aspect, which will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] Figure 1 A schematic diagram of the hardware architecture of an electronic device provided in an embodiment of the present application;

[0037] Figure 2 A schematic diagram of a software architecture of an electronic device provided in an embodiment of the present application;

[0038] Figure 3 A schematic diagram of the architecture of a control system provided in an embodiment of the present application;

[0039] Figure 4 A flow chart of a control method provided in an embodiment of the present application;

[0040] Figure 5 A schematic diagram of CPU core occupancy before CPU suppression provided in an embodiment of the present application;

[0041] Figure 6 A schematic diagram of CPU core occupancy after CPU suppression provided in an embodiment of the present application;

[0042] Figure 7 A schematic diagram of a control method provided in an embodiment of the present application;

[0043] Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0044] In order to make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the embodiments of the present application will be further described in detail below with reference to the accompanying drawings.

[0045] In the description of the embodiments of the present application, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features.

[0046] To facilitate understanding, exemplary descriptions of concepts related to the present application are provided for reference.

[0047] 1) Electronic devices, which can be devices with processing functions. In some embodiments of the present application, the electronic devices can be portable devices, such as mobile phones, tablet computers, wearable devices with wireless communication functions (e.g., watches, bracelets, helmets, headphones, etc.), vehicle-mounted terminal devices, augmented reality (AR) / virtual reality (VR) devices, laptops, ultra-mobile personal computers (UMPC), netbooks, personal digital assistants (PDA), smart home devices (e.g., smart TVs, smart speakers, etc.), smart robots, workshop equipment, wireless terminals in self-driving, wireless terminals in remote medical surgery, wireless terminals in smart grids, wireless terminals in transportation safety, wireless terminals in smart cities, or wireless terminals in smart homes, flying devices (e.g., smart robots, hot air balloons, drones, airplanes), etc.

[0048] Among them, a wearable device is a portable device that a user can wear directly on the body or integrate into the user's clothes or accessories.

[0049] In some embodiments of the present application, the electronic device may also be a portable terminal device that also includes other functions such as a personal digital assistant and / or a music player. Exemplary embodiments of the portable terminal device include but are not limited to: Or a portable terminal device with other operating systems. The portable terminal device may also be other portable terminal devices, such as a laptop computer with a touch-sensitive surface (e.g., a touch panel). It should also be understood that in some other embodiments of the present application, the electronic device may not be a portable terminal device, but a desktop computer with a touch-sensitive surface (e.g., a touch panel).

[0050] 2) A multi-core processor (central processing unit, CPU) is a processor that integrates multiple complete computing engines (i.e. cores). The cores in a CPU can be referred to as cores. Cores can be divided into different types according to their processing capabilities, such as large cores, medium cores, and small cores.

[0051] 3) Time slice, that is, the time allocated by the CPU to each thread (or process). The time period allocated to each thread can be called a time slice of the thread, that is, the time the thread is allowed to run.

[0052] 4) DMIPS (Dhrystone million instructions per second) is one of the indicators to measure the performance of a computer system, which can represent one millionth of the number of instructions that can be executed per second. For example, 2DMIPS (or 2dmips) can represent two million instructions per second.

[0053] It should be understood that in the embodiments of the present application, "at least one" refers to one or more, and "plurality" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the associated objects before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can represent: a, b, c, a and b, a and c, b and c, or a, b and c, where a, b, c can be single or multiple.

[0054] In order to solve the problem that a large amount of CPU resources are occupied by background applications when running, resulting in limited schedulable resources of foreground applications, thereby causing device freezes, and in order to improve the performance of the entire machine and improve the user experience, the embodiment of the present application provides a control method and an electronic device. This solution can provide more efficient and sufficient CPU computing power support for the foreground and its related applications by limiting the CPU resources used by background applications and / or limiting the time for background applications to use CPU resources, thereby ensuring the smooth operation of foreground applications, reducing or avoiding problems such as device freezes and rapid heating, and improving the foreground user experience.

[0055] The technical solution provided in the embodiments of the present application can be executed by any computing device with processing and computing capabilities, and the computing device can be an electronic device, etc. The introduction of the electronic device can refer to the description in the above concept description or the description in the device structure description below. In the embodiments below, the application of the technical solution of the present application in an electronic device is used as an example for description, and the implementation process of the application in other computing devices is similar and will not be repeated.

[0056] See below Figure 1 , the structure of the electronic device to which the method provided in the embodiments of the present application is applicable is introduced.

[0057] like Figure 1 As shown, the electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a USB interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a SIM card interface 195, etc.

[0058] The sensor module 180 may include a gyroscope sensor, an acceleration sensor, a proximity light sensor, a fingerprint sensor, a touch sensor, a temperature sensor, a pressure sensor, a distance sensor, a magnetic sensor, an ambient light sensor, an air pressure sensor, a bone conduction sensor, and the like.

[0059] Understandably, Figure 1 The electronic device 100 shown is merely an example and does not constitute a limitation on the electronic device, and the electronic device may have more or fewer components than those shown in the figure, may combine two or more components, or may have a different component configuration. Figure 1 The various components shown in the EMBODIMENTS 2000 may be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing and / or application specific integrated circuits.

[0060] The processor 110 may include one or more processing units, for example: the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), a controller, a memory, a video codec, a digital signal processor (digital signal processor, DSP), a baseband processor, and / or a neural-network processing unit (neural-network processing unit, NPU), etc. Among them, different processing units can be independent devices or integrated in one or more processors. Among them, the controller can be the nerve center and command center of the electronic device 100. The controller can generate an operation control signal according to the instruction opcode and the timing signal to complete the control of fetching and executing instructions.

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

[0062] The execution of the control method provided in the embodiment of the present application can be controlled by the processor 110 or completed by calling other components, such as calling the processing program of the embodiment of the present application stored in the internal memory 121, or calling the processing program of the embodiment of the present application stored in a third-party device through the external memory interface 120, to control the wireless communication module 160 to communicate data with other devices, improve the intelligence and convenience of the electronic device 100, and enhance the user experience. The processor 110 can include different devices. For example, when the CPU and GPU are integrated, the CPU and GPU can cooperate to execute the control method provided in the embodiment of the present application, such as part of the algorithm in the control method is executed by the CPU, and the other part of the algorithm is executed by the GPU to obtain faster processing efficiency.

[0063] 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. The display screen 194 can be used to display information input by a user or information provided to a user and various graphical user interfaces (GUIs). For example, the display screen 194 can display photos, videos, web pages, or files, etc.

[0064] In the embodiment of the present application, the display screen 194 may be an integrated flexible display screen, or a spliced ​​display screen consisting of two rigid screens and a flexible screen located between the two rigid screens.

[0065] The camera 193 (a front camera or a rear camera, or one camera can be used as both a front camera and a rear camera) is used to capture still images or videos. Generally, the camera 193 may include a photosensitive element such as a lens group and an image sensor, wherein the lens group includes a plurality of lenses (convex lenses or concave lenses) for collecting light signals reflected by the object to be photographed and transmitting the collected light signals to the image sensor. The image sensor generates an original image of the object to be photographed based on the light signal.

[0066] The internal memory 121 can be used to store computer executable program codes, which include instructions. The processor 110 executes various functional applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 121. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area may store codes of an operating system, an application program (such as functions corresponding to a control method, etc.), etc. The data storage area may store data created during the use of the electronic device 100, etc.

[0067] The internal memory 121 may also store one or more computer programs corresponding to the algorithm of the control method provided in the embodiment of the present application. The one or more computer programs are stored in the internal memory 121 and configured to be executed by one or more processors 110. The one or more computer programs include instructions, which may be used to execute the various steps in the following embodiments.

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

[0069] Of course, the code of the algorithm of the control method provided in the embodiment of the present application can also be stored in an external memory. In this case, the processor 110 can run the code of the algorithm of the control method stored in the external memory through the external memory interface 120.

[0070] The sensor module 180 may include a gyro sensor, an acceleration sensor, a proximity light sensor, a fingerprint sensor, a touch sensor, and the like.

[0071] The touch sensor is also called a "touch panel". The touch sensor can be arranged on the display screen 194, and the touch sensor and the display screen 194 form a touch display screen, also called a "touch screen". The touch sensor is used to detect touch operations acting on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194. In other embodiments, the touch sensor can also be arranged on the surface of the electronic device 100, which is different from the position of the display screen 194.

[0072] Exemplarily, the display screen 194 of the electronic device 100 may display a main interface, which includes icons of multiple applications (such as a camera application, etc.). For example, a user may click the icon of the camera application in the main interface through a touch sensor to trigger the processor 110 to start the camera application and turn on the camera 193. The display screen 194 displays an interface of the camera application, such as a viewfinder interface.

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

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

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

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

[0077] 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) and the like 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 frequency of the electromagnetic wave signal and performs filtering processing, 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 of the signal, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2. In the embodiment of the present application, the wireless communication module 160 is used to establish a connection with other electronic devices and exchange data. Or the wireless communication module 160 can be used to access the access point device, send control instructions to other electronic devices, or receive data sent from other electronic devices.

[0078] In addition, the electronic device 100 can implement audio functions through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone interface 170D, and the application processor. For example, music playback, recording, etc. The electronic device 100 can receive input from the key 190 and generate key signal input related to the user settings and function control of the electronic device 100. The electronic device 100 can use the motor 191 to generate a vibration prompt (such as an incoming call vibration prompt). The indicator 192 in the electronic device 100 can be an indicator light, which can be used to indicate the charging status, power changes, and can also be used to indicate messages, missed calls, notifications, etc. The SIM card interface 195 in the electronic device 100 is used to connect the SIM card. The SIM card can be inserted into the SIM card interface 195, or pulled out from the SIM card interface 195, to achieve contact and separation with the electronic device 100.

[0079] It should be understood that in practical applications, the electronic device 100 may include Figure 1 The embodiments of the present application are not limited to the more or fewer components shown. The illustrated electronic device 100 is only an example, and the electronic device 100 may have more or fewer components than those shown in the figure, may combine two or more components, or may have different component configurations. The various components shown in the figure may be implemented in hardware, software, or a combination of hardware and software including one or more signal processing and / or application specific integrated circuits.

[0080] The software system of the electronic device 100 may adopt a layered architecture, an event-driven architecture, a microkernel architecture, a microservice architecture, or a cloud architecture. The layered architecture divides the software into several layers, each with a clear role and division of labor. The layers communicate with each other through software interfaces. For example, Figure 2 As shown, the software architecture can be divided into four layers, from top to bottom, namely the application layer, the application framework layer (Framework, FWK), the runtime and system library, and the (Linux) kernel layer.

[0081] The application layer is the top layer of the operating system, including native applications of the operating system, such as camera, gallery, calendar, Bluetooth, music, video, information, etc., and may also include third-party applications. The application involved in the embodiment of the present application is referred to as application (APP), which is a software program that can implement one or more specific functions. Typically, multiple applications can be installed in an electronic device, such as camera applications, email applications, learning applications, etc. The applications mentioned below may be system applications installed when the electronic device leaves the factory, or they may be third-party applications downloaded from the Internet or obtained from other electronic devices by the user while using the electronic device.

[0082] Of course, for developers, developers can write applications and install them in this layer. In a possible implementation, applications can be developed using the Java language by calling the application programming interface (API) provided by the application framework layer. Developers can interact with the bottom layer of the operating system (such as the kernel layer) through the application framework to develop their own applications.

[0083] The application framework layer is the API and programming framework of the application layer. The application framework layer may include some predefined functions. The application framework layer may include a window manager, a content provider, a view system, a phone manager, a resource manager, a notification manager, etc.

[0084] The window manager is used to manage window programs. The window manager can obtain the display screen size, determine whether there is a status bar, lock the display screen (or screen), capture the display screen, etc.

[0085] Content providers are used to store and retrieve data and make these data accessible to applications. The data may include files (such as documents, videos, images, audio), text and other information.

[0086] The view system includes visual controls, such as controls for displaying text, images, documents, etc. The view system can be used to build applications. The interface in the display window can be composed of one or more views. For example, the display interface including the SMS notification icon can include a view for displaying text and a view for displaying images.

[0087] The phone manager is used to provide communication functions for electronic devices. The notification manager enables applications to display notification information in the status bar, which can be used to convey notification-type messages and can disappear automatically after a short stay without user interaction.

[0088] The runtime includes the core library and the virtual machine. The runtime is responsible for the scheduling and management of the system.

[0089] The core library of the system consists of two parts: one is the function that the Java language needs to call, and the other is the core library of the system. The application layer and the application framework layer run in the virtual machine. Taking Java as an example, the virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform object life cycle management, stack management, thread management, security and exception management, and garbage collection.

[0090] The system library can include multiple functional modules. For example: surface manager, media library, 3D graphics processing library (for example: OpenGL ES), 2D graphics engine (for example: SGL), image processing library, etc. The surface manager is used to manage the display subsystem and provide the fusion of 2D and 3D layers for multiple applications. The media library supports a variety of commonly used audio and video format playback and recording, as well as static image files, etc. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.564, MP3, AAC, AMR, JPG, PNG, etc. The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, synthesis and layer processing, etc. The 2D graphics engine is a drawing engine for 2D drawing.

[0091] The kernel layer provides the core system services of the operating system, such as security, memory management, process management, network protocol stack and driver model, which are all implemented based on the kernel layer. The kernel layer also serves as an abstraction layer between the hardware and software stacks. This layer has many drivers related to electronic devices, the main drivers are: display driver; keyboard driver as input device; Flash driver based on memory technology device; camera driver; audio driver; Bluetooth driver; WiFi driver, etc.

[0092] It should be understood that the functional services described above are only examples, and in actual applications, electronic devices may also be divided into more or fewer functional services according to other factors, or the functions of each service may be divided in other ways, or the functional services may not be divided but work as a whole.

[0093] The solution provided in this application is described in detail below in conjunction with specific embodiments.

[0094] In the solution provided in the embodiment of the present application, the electronic device can monitor the CPU computing power load of the background application, and when the CPU computing power load of the background application is high, it can control the CPU resources used by the background application and / or the time when the background application uses the CPU resources. Therefore, by reducing the CPU resources used by the background application and / or the time when the background application uses the CPU resources, more CPU resources can be released for use by the foreground application, thereby alleviating or avoiding the situation where the background application occupies a large amount of CPU resources, causing the foreground application to run lag.

[0095] In a possible design, the solution provided by the embodiment of the present application can be implemented by a control system deployed in an electronic device. The control system may include at least one application, a first control unit, a second control unit and a monitoring unit. Among them, the first control unit can be used to monitor the status of some or all applications in at least one application. On the one hand, the first control unit can indicate the application to the second control unit when the state of the application is monitored to be running in the background, and the second control unit can control the monitoring unit to set the application as a monitoring application and monitor the application. On the other hand, when the first control unit monitors that the background application becomes a non-background state (for example, a state other than the background running such as a closed state or a foreground state), the application is indicated to the second control unit, and the second control unit can control the monitoring unit to cancel the setting of the monitoring application for the application and stop monitoring the application. Among them, monitoring the application can be monitoring the running process of the application and / or monitoring the CPU computing power occupied by the running process of the application. The monitoring unit can be used to maintain the monitoring list and the relevant information of the application in the monitoring list (for example, the application name, the process identifier (PID) of the application, etc., which is used to identify the application). Among them, the process identifier can also be called a global identifier. As an optional implementation, the monitoring list includes at least one application, and the at least one application may be a set application, or the at least one application includes all applications installed in the electronic device. The monitoring unit may set an application as a monitoring application by identifying the application in the monitoring list as a monitoring application, and the monitoring unit may cancel the setting of the application as a monitoring application by deleting the identification used to identify the application as a monitoring application. As another optional implementation, the monitoring list includes applications that need to be monitored. Exemplarily, the application that needs to be monitored may be an application that is running in the background, or an application that is running in the background and belongs to a set application, and of course, it may also be an application of other set types. The monitoring unit may set an application as a monitoring application by adding the application to the monitoring list, and the monitoring unit may cancel the setting of the application as a monitoring application by deleting the application from the monitoring list.

[0096] In some embodiments of the present application, the monitoring unit may monitor the operation of the applications in the monitoring list and collect computing power data, and report the collected computing power data to the second control unit. Exemplarily, the monitoring unit may report the relevant computing power data of the monitored application to the second control unit in the form of a data snapshot. The second control unit may calculate the CPU computing power load of the monitored application based on the computing power data reported by the monitoring unit and report it to the first control unit. The first control unit may control the CPU occupancy of the application based on the CPU computing power load of the application reported by the second control unit.

[0097] For example, Figure 3 A schematic diagram of a control system architecture and a control method provided in an embodiment of the present application.

[0098] like Figure 3 As shown in , the first control unit can be deployed in the application framework layer of the electronic device, the second control unit can be implemented as a system component of the electronic device and deployed in the system component layer of the electronic device, and the monitoring unit can be deployed in the kernel layer of the electronic device.

[0099] Example 1. In one example, the at least one application may include application 1, application 2, application 3, application 4, and application 5, wherein the identifier of application 1 may be p1, the identifier of application 2 may be p2, the identifier of application 3 may be p3, the identifier of application 4 may be p4, and the identifier of application 5 may be p5. Then the monitoring list maintained by the monitoring unit may include applications 1 to 5, such as Figure 3 As shown in , the monitoring unit can record the identifiers of applications 1 to 5 in the monitoring list. Initially, the monitoring unit can mark applications 1 to 5 as non-monitoring applications. When the first control unit detects that an application, such as application 1, enters the background running state, and the first control unit determines to monitor application 1, the first control unit can indicate the identifier of application 1, i.e., p1, to the second control unit, and instruct the monitoring of the application identified by p1. The second control unit can indicate the identifier p1 to the monitoring unit, and instruct the monitoring unit to monitor the application identified by p1. The monitoring unit can then mark the application identified by p1 in the monitoring list, i.e., application 1, as a monitoring application, and monitor application 1. Similarly, when the first control unit detects that another application, such as application 4, enters the background running state, the monitoring unit can be controlled to mark the application identified by p4 in the monitoring list, i.e., application 4, as a monitoring application, and monitor application 4, in accordance with a similar process as described above. Then as Figure 3 As shown in , application 1 and application 4 in the monitoring list are marked as monitoring applications, and application 1, application 3, and application 5 are marked as non-monitoring applications.

[0100] Optionally, when the first control unit subsequently monitors that application 1 changes from the background running state to other states, the first control unit may indicate the identifier of application 1, i.e., p1, to the second control unit, and instruct it to stop monitoring the application identified by p1. The second control unit may indicate the identifier p1 to the monitoring unit, and instruct the monitoring unit to stop monitoring the application identified by p1. The monitoring unit may then mark the application identified by p1 in the monitoring list, i.e., application 1, as a non-monitoring application, and stop monitoring application 1. Similarly, when the first control unit monitors that application 4 changes from the background running state to other states, the monitoring unit may be controlled to mark the application identified by p4 in the monitoring list, i.e., application 4, as a non-monitoring application, and stop monitoring application 4, in accordance with a similar process as described above.

[0101] Figure 4 A flow chart of a control method provided in an embodiment of the present application is shown in FIG. Figure 4 As shown in , the method may include:

[0102] S401: The first control unit detects that the first application enters a background running state.

[0103] In some embodiments of the present application, the first application may be any application installed in the electronic device, or the first application may be any application of a set type of application installed in the electronic device (for example, the first application may be any system application or a self-developed application of the device manufacturer, etc.), or the first application may be any application of at least one set application. Exemplarily, the set at least one application may be an application in the application monitoring list configured by the system or the user, for example, it may be Figure 3 The applications identified by the identifiers p1 to p5 shown in the figure are the applications 1 to 5 described in the above example.

[0104] S402: The first control unit sends a first identifier to the second control unit; wherein the first identifier is used to identify the first application.

[0105] In the embodiment of the present application, the first identifier is information used to uniquely identify the first application, for example, it can be the name, abbreviation, application code, etc. of the first application, and no specific limitation is made in the embodiment of the present application.

[0106] In some embodiments of the present application, when the first application switches from foreground operation to background operation, the first control unit can determine that the first application enters the background operation state by monitoring the first application exit event. Optionally, the first control unit can send the identifier of the first application to the second control unit by means of socket communication.

[0107] Example 2. In one example, when the first application is the application 1 described in the above example 1, the first identifier is the identifier p1 of application 1. As an optional implementation, when the first control unit monitors that application 1 enters the background running state, the identifier of application 1, i.e., p1, can be sent to the second control unit through socket communication. As another optional implementation, when the first control unit monitors that application 1 enters the background running state, the first control unit obtains a pre-stored application monitoring list (for example, including applications 1 to 5), and determines whether application 1 is included in the application monitoring list. When it is determined that application 1 is included in the application monitoring list, the first control unit can send the identifier p1 of application 1 to the second control unit through socket communication, so that the second control unit sets the monitoring task. After receiving the identifier p1 of application 1, the second control unit can send the identifier p1 of application 1 to the monitoring unit to instruct the monitoring unit to add a monitoring task for application 1. In this example, when the first control unit monitors that application 1 enters the background running state, the first control unit can also store the identifier p1 of application 1 and the CPU computing power load threshold (for example, 5%) corresponding to application 1 as a data pair. In another example, taking the application monitoring list pre-stored by the first control unit including applications 1 to 5 as an example, when the first application is application 6 and the first control unit detects that application 6 enters the background running state, the first control unit can determine that application 6 is not included in the application monitoring list, so the first control unit can not perform subsequent monitoring task settings and other processing for application 6, that is, the first control unit can ignore application 6.

[0108] S403: The second control unit sends the first identifier to the monitoring unit, and instructs the monitoring unit to monitor the CPU computing load of the application identified by the first identifier.

[0109] Optionally, the second control unit may save the first identifier.

[0110] In some embodiments of the present application, after receiving the first identifier and the corresponding indication from the second control unit, the monitoring unit may mark the application corresponding to the first identifier in the monitoring list as a monitoring application, or add the first identifier to the monitoring list.

[0111] Example 3: Based on the above example 2, after the second control unit sends the identifier p1 of application 1 to the monitoring unit, the monitoring unit can mark the identifier p1 in the monitoring list as a monitoring application, thereby adding a monitoring task for application 1, for example Figure 3 As shown in , application 1 in the monitoring list is marked as a monitoring application.

[0112] S404: The monitoring unit collects computing power data of the first application by monitoring the operation of the first application.

[0113] In some embodiments of the present application, the computing power data of the application can be used to indicate the CPU computing power occupied by the application. The computing power data of the first application can include the CPU computing power occupied by the first application at multiple different time points.

[0114] In some embodiments of the present application, for an application, the monitoring unit may first calculate the computing power of the application in each CPU core, and then sum the computing power of the application in all CPU cores to obtain the CPU computing power occupied by the application. When calculating the computing power of each CPU core, the monitoring unit may first calculate the computing power of the CPU core when it is running at each operable frequency point, and then sum the computing power of all operable frequencies of the CPU core to obtain the computing power of the CPU core. By summing the CPU computing power of multiple applications, the CPU computing power of multiple applications can be obtained.

[0115] Specifically, the monitoring unit may calculate the CPU computing power of the target application according to a first formula, where the first formula is:

[0116]

[0117] Wherein, cpuload is the CPU computing power of the target application; t is the number of applications (that is, the number of applications included in the target application, or can be understood as the number of target applications), and i is an integer. is the summation symbol, indicating the summation of the X values ​​when i is 1 to t; n is the number of CPU cores, j is an integer, is a summation symbol, indicating the summation of the X values ​​when j is 1 to n; m is the number of CPU core operating frequencies, and k is an integer. It is a summation symbol, which means to sum the values ​​of X when k is 1 to m; X is only used to refer to the content at the same position as X in the summation symbol in the above formula, and X has no actual physical meaning. dmips[j] represents the CPU computing power ratio parameter of the jth CPU core; frequency[k] represents the kth frequency point (or frequency) at which the CPU can run, and runtime[k] represents the time the CPU core runs at the kth frequency point.

[0118] In the embodiment of the present application, the target application may include at least one monitored application, or it can be understood that there may be at least one target application.

[0119] Example 4: In one example, the target application may be the first application mentioned above. Based on the above example 2, when the first application is application 1, taking application 1 using a dual-core CPU and the CPU having 3 operating frequencies as an example, the calculation method of the CPU computing power of application 1 based on the first formula is:

[0120]

[0121] According to the above calculation method, the CPU computing power of application 1 can be calculated as: cpuload 1 =dimps[1]*frequency[1]*runtime[1]+dimps[1]*frequency[2]*runtime[2]+dimps[1]*frequency[3]*runtime[3]+dimps[2]*frequency[1]*runtime[1]+dimps[2]*frequency[2]*runtime[2]+dimps[2]*frequency[3]*runtime[3].

[0122] Among them, cpuload 1 is the CPU computing power of application 1; dimps[1] indicates the CPU computing power ratio parameter of the first CPU core, and dimps[2] indicates the CPU computing power ratio parameter of the second CPU core; frequency[1] indicates the first frequency point at which the CPU can run, frequency[2] indicates the second frequency point at which the CPU can run, and frequency[3] indicates the third frequency point at which the CPU can run; runtime[1] indicates the running time at the first frequency point, runtime[2] indicates the running time at the second frequency point, and runtime[3] indicates the running time at the third frequency point;

[0123] dimps[1]*frequency[1]*runtime[1] represents the computing power of the first core of the CPU at the first frequency point;

[0124] dimps[1]*frequency[2]*runtime[2] represents the computing power of the first core of the CPU at the second frequency point;

[0125] dimps[1]*frequency[3]*runtime[3] represents the computing power of the first core of the CPU at the third frequency point;

[0126] dimps[2]*frequency[1]*runtime[1] represents the computing power of the second CPU core at the first frequency point;

[0127] dimps[2]*frequency[2]*runtime[2] represents the computing power of the second core of the CPU at the second frequency point;

[0128] dimps[2]*frequency[3]*runtime[3] represents the computing power of the second core of the CPU at the third frequency.

[0129] In an embodiment of the present application, the monitoring unit may calculate the CPU computing power occupied by the first application at each time point according to the first formula above. Exemplarily, the monitoring unit may calculate the CPU computing power occupied by the first application at the first time according to the first formula at the first time, and may calculate the CPU computing power occupied by the first application at the second time according to the first formula at the second time, and then use the CPU computing power occupied by the first application at the first time and the CPU computing power occupied by the first application at the second time as the computing power data of the first application and report them to the second control unit.

[0130] S405: The monitoring unit sends the computing power data of the first application to the second control unit.

[0131] S406: The second control unit calculates the CPU computing power load of the first application according to the computing power data of the first application.

[0132] In some embodiments of the present application, when calculating the CPU computing power load of the first application, the second control unit can determine the difference in CPU computing power occupied by the first application at two different time points based on the computing power data of the first application reported by the monitoring unit, and use the ratio of the difference in computing power to the total CPU computing power available for operation of all CPUs in the corresponding time period as the CPU computing power load of the first application. The corresponding time period is the time period between two different time points.

[0133] Specifically, the second control unit may determine the total CPU computing power according to a second formula, and the second formula is:

[0134]

[0135] Among them, system_cpuload represents all the computing power (i.e., total computing power) available for operation by all CPUs during the time period from T1 to T2. T1 and T2 are two time points for calculating the CPU computing power load of the monitored application, and T2 is later than T1. dmips[j] represents the CPU computing power ratio parameter of the j-th CPU core, maxfrequency[j] represents the maximum frequency of the j-th CPU core; (T2-T1) represents the time interval between T2 and T1; n represents the number of CPU cores, and j is an integer. is a summation symbol, indicating the summation of the X values ​​when j is 1 to n; wherein X is only used to refer to the content at the same position as X in the summation symbol in the above formula, and X has no actual physical meaning.

[0136] The second control unit may determine the CPU computing load of the target application according to a third formula, where the third formula is:

[0137]

[0138] cpuload_percentage indicates the CPU computing load of the target application (the value can be a percentage). T2 Indicates the CPU computing power of the target application calculated at time T2, cpuload T1 Indicates the CPU computing power of the target application calculated at time T1, and system_cpuload indicates the total CPU computing power.

[0139] S407: When the second control unit determines that the CPU computing power load of the first application is greater than or equal to the set first threshold, the CPU computing power load of the first application is sent to the first control unit.

[0140] In an embodiment of the present application, after the second control unit determines the CPU computing power load of the first application, if it is determined that the CPU computing power load of the first application is greater than or equal to the set first threshold, it can be considered that the CPU computing power occupied by the first application when running in the background is relatively high, and the CPU computing power load of the first application can be reported to the first control unit, and then the first control unit further determines whether to suppress the CPU of the background running of the first application. If the second control unit determines that the CPU computing power load of the first application is less than the set first threshold, it can be considered that the CPU computing power occupied by the first application when running in the background is relatively low, and there is no need to report to the first control unit. Among them, when the second control unit reports the CPU computing power load of the first application to the first control unit, it can also report the identification information of the first application at the same time.

[0141] In some embodiments of the present application, the first threshold value may be used as a reporting threshold value (or reference value) for determining whether to report the CPU computing load of the application to the first control unit. The first threshold value may be a value configured by the system or the user. For example, the first threshold value may be a smaller percentage value such as 1%.

[0142] For example, taking the first threshold value set as 1% as an example, if the first application is application 1 described in the above example, and the second control unit determines that the CPU computing load of application 1 is 60%, the second control unit can determine that the CPU computing load of application 1 is higher than the set first threshold, and the second control unit can report the CPU computing load of application 1 to the first control unit. Optionally, the second control unit can send the application identifier (i.e., p1) and the CPU computing load of application 1 (i.e., 60%) to the first control unit. Taking the first threshold value set as 1% as an example, if the first application is application 1 described in the above example, and the second control unit determines that the CPU computing load of application 1 is 0.6%, the second control unit can determine that the CPU computing load of application 1 is lower than the set first threshold, and the second control unit does not report the CPU computing load of application 1 to the first control unit.

[0143] In other embodiments of the present application, for different applications, or for different types of applications, the reporting threshold for determining whether to report the CPU computing load of the application to the first control unit may be different. Then the first threshold can be used as a reporting threshold for determining whether to report the CPU computing load of the first application to the first control unit, or the first threshold can be used as a reporting threshold for determining whether to report the CPU computing load of the first type of application to the first control unit, wherein the first type is the type to which the first application belongs. In this manner, the reporting threshold can also be used as a judgment threshold for determining whether to suppress the CPU of the application. Based on this manner, when the second control unit determines that the CPU computing load of the first application is greater than or equal to the corresponding reporting threshold (i.e., the first threshold), it can simultaneously determine that the CPU needs to be suppressed on the first application, and the identification information of the first application (or the identification information and the CPU computing load of the first application) can be reported to the first control unit, and the first control unit can also be instructed to suppress the CPU of the first application. After receiving the reported information, the first control unit can directly suppress the CPU of the first application according to the method described in step S409 below.

[0144] For example, when different applications correspond to different reporting thresholds, the reporting threshold corresponding to the camera application can be 1%, and the reporting threshold corresponding to the gallery application can be 2%. When the first application is a camera application, the first threshold is 1%. If the CPU computing power of the camera application determined by the second control unit is 1% (equal to the first threshold, i.e., 1%), the CPU computing power load of the first application can be sent to the first control unit. If the CPU computing power of the camera application determined by the second control unit is 0.5% (less than the first threshold, i.e., 1%), it is not reported to the first control unit. When the first application is a gallery application, the first threshold is 2%. If the CPU computing power of the camera application determined by the second control unit is 5% (greater than the first threshold, i.e., 2%), the CPU computing power load of the first application can be sent to the first control unit. If the CPU computing power of the camera application determined by the second control unit is 1% (less than the first threshold, i.e., 2%), it is not reported to the first control unit.

[0145] For another example, when different types of applications correspond to different reporting thresholds, the reporting threshold corresponding to audio applications can be 3%, and the reporting threshold corresponding to video applications can be 1%. When the first application belongs to the audio application, the first threshold is 3%. If the CPU computing power of the first application determined by the second control unit is 10% (higher than the first threshold, i.e., 3%), the CPU computing power load of the first application can be sent to the first unit; if the CPU computing power of the first application determined by the second control unit is 2% (lower than the first threshold, i.e., 3%), it is not reported to the first unit. When the first application belongs to the video application, the first threshold is 1%. If the CPU computing power of the first application determined by the second control unit is 2% (higher than the first threshold, i.e., 1%), the CPU computing power load of the first application can be sent to the first unit. If the CPU computing power of the first application determined by the second control unit is 0.2% (lower than the first threshold, i.e., 1%), it is not reported to the first unit.

[0146] S408: The first control unit determines whether the CPU computing power load of the first application is greater than or equal to the CPU computing power load threshold corresponding to the first application; if so, execute step S409; otherwise, execute step S410.

[0147] In the embodiment of the present application, the CPU computing load threshold of the first application can be used as a reference value for determining whether to perform CPU suppression on the first application. The CPU suppression includes limiting the CPU resources used by the application and / or limiting the time for the application to use the CPU resources.

[0148] In an embodiment of the present application, after the first control unit receives the CPU computing load of the first application reported by the second control unit, the CPU computing load of the first application can be compared with the CPU computing load threshold corresponding to the first application that has been stored. If the CPU computing load of the first application (i.e., the actual CPU computing load of the first application) is greater than or equal to the CPU computing load threshold corresponding to the first application, it means that the first application occupies a relatively serious amount of CPU when running in the background, which may affect the smooth operation of the foreground application. Therefore, the CPU of the first application can be suppressed by executing the following step S409, thereby reducing the CPU occupancy when the first application runs in the background. If the CPU computing load of the first application (i.e., the actual CPU computing load of the first application) is less than the CPU computing load threshold corresponding to the first application, it means that the CPU occupancy rate of the first application when running in the background is low, which basically does not affect the smooth operation of the foreground application. Therefore, the CPU of the first application does not need to be suppressed, that is, the following step S410 can be executed.

[0149] S409: The first control unit limits the CPU resources used by the first application and / or the time during which the first application uses the CPU resources.

[0150] In some embodiments of the present application, the method for the first control unit to limit the CPU resources used by the first application may be: limiting the first application to use only the small core of the CPU when running in the background, and the specific operation method may be to set the control group (CPUset) of the first application to the application background (background, BG) group. Among them, CPUset is implemented based on the control group (control group, cgroup) subsystem, and the basic function of CPUset is to limit a group of processes to run only on certain CPUs and memory nodes. The grouping of CPUset in the electronic device includes BG grouping (processes in the group only run on small core CPUs), very important person (VIP) grouping (processes in the group can run on medium core or large core CPUs), application foreground grouping (processes in the group can run on small core or medium core or large core CPUs), key BG grouping (processes in the group can run on medium core or small core CPUs), system BG grouping (processes in the group can run on medium core or small core CPUs), etc. By setting the CPUset group of the first application to the BG group, the first application can be restricted to run only on the small-core CPU, so that the medium-core or large-core CPU resources can be given to the foreground application as much as possible, thereby ensuring the smooth operation of the foreground application.

[0151] In some embodiments of the present application, the method for the first control unit to limit the time the first application uses CPU resources may be: reducing the time the first application uses CPU resources, and the specific operation method may be: setting the CPU group of the first application to a limit group. The CPU group in the electronic device may include a BG group, a VIP group, a foreground group, a key BG group, a system BG group, a limit group, etc. Among them, the processes in the limit group can only obtain a low proportion of CPU time slices compared to the processes in other groups such as BG, and the processes can only call CPU resources within the obtained CPU time slices. Therefore, by setting the first application to the limit group, the time the first application occupies the CPU can be reduced by limiting the number of CPU time slices obtained by the first application, and then as much time as possible is given to the foreground application, thereby ensuring the smooth operation of the foreground application.

[0152] In some embodiments of the present application, the time that an application uses the CPU can be limited by a time control parameter (e.g., cpu.shares). Each CPU group has a corresponding time control parameter, and the time control parameter corresponding to the CPU group is specifically used to indicate the relative proportion of the CPU time that the application in the CPU group can occupy. Exemplarily, taking the case where the CPU group includes two groups, the BG group and the limit group, the time control parameter corresponding to the BG group can be 200, and the time control parameter corresponding to the limit group can be 100, then the time ratio that the application in the BG group and the application in the limit group can occupy the CPU resource is 2:1. When the idle time slice of the CPU resource is 300, when allocating the CPU idle time slice, 200 time slices out of 300 time slices can be allocated to the application in the BG group, and the remaining 100 time slices can be allocated to the application in the limit group.

[0153] In some embodiments of the present application, when the first control unit determines to suppress the CPU of the first application, it can also send information that the CPU computing power load of the first application is greater than or equal to the CPU computing power load threshold corresponding to the first application to the maintenance and measurement unit of the electronic device, so that the maintenance and measurement unit can locate and analyze related problems based on the information when necessary.

[0154] For example, Figure 3 As shown in , the maintenance unit can be deployed in the application framework layer of the electronic device.

[0155] Optionally, in step 408, when the first control unit determines that the CPU computing power load of the first application is greater than or equal to the CPU computing power load threshold corresponding to the first application, the following steps can also be performed: the first control unit sends a first indication message to the maintenance unit, and the first indication message is used to indicate that the CPU computing power load of the first application is greater than or equal to the CPU computing power load threshold corresponding to the first application.

[0156] In some embodiments of the present application, after the first control unit suppresses the CPU of the first application, if it is determined that the first application has switched from a background running state to a foreground running state, the CPU suppression of the first application can be stopped, and the monitoring unit can be controlled by the second control unit to set the first application as a non-monitoring application, thereby ending the monitoring task for the first application.

[0157] As an optional implementation, after the first control unit performs CPU suppression on the first application, the CPU computing load of the first application can continue to be obtained. When it is determined that the CPU computing load of the first application is greater than or equal to the CPU computing load threshold corresponding to the first application, the first control unit can further determine whether the first application enters the foreground running state. If it is determined that the first application enters the foreground running state, the CPU suppression of the first application can be released.

[0158] S410: The first control unit does not limit the CPU resources used by the first application and / or the time during which the first application uses the CPU resources.

[0159] Example 5. For example, in the above example, the reporting threshold corresponding to application 1 is 1%, the CPU computing load threshold corresponding to application 1 is 5%, and the CPU has 5 cores. When application 1 enters the background running state, Figure 5As shown in , when application 1 is running in the background, 5 cores of the CPU can be used. During the background running of application 1, the monitoring unit can monitor the running process of application 1 and report the computing power data of application 1 to the second control unit. The second control unit can calculate the CPU computing power load of application 1 based on the computing power data of application 1. When the CPU computing power load of application 1 calculated by the second control unit at a certain moment is 60%, it can be determined that the CPU computing power load of application 1 is higher than the reporting threshold (i.e. 1%), and the second control unit reports the CPU computing power load of application 1 to the first control unit. After the first control unit receives the CPU computing power load of application 1, it can be determined by comparison that the CPU computing power load of application 1 (i.e. 60%) is higher than the CPU computing power load threshold (i.e. 5%) corresponding to application 1, so the first control unit can determine that CPU suppression is required for application 1. Exemplarily, the solution for the first control unit to suppress the CPU of application 1 may include: setting the CPUset group of application 1 to the BG group, and setting the CPU group of application 1 to the limit group. After CPU suppression, application 1 can only use the small core of the 5 cores of the CPU when running in the background, and the time slice allocated to application 1 for using the CPU is reduced. For example, Figure 6 As shown in , when application 1 is running in the background, it can use the small cores among the five cores, but does not use the medium and large cores among the five cores. Figure 5 and Figure 6 It can be seen that before CPU suppression of application 1, the CPU resources used by application 1 are not limited, that is, application 1 can use all cores of the CPU (including large cores, medium cores and small cores). After CPU suppression of application 1, the CPU resources used by application 1 are limited, specifically, only the small cores of the 5 cores of the CPU can be used. In addition, after CPU suppression of application 1, the time that application 1 occupies CPU resources is shorter than before CPU suppression of application 1. After testing, when the CPU computing power load of the test application is 60% when the background is running normally, by suppressing the CPU of the test application, the CPU computing power load of the test application can be suppressed to about 7%, and the suppression effect is very obvious.

[0160] In some embodiments of the present application, in the above step S401, after determining that the first application enters the background running state, the first control unit may determine whether it is necessary to monitor the first application. If so, steps S402 to S410 described in the above embodiment may be continued to be executed. Otherwise, steps S402 to S410 described in the above embodiment may not be executed, and the application status of other applications may continue to be monitored. Based on this method, optionally, Figure 4 As shown in FIG. 4 , after step S401 and before step S402, the first control unit may further perform the following step S411:

[0161] S411: The first control unit determines whether the first application is included in the set application monitoring list; if so, step S402 is executed, otherwise, step S402 is not executed, and step S412 can be executed.

[0162] The set application monitoring list includes at least one application configured by the system or the user, and the at least one application may be an application of the same type or an application of a different type.

[0163] S412: End the current processing flow for the first application.

[0164] In some other embodiments of the present application, Figure 4 As shown in FIG. 4 , after step S401, the first control unit may further perform the following step S413:

[0165] S413: The first control unit obtains and stores an identifier of the first application and a CPU computing power load threshold corresponding to the first application.

[0166] The first control unit may store the identifier of the first application and the CPU computing power load threshold of the first application as a data pair. The identifier in the data pair may be used to identify the application corresponding to the CPU computing power load threshold in the data pair.

[0167] In some embodiments of the present application, the CPU computing power load threshold corresponding to the first application may be a value configured by the electronic device system or a value configured by the user.

[0168] The CPU computing power load threshold corresponding to the first application can be used to determine whether to limit the CPU resources used by the first application and / or the time for the first application to use the CPU resources. For details, please refer to the description in the above step S409, which will not be described in detail here.

[0169] In some embodiments of the present application, the above processing method for background running applications (such as the above first application) can be executed periodically. For example, the first control unit can control the second control unit to periodically calculate the CPU computing load of the monitored application and report it. The first control unit can determine whether to suppress the CPU of the application and perform subsequent processing according to the CPU computing load after receiving the CPU computing load of the application reported by the second control unit each time.

[0170] As an optional implementation, the first control unit may instruct the second control unit to start periodically calculating the CPU computing power load of the monitored application, the second control unit may instruct the monitoring unit to monitor and report the computing power data of the monitored application once every set time (i.e., the time corresponding to a cycle), or the second control unit may instruct the monitoring unit to monitor and report the computing power data of the monitored application once every set time. The second control unit may periodically calculate the CPU computing power load of the monitored application and perform subsequent processing based on the data periodically reported by the monitoring unit. As an optional implementation, the second control unit may calculate the CPU computing power load of the monitored application in a polling manner at set times, that is, query the computing power data of the monitored application reported by the monitoring unit one by one, and calculate the CPU computing power load of the monitored application based on the queried data, until the CPU computing power load of all monitored applications is calculated, and a polling calculation process can be completed. Among them, the set time may be the time configured by the electronic device system, or may be the time pre-configured by the application. For example, the set time may be a time at the second level such as 2 seconds or 3 seconds.

[0171] In the above method, by collecting the CPU computing load of the background running application, the CPU computing load of the background running application is compared with the corresponding CPU computing load threshold. When the CPU computing load of the background running application is higher than or equal to the corresponding CPU computing load threshold, the CPU of the background running application is suppressed. When the background running application occupies the CPU seriously, the CPU occupancy rate of the background running application can be limited, thereby providing more sufficient and efficient CPU computing power support for the foreground application, thereby reducing or avoiding problems such as foreground application jamming and rapid heating. The above method can also more accurately and efficiently control the foreground and background CPU resources for the application, thereby efficiently controlling the foreground and background loads of the electronic device, which helps to improve the performance of the entire machine.

[0172] It should be noted that the specific implementation process provided in the above embodiment is only an example of the method process applicable to the embodiment of the present application. The execution order of each step can be adjusted accordingly according to actual needs, and other steps can be added or some steps can be reduced.

[0173] Based on the above embodiments and the same technical concept, the present application embodiment also provides a control method, such as Figure 7 As shown in , the method includes:

[0174] S701: The electronic device determines that the first application is in the background running state.

[0175] Illustratively, the first application may be the first application described in the aforementioned embodiment.

[0176] S702: The electronic device determines first load data, where the first load data is used to indicate central processing unit (CPU) occupancy information of a first application.

[0177] In some embodiments of the present application, the first load data is the occupancy rate of the CPU computing power occupied by the first application to the total CPU computing power in the first time period. Specifically, when determining the first load data, the electronic device can, on the one hand, obtain the first computing power data indicating the CPU computing power occupied by the first application at the first time, and the second computing power data indicating the CPU computing power occupied by the first application at the second time, and obtain the CPU computing power occupied by the first application in the first time period based on the first computing power data and the second computing power data; wherein the first time is the start time of the first time period, and the second time is the end time of the first time period. On the other hand, the electronic device can obtain the third computing power data indicating the total CPU computing power of the electronic device in the time period between the first time and the second time. After obtaining the above data, the electronic device can obtain the first load data based on the CPU computing power occupied by the first application in the first time period and the third computing power data. Specifically, the electronic device can determine the first load data according to the CPU computing power occupied by the first application in the first time period and the third computing power data according to the third formula described in the aforementioned embodiment. Wherein, cpuload in the third formula T2 The value can be the second computing power data, cpuload T1 The value of can be the first computing power data, the value of system_cpuload can be the third computing power data, and the cpuload_percentage calculated thereby is the first load data.

[0178] The electronic device may determine the first computing power data and the second computing power data with reference to the first formula described in the above embodiment. Specifically, the electronic device may calculate the first computing power data at the first time according to the following formula:

[0179]

[0180] Wherein, data1 is the first computing power data, ∑ is the summation symbol, t is the number of applications, n is the number of CPU cores of the electronic device; dmips[j] is the CPU computing power ratio parameter used to indicate the number of operation instructions processed by the j-th CPU core of the electronic device per second; m is the number of frequencies at which the CPU of the electronic device can run, frequency[k] is the k-th frequency; runtime[k] is the running time of the CPU core at the k-th frequency.

[0181] The electronic device may calculate the second computing power data at the second time according to the following formula:

[0182]

[0183] Wherein, data2 is the second computing power data, ∑ is the summation symbol, t is the number of applications, n is the number of CPU cores of the electronic device; dmips[j] is the CPU computing power ratio parameter used to indicate the number of operation instructions processed by the j-th CPU core of the electronic device per second; m is the number of frequencies at which the CPU of the electronic device can run, frequency[k] is the k-th frequency; runtime[k] is the running time of the CPU core at the k-th frequency.

[0184] The electronic device may obtain the third computing power data by referring to the second formula described in the above embodiment. Specifically, the electronic device may calculate the third computing power data according to the following formula:

[0185]

[0186] Wherein, data3 is the third computing power data, ∑ is the summation symbol, and the value of n is the number of CPU cores of the electronic device; dmips[j] is a CPU computing power ratio parameter used to indicate the number of operation instructions processed by the j-th CPU core of the electronic device per second; frequency[j] represents the j-th frequency point, T2 is the second time, T1 is the first time, and the second time is later than the first time.

[0187] Exemplarily, the first load data may be the CPU computing power load of the first application described in the foregoing embodiment. The first computing power data and the second computing power data may be the CPU computing power of the first application described in the foregoing embodiment.

[0188] In some embodiments of the present application, before determining the first load data, the electronic device may also determine that the first application belongs to a set application.

[0189] Exemplarily, the set application may include the application in the application monitoring list described in the aforementioned embodiment.

[0190] S703: If the electronic device determines that the first load data is greater than or equal to a set first threshold, the electronic device reduces the CPU resources used by the first application and / or reduces the time the first application uses the CPU resources; wherein the first threshold is associated with the first application.

[0191] Exemplarily, the first threshold may be the CPU computing power load threshold corresponding to the first application described in the aforementioned embodiment. The method for obtaining the first threshold may refer to the method for obtaining the CPU computing power load threshold corresponding to the first application described in the aforementioned embodiment, which will not be described in detail here.

[0192] In some embodiments of the present application, the specific way for the electronic device to reduce the computing power CPU resources used by the first application may be: allowing the first application to use the small-core CPU, and prohibiting the first application from using the large-core CPU or the medium-core CPU; or, adding the first application to the application background BG group. The specific way for the electronic device to reduce the time the first application uses CPU resources may be: reducing the number of time slices allocated to the first application; or, adding the first application to the restricted group. The above method can be implemented with reference to the method described in step S409 in the aforementioned embodiment, and will not be described in detail here.

[0193] In some embodiments of the present application, the electronic device may include a first control unit, a second control unit and a monitoring unit. The specific structure may refer to the above embodiments. Figure 3 The corresponding introduction will not be described in detail here. Among them, the first control unit, the second control unit and the monitoring unit can cooperate to implement the control method provided in the embodiment of the present application. The specific implementation method can refer to the relevant introduction in the above embodiment and will not be repeated here.

[0194] Among them, the electronic device can obtain the computing power data of the first application through the monitoring unit, and send the computing power data of the first application to the second control unit. The second control unit can determine the first load data based on the computing power data of the first application, and send the first load data to the first control unit. Optionally, before sending the first load data to the first control unit through the second control unit, the electronic device can also determine through the second control unit that the first load data is greater than or equal to a set second threshold. Exemplarily, the second threshold can be the reporting threshold corresponding to the first application described in the aforementioned embodiment.

[0195] In some embodiments of the present application, before determining that the first application is in the background running state, or before determining the first load data, the electronic device may also determine the start time of the set time period. Based on this, the electronic device may periodically execute the above method.

[0196] The above provides a method for an electronic device to control a first application, and the electronic device can refer to the above method when controlling other applications. For example, the method for an electronic device to control a second application may include: determining that the second application is in a background running state; determining second load data, the second load data is used to indicate the CPU occupancy information of the second application; if it is determined that the second load data is greater than or equal to a set second threshold, reducing the CPU resources used by the second application and / or reducing the time the second application uses CPU resources; wherein the second threshold is associated with the second application. Optionally, the second threshold is different from the first threshold.

[0197] In the above method, the specific steps executed by the electronic device can refer to the relevant introduction in the above embodiments, which will not be described in detail here.

[0198] Based on the above embodiments and the same technical concept, the embodiment of the present application also provides an electronic device, which is used to implement the control method provided in the embodiment of the present application. Figure 8 As shown in the figure, the electronic device 800 may include: a memory 801, one or more processors 802, and one or more computer programs (not shown in the figure). The above-mentioned components may be coupled via one or more communication buses 803. Optionally, the electronic device 800 may also include a display screen 804.

[0199] Among them, one or more computer programs (codes) are stored in the memory 801, and the one or more computer programs include computer instructions; one or more processors 802 call the computer instructions stored in the memory 801, so that the electronic device 800 executes the control method provided by the above-mentioned embodiment of the present application.

[0200] In a specific implementation, the memory 801 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more disk storage devices, flash memory devices or other non-volatile solid-state storage devices. The memory 801 may store an operating system (hereinafter referred to as system), such as ANDROID, IOS, WINDOWS, or an embedded operating system such as LINUX. The memory 801 may be used to store an implementation program of an embodiment of the present application. The memory 801 may also store a network communication program, which may be used to communicate with one or more additional devices, one or more user devices, or one or more network devices.

[0201] The one or more processors 802 may be a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of the program of the present application.

[0202] The display screen 804 is used to display application interfaces and other related user interfaces.

[0203] It should be noted that Figure 8 This is only one implementation of the electronic device 800 provided in the embodiment of the present application. In actual applications, the electronic device 800 may also include more or fewer components. For details, please refer to Figure 1 The specific structure and description shown are not limited here.

[0204] Based on the above embodiments and the same technical concept, the embodiments of the present application also provide a computer-readable storage medium, which stores a computer program. When the computer program runs on a computer, the computer executes the method provided in the above embodiments.

[0205] Based on the above embodiments and the same technical concept, the embodiments of the present application also provide a computer program product, which includes a computer program or instructions. When the computer program or instructions are executed on a computer, the computer executes the method provided in the above embodiments.

[0206] The method provided in the embodiment of the present application 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 according to the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, a network device, a user device or other programmable device. 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, computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center via wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. Computer-readable storage media can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that includes one or more available media integrated. Available media can be magnetic media (e.g., floppy disks, hard disks, tapes), optical media (e.g., digital video discs (DVDs), or semiconductor media (e.g., SSDs), etc.

[0207] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims

1. A control method, applied to an electronic device, characterized in that: The method comprises: Determine that the first application is in background running state; Determine first load data, where the first load data is used to indicate central processing unit (CPU) occupancy information of the first application; If it is determined that the first load data is greater than or equal to a set first threshold, reduce the CPU resources used by the first application and / or reduce the time the first application uses the CPU resources; wherein the first threshold is associated with the first application.

2. The method according to claim 1, characterized in that The reducing the computing power CPU resources used by the first application includes: Allow the first application to use the small-core CPU, and prohibit the first application from using the large-core CPU or the medium-core CPU; or Add the first application to the application background BG group; The reducing the time of CPU resource usage by the first application includes: reducing the number of time slices allocated to the first application; or The first application is added to the restricted group.

3. The method according to claim 1 or 2, characterized in that The first load data is the occupancy rate of the CPU computing power occupied by the first application to the total CPU computing power in the first time period.

4. The method according to claim 3, characterized in that The determining of the first load data comprises: Acquire first computing power data, where the first computing power data is used to indicate the CPU computing power occupied by the first application at a first time; wherein the first time is the start time of the first time period; Acquire second computing power data, where the second computing power data is used to indicate the CPU computing power occupied by the first application at a second time; wherein the second time is the end time of the first time period; Acquire third computing power data, where the third computing power data is used to indicate the total computing power of the CPU of the electronic device in a time period between the first time and the second time; Acquire the CPU computing power occupied by the first application in a first time period according to the first computing power data and the second computing power data; The first load data is obtained according to the CPU computing power occupied by the first application in a first time period and the third computing power data.

5. The method according to claim 4, characterized in that The obtaining of the first computing power data includes: At the first time, the first computing power data is calculated according to the following formula: Among them, data1 is the first computing power data, ∑ is the summation symbol, t is the number of applications, and n is the number of CPU cores of the electronic device; dmips[j] is a CPU computing power ratio parameter used to indicate the number of operation instructions processed by the j-th CPU core of the electronic device per second; m is the number of frequencies at which the CPU of the electronic device can run, frequency[k] is the k-th frequency; runtime[k] is the running time of the CPU core at the k-th frequency.

6. The method according to claim 4 or 5, characterized in that The obtaining of the third computing power data includes: The third computing power data is calculated according to the following formula: Among them, the data3 is the third computing power data, the ∑ is the summation symbol, the value of n is the number of CPU cores of the electronic device; the dmips[j] is a CPU computing power ratio parameter used to indicate the number of operation instructions processed by the j-th CPU core of the electronic device per second; the frequency[j] represents the maximum frequency of the j-th CPU core, the T2 is the second time, the T1 is the first time, and the second time is later than the first time.

7. The method according to any one of claims 1 to 6, characterized in that: Before determining the first load data, the method further includes: It is determined that the first application is a setting application.

8. The method according to any one of claims 1 to 7, characterized in that: The electronic device comprises a first control unit, a second control unit and a monitoring unit; wherein the monitoring unit is located in the core layer of the electronic device; The determining that the first application is in a background running state includes: Determining, by the first control unit, that the first application is in a background running state; The determining of the first load data comprises: acquiring computing power data of the first application through the monitoring unit, and sending the computing power data of the first application to the second control unit; determining the first load data according to the computing power data of the first application by the second control unit; The determining that the first load data is greater than or equal to a set first threshold includes: sending the first load data to the first control unit through the second control unit; Determining, by the first control unit, that the first load data is greater than or equal to the first threshold; The reducing the CPU resources used by the first application and / or reducing the time the first application uses the CPU resources includes: The first control unit controls to reduce the CPU resources used by the first application and / or to reduce the time the first application uses the CPU resources.

9. The method according to claim 8, characterized in that The first control unit is located in the application framework layer of the electronic device, and the second control unit is a system component of the electronic device.

10. The method according to claim 8 or 9, characterized in that Before sending the first load data to the first control unit through the second control unit, the method further includes: The second control unit determines that the first load data is greater than or equal to a set second threshold.

11. The method according to any one of claims 1 to 10, characterized in that: Before determining that the first application is in the background running state, or before determining the first load data, the method further includes: Determine the start time of the set time period.

12. The method according to any one of claims 1 to 11, characterized in that: The method further comprises: Determining that the second application is in a background running state; Determine second load data, where the second load data is used to indicate CPU occupancy information of the second application; If it is determined that the second load data is greater than or equal to a set second threshold, reduce the CPU resources used by the second application and / or reduce the time the second application uses CPU resources; wherein the second threshold is associated with the second application, and the second threshold is different from the first threshold.

13. An electronic device, characterized in that: The electronic device includes a memory and one or more processors; The memory is used to store computer program codes, and the computer program codes include computer instructions; when the computer instructions are executed by the one or more processors, the electronic device executes the method according to any one of claims 1 to 12.

14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed on an electronic device, the electronic device executes the method according to any one of claims 1 to 12.