Frequency modulation method of processor
By monitoring threads and key thread indicators and dynamic frequency modulation processor core groups, the problem of insufficient performance output of processors in non-key scenarios is solved, and fluency and power consumption management in complex usage scenarios is achieved.
Patent Information
- Application Number
- CN202311464245.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-06
- Publication Date
- 2025-05-06
AI Technical Summary
In the prior art, the processor sets the operating frequency in key scenarios, resulting in insufficient performance output in other scenarios and cannot be flexibly adjusted to meet complex user usage scenarios.
Through internal monitoring threads, determine whether the foreground application has lost frames, record key thread indicators, and select whether to perform frequency modulation of the processor's core group, or restore operations in smooth situations.
It realizes dynamic adjustment of processor performance in complex user usage scenarios to ensure power consumption saving when the chip load is low, and performance output is released at higher levels, ensuring the smoothness of smart terminal devices.
Smart Images

Figure CN119937762A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communications, and in particular to a frequency modulation method of a processor. Background Art
[0002] In the daily use of smart terminal devices, users often encounter performance that does not meet expectations. How to effectively improve the fluency of smart terminal devices and enhance user experience is a key issue in the research and development of smart terminal devices.
[0003] Among the related technologies, Qualcomm's Windows-Assist Load Tracing (WALT) algorithm is a relatively outstanding processor computing power demand prediction and processor operating frequency adjustment solution in the chip field. This solution can respond to the performance requirements of smart terminal devices more quickly and timely than the Linux native Per-Entity Load Tracing (PELT) algorithm. However, this solution has the problem of lagging behind in the increase of the processor operating frequency, and the processor computing power demand prediction being too large compared to the actual requirements. The lag in the increase of the processor operating frequency will result in the processor failing to adjust the operating frequency in time to ensure output when the smart terminal device needs performance; the processor computing power demand prediction being too large compared to the actual requirements will result in a surplus of processor computing power supply, resulting in excessive power consumption and heating problems for smart terminal devices.
[0004] In response to these two issues, in the daily R&D of smart terminal devices, major manufacturers generally use the method of actively raising the operating frequency of the processor to ensure performance output in key scenarios, and limit the operating frequency of the processor to overcome the heating and power consumption problems of terminal products in minor or unimportant scenarios. However, the complex user usage scenarios have evolved different levels of performance requirements, and the restriction measures in minor or unimportant scenarios ultimately lead to insufficient performance output of the processor.
[0005] To sum up, how to achieve an active and flexible processor frequency modulation solution to ensure the performance output of smart terminal devices under complex user usage scenarios has become a technical problem that needs to be solved urgently. Summary of the invention
[0006] An embodiment of the present application provides a method for frequency modulation of a processor, so as to at least solve the problem in the related art that the operating frequency of the processor is set for key scenarios, resulting in insufficient performance output of the processor in other scenarios.
[0007] According to an embodiment of the present application, a frequency modulation method for a processor is provided, the method comprising: determining whether a foreground application has dropped frames through an internal monitoring thread; recording multiple groups of key thread indicators generated by the key thread of the foreground application during execution, wherein each group of the key thread indicators corresponds to a core group in the processor; in the event that the foreground application has dropped frames, selecting whether to perform a frequency modulation operation on the corresponding core group based on the key thread indicators, and generating a frequency modulation operation record after the frequency modulation operation; in the event that the foreground application has not dropped frames, selecting whether to perform a recovery operation on the corresponding core group based on the key thread indicators and the frequency modulation operation record generated by the last frequency modulation operation.
[0008] According to another embodiment of the present application, a processor is provided for performing frequency modulation according to the steps in any of the above method embodiments.
[0009] According to another embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program executes the steps of any of the above method embodiments when executed by a processor.
[0010] According to another embodiment of the present application, an electronic device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0011] Through the embodiments of the present application, the relevant parameters of the processor chip performance can be adjusted in real time according to the fluency of the foreground application, and the performance output can be released or constrained. This can solve the problem of setting the processor operating frequency for key scenarios in related technologies, resulting in insufficient performance output of the processor in other scenarios. This can achieve the technical effect of constraining the chip performance output to save power consumption when the chip load is low, and releasing the chip performance output to ensure the smoothness of use of smart terminal devices when the chip load is high. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] Figure 1 is a hardware structure block diagram of the frequency modulation method of the processor in an embodiment of the present application;
[0013] Figure 2 is a flow chart of a frequency modulation method of a processor according to an embodiment of the present application;
[0014] Figure 3 is a structural block diagram of a processor according to an embodiment of the present application;
[0015] Figure 4 is a flow chart of a frequency modulation method of a processor in an embodiment of the present application;
[0016] Figure 5 is a schematic diagram of frame drop detection of an internal monitoring thread in an embodiment of the present application;
[0017] Figure 6 is a flow chart of frame drop detection of an internal monitoring thread in one embodiment of the present application;
[0018] Figure 7 This is a processing flow chart after the foreground application submits screen data in one embodiment of the present application;
[0019] Figure 8 It is a flowchart of an operation record recovery task in an embodiment of the present application;
[0020] Fig. 9 It is a flowchart of a frame drop transaction processing task in one embodiment of the present application. DETAILED DESCRIPTION
[0021] The embodiments of the present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0022] It should be noted that the terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0023] The method embodiments provided in the embodiments of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Taking running on a mobile terminal as an example, Figure 1 is a hardware structure block diagram of the frequency modulation method of the processor in the embodiment of the present application, such as Figure 1 As shown, the mobile terminal 100 may include a radio frequency (RF) unit 101, a WiFi module 102, an audio output unit 103, an A / V (audio / video) input unit 104, a sensor 105, a display unit 106, a user input unit 107, an interface unit 108, a memory 109, a processor 110, and a power supply 111. Those skilled in the art will appreciate that Figure 1 The structure of the mobile terminal shown in the figure does not constitute a limitation on the mobile terminal. The mobile terminal may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0024] Combine the following Figure 1 The following is an introduction to the modules involved in executing the method embodiment of the present application.
[0025] Figure 1In the embodiment of the method of the present application, the processor 110 is the main component for executing the embodiment of the method of the present application, and is also the control center of the mobile terminal. It uses various interfaces and lines to connect various parts of the entire mobile terminal, and executes various functions of the mobile terminal and processes data by running or executing software programs and / or modules stored in the memory 109, and calling data stored in the memory 109, so as to monitor the mobile terminal as a whole. The processor 110 may include one or more processing units; illustratively, the processor 110 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, etc., and the modem processor mainly processes wireless communications. It can be understood that the above-mentioned modem processor may not be integrated into the processor 110.
[0026] The embodiment of the method of the present application is based on the fluency of the terminal foreground application. A smooth user experience requires the support of various component units; these components include but are not limited to the radio frequency unit 101, the WiFi module 102, the audio output unit 103, the mobile terminal 100, the display unit 106, the user input unit 107, the touch panel 1071, and the memory 109.
[0027] The radio frequency unit 101 can be used for receiving and sending signals during information transmission or communication. Specifically, after receiving the downlink information of the base station, it is sent to the processor 110 for processing; in addition, the uplink data is sent to the base station. Generally, the radio frequency unit 101 includes but is not limited to an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier, a duplexer, etc. In addition, the radio frequency unit 101 can also communicate with the network and other devices through wireless communication. The above-mentioned wireless communication can use any communication standard or protocol, including but not limited to Global System of Mobilecommunication (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access 2000 (CDMA2000), Wideband Code Division Multiple Access (WCDMA), Time Division-Synchronous Code Division Multiple Access (TD-SCDMA), Frequency Division Duplexing-Long Term Evolution (FDD-LTE) and Time Division Duplexing-Long Term Evolution (TDD-LTE).
[0028] WiFi is a short-range wireless transmission technology. Mobile terminals can help users send and receive emails, browse web pages, and access streaming media through WiFi module 102. It provides users with wireless broadband Internet access. Figure 1 The WiFi module 102 is shown, but it is understandable that it is not an essential component of the mobile terminal and can be omitted as required without changing the essence of the invention.
[0029] The audio output unit 103 can convert the audio data received by the RF unit 101 or the WiFi module 102 or stored in the memory 109 into an audio signal and output it as sound when the mobile terminal 100 is in a call signal reception mode, a talk mode, a recording mode, a voice recognition mode, a broadcast reception mode, etc. Moreover, the audio output unit 103 can also provide audio output related to a specific function performed by the mobile terminal 100 (for example, a call signal reception sound, a message reception sound, etc.). The audio output unit 103 may include a speaker, a buzzer, etc.
[0030] The mobile terminal 100 also includes at least one sensor 105, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor includes an ambient light sensor and a proximity sensor, wherein the ambient light sensor can adjust the brightness of the display panel 1061 according to the brightness of the ambient light, and the proximity sensor can turn off the display panel 1061 and / or the backlight when the mobile terminal 100 is moved to the ear. As a type of motion sensor, the accelerometer sensor can detect the magnitude of acceleration in all directions (generally three axes), and can detect the magnitude and direction of gravity when stationary. It can be used for applications that identify the posture of the mobile phone (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc.; as for other sensors that can also be configured on the mobile phone, such as fingerprint sensors, pressure sensors, iris sensors, molecular sensors, gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc., they will not be repeated here.
[0031] The display unit 106 is used to display information input by the user or information provided to the user. The display unit 106 may include a display panel 1061, which may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), or the like.
[0032] The user input unit 107 can be used to receive input digital or character information, and to generate key signal input related to the user settings and function control of the mobile terminal. Specifically, the user input unit 107 may include a touch panel 1071 and other input devices 1072. The touch panel 1071, also known as a touch screen, can collect the user's touch operation on or near it (such as the user's operation on the touch panel 1071 or near the touch panel 1071 using any suitable object or accessory such as a finger, stylus, etc.), and drive the corresponding connection device according to a pre-set program. The touch panel 1071 may include two parts: a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch orientation, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into the touch point coordinates, and then sends it to the processor 110, and can receive and execute the command sent by the processor 110. In addition, the touch panel 1071 can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic waves. In addition to the touch panel 1071, the user input unit 107 may also include other input devices 1072. Specifically, the other input devices 1072 may include, but are not limited to, one or more of a physical keyboard, a function key (such as a volume control key, a switch key, etc.), a trackball, a mouse, a joystick, etc., which are not specifically limited here.
[0033] Furthermore, the touch panel 1071 may cover the display panel 1061. When the touch panel 1071 detects a touch operation on or near it, it transmits the information to the processor 110 to determine the type of the touch event. Then, the processor 110 provides a corresponding visual output on the display panel 1061 according to the type of the touch event. Figure 1 In the figure, the touch panel 1071 and the display panel 1061 are used as two independent components to implement the input and output functions of the mobile terminal. However, in some embodiments, the touch panel 1071 and the display panel 1061 can be integrated to implement the input and output functions of the mobile terminal, which is not limited here.
[0034] The memory 109 can be used to store software programs and various data. The memory 109 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the mobile phone (such as audio data, a phone book, etc.), etc. In addition, the memory 109 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0035] In one embodiment of the present application, a frequency modulation method of a processor is provided. Figure 2 is a flow chart of a frequency modulation method of a processor according to an embodiment of the present application, such as Figure 2 As shown, the process includes the following steps:
[0036] Step S202, determining whether a foreground application has dropped frames through an internal monitoring thread;
[0037] Step S204, recording multiple groups of key thread indicators generated during the execution of the key thread of the foreground application, wherein each group of the key thread indicators corresponds to a core group in the processor;
[0038] Step S206, when the foreground application has frame drop behavior, selecting whether to perform a frequency modulation operation on the corresponding core group according to the key thread indicator, and generating a frequency modulation operation record after the frequency modulation operation;
[0039] Step S208, when the foreground application does not have frame drop behavior, select whether to perform a recovery operation on the corresponding core group according to the key thread indicator and the frequency modulation operation record generated by the last frequency modulation operation.
[0040] In an embodiment of the present application, through steps S202 to S208, the relevant parameters of the processor chip performance can be adjusted in real time according to the fluency of the foreground application, and the frequency modulation operation is tentatively performed when the foreground application drops frames, and the recovery operation is tentatively performed after the foreground application is smooth. This can solve the problem of setting the processor operating frequency for key scenarios in related technologies, resulting in insufficient performance output of the processor in other scenarios, and achieve the technical effect of constraining the chip performance output to save power consumption when the chip load is low, and releasing the chip performance output to ensure the smoothness of use of the smart terminal device when the chip load is high.
[0041] In some embodiments, before determining whether the foreground application has dropped frames through the internal monitoring thread in step S202, the method further includes:
[0042] Step S200, synchronizing the screen submission action of the foreground application to the processor core through the system call function syscall, wherein the screen submission action is used to submit the screen data of the foreground application to the screen; according to the screen submission action, opening or closing the internal monitoring thread.
[0043] In some embodiments, the internal monitoring thread is turned on or off according to the screen submission action in step S200, including: when the internal monitoring thread is turned off, if the screen submission action is detected, the internal monitoring thread is turned on; when the internal monitoring thread is turned on, if the screen submission action is detected, the internal monitoring thread is turned off.
[0044] In the present embodiment, the internal monitoring thread belongs to the Timer thread, which is a special type of thread used to execute tasks or code blocks at a fixed time. The Timer thread can repeat the task within a specified time interval, or it can execute the task after a specified time delay. The Timer thread is usually used for tasks that need to be executed regularly, such as timers, scheduled tasks, and periodic tasks. In the embodiment of the present application, the Timer thread is used to monitor the release of the submitted screen data by the foreground application.
[0045] In some embodiments, step S202 may include the following steps:
[0046] Step S2022, checking whether the screen submission action occurs at every preset monitoring polling period;
[0047] Step S2024, counting the number of polling times between two adjacent screen submission actions according to the polling check result;
[0048] Step S2026, when the polling number is greater than the preset maximum cycle number, determining that the foreground application has dropped frames;
[0049] Step S2028: When the polling number is less than or equal to the maximum cycle number, determine that the foreground application has no frame drop behavior.
[0050] In an exemplary embodiment, the preset monitoring polling cycle can be set to the interval time of the frame rate detection that the processor can perceive. Exemplarily, the monitoring polling cycle can be set to 4ms. The interval time between two adjacent frames can be determined based on the number of polling times between two adjacent screen submission actions, and then it can be determined whether the foreground application has dropped frames.
[0051] In an exemplary embodiment, if the normal frame rate of the foreground application is 120 Hz, the interval time between two adjacent frames is about 8 ms. Depending on the counting method, the corresponding polling times are 2 or 3. At this time, the preset maximum number of cycles can also be set to 2 or 3. If it exceeds this number, it means that the interval time between two adjacent frames has reached or even exceeded 12 ms, and the foreground application has dropped frames.
[0052] In some embodiments, the frequency adjustment operation record includes: an adjustment record of the maximum allowed frequency or the number of active cores of any core group in each frequency adjustment operation.
[0053] In some embodiments, the key thread indicators include the following three categories:
[0054] 1. The total running time of each core group, the running time of user tasks, and the running time of system tasks;
[0055] 2. The time that the critical thread is in the execution state or the waiting execution state;
[0056] 3. The number of instruction cycles of the processor core associated with the critical thread.
[0057] In this embodiment, the execution tasks on each processor core include user space applications, system programs, interrupt programs, idle execution programs, etc. The total running time (rtime_sum) of each core group is the total running time of these execution tasks. The running time of user tasks and the running time of system tasks can be combined and recorded as user+system_rtime. This group of indicators can reflect the busyness of user space applications and system programs to a certain extent.
[0058] In this embodiment, the statistical time related to the thread includes four parts of time: running (execution state), runnable (waiting for execution state), sleeping (sleeping state), and iowait (waiting for IO operation state). The time that the thread is in the execution state and the waiting for execution state can reflect the busy load of the current thread to a certain extent.
[0059] In this embodiment, the number of instruction cycles (Cycles Per Instruction, CPI for short) is a key indicator to measure the current load of the processor core. It indicates the average number of clock cycles required to execute each instruction, which can reflect the actual task load of the processor. The lower the CPI value, the more efficient the CPU is in executing instructions. Generally, a lower CPI value means that the CPU can execute instructions faster, thereby improving overall computing performance. The calculation formula for CPI is: CPI = total number of clock cycles to execute instructions / number of instructions executed. In an embodiment of the present application, the CPI indicator is used to evaluate the number of instructions actually submitted to the processor for execution by the key thread of the foreground application (such as a game), and is used to reflect the intensity of the performance requirements of the key threads of the game over a period of time.
[0060] In some embodiments, step S206 selects whether to perform a frequency modulation operation on the corresponding core group according to the key thread indicator, and generates a frequency modulation operation record after the frequency modulation operation, which may include the following steps:
[0061] Step S2062, obtaining the maximum allowed frequency and the number of active cores of the current core group;
[0062] Step S2064, selecting whether to adjust the number of active cores according to the key thread indicator;
[0063] Step S2066, selecting whether to adjust the maximum allowed frequency according to the key thread indicator without adjusting the number of active cores;
[0064] Step S2068, when adjusting the number of active cores or the maximum allowed frequency, record the adjusted number of active cores or the adjusted maximum allowed frequency to obtain the frequency modulation operation record, and put the frequency modulation operation record into an operation record queue.
[0065] In some embodiments, step S2064 selects whether to adjust the number of active cores according to the key thread indicator, and may include the following steps: determining whether the number of instruction cycles is less than the maximum allowed frequency to obtain a first judgment result; if the first judgment result is yes, determining whether the sum of the time the key thread is in the execution state and the waiting execution state is equal to the statistical time of the key thread in the current frame to obtain a second judgment result; if the second judgment result is no, determining the core group occupancy of user-class tasks and system-class tasks in the current core group according to the total running time, the running time of the user-class tasks, and the running time of the system-class tasks, and determining whether the core group occupancy is greater than a preset first threshold to obtain a third judgment result; if the second judgment result is yes or the third judgment result is yes, determining whether the total number of cores in the current core group is the same as the number of active cores to obtain a fourth judgment result; if the fourth judgment result is no, increasing the number of active cores by 1.
[0066] In an exemplary embodiment, the preset first threshold can be set to 80%, that is, when the occupancy rate of the core group by user-class and system-class tasks is greater than 80%, a core can be tentatively released. If the number of active cores has reached the maximum, the restriction on the operating frequency is tentatively released. This parameter can be flexibly set according to different chip platforms.
[0067] In some embodiments, step S2066 selects whether to adjust the maximum allowed frequency based on the key thread indicator without adjusting the number of active cores, and may include the following steps: when the first judgment result is no or the fourth judgment result is yes, determine whether the maximum allowed frequency is equal to a preset maximum frequency threshold; when the judgment result is no, increase the maximum allowed frequency by a preset ratio.
[0068] In this embodiment, frequency modulation of the core group may include increasing the number of active cores or increasing the maximum allowed frequency. When the chip load is high, the restrictions on the processor cores are tentatively opened to release chip performance output to ensure smooth use of the smart terminal device. The tentativeness of this solution is reflected in that each adjustment is controlled within a certain adjustment range. If the load is still large after adjustment, the frequency modulation operation can be continued to further release chip performance.
[0069] In some embodiments, step S208 selects whether to perform a recovery operation on the corresponding core group according to the key thread indicator and the frequency modulation operation record generated by the last frequency modulation operation, and may include the following steps:
[0070] Step S2082, popping the last frequency modulation operation record from the operation record queue;
[0071] Step S2084, when the frequency adjustment operation record is an adjustment record of the number of active cores, selecting whether to restore the number of active cores according to the key thread indicator;
[0072] Step S2086, when the frequency modulation operation record is an adjustment record of the maximum allowed frequency, selecting whether to restore the maximum allowed frequency according to the key thread indicator;
[0073] Step S2088, when the number of active cores or the maximum allowed frequency is restored, the corresponding frequency modulation operation record is deleted from the operation record queue.
[0074] In some embodiments, after popping the last frequency modulation operation record from the operation record queue in step S2082, the method further includes: obtaining the operating frequency of the current core group, and comparing whether the operating frequency is equal to a preset maximum frequency threshold; when the operating frequency is equal to the maximum frequency threshold, stopping the recovery operation on the current core group.
[0075] In this embodiment, the preset maximum frequency threshold is the maximum rated operating frequency that the processor core can reach. This parameter may be determined by the manufacturer of the processor, and the maximum frequency thresholds corresponding to processors of different models may be different.
[0076] In some embodiments, step S2084 selects whether to restore the number of active cores according to the key thread indicator when the frequency modulation operation record is an adjustment record of the number of active cores, and may include the following steps: determining the core group occupancy of user class tasks and system class tasks in the current core group according to the total running time, the running time of the user class tasks, and the running time of the system class tasks; when the core group occupancy is greater than a preset second threshold, stopping the restoration operation on the current core group; when the core group occupancy is less than or equal to the preset second threshold, restoring the current core group according to the adjustment record of the number of active cores.
[0077] In an exemplary embodiment, the preset second threshold can be set to 70%, that is, when the usage rate of the central processing unit (CPU) by user-class and system-class tasks is less than or equal to 70%, the condition of rolling back the operation record is met. This parameter can be flexibly set according to different chip platforms.
[0078] In some embodiments, in step S2086, when the frequency modulation operation record is an adjustment record of the maximum allowed frequency, whether to restore the maximum allowed frequency is selected according to the key thread indicator, and may include the following steps: obtaining the operating frequency of the current core group, and comparing the operating frequency with the maximum allowed frequency; when the operating frequency is greater than the maximum allowed frequency, stopping the restoration operation on the current core group; when the operating frequency is less than or equal to the maximum allowed frequency, restoring the current core group according to the adjustment record of the maximum allowed frequency.
[0079] In this embodiment, each time a FM operation record is restored in step S2088, a FM operation record is deleted. If the restoration operation needs to be continued, a new FM operation record will be taken out according to the order of the FM operation records in the operation record queue.
[0080] In the embodiment of the present application, through steps S2082 to S2088, the processor performance can be tentatively constrained when the processor core load is small, and the constraint method is based on the last frequency modulation operation record and reuses the processor performance parameters before the frequency modulation operation. The tentativeness of this solution is reflected in that each adjustment is controlled within a certain adjustment range. If the load is still small after adjustment, the recovery operation can be continued according to the last frequency modulation operation record.
[0081] In some embodiments, the method further includes: when frame drop occurs in the foreground application, placing a frame drop transaction processing task into the transaction processing thread, wherein the frame drop transaction processing task is used to select whether to perform frequency modulation operation on the corresponding core group according to the key thread indicator, and generate a frequency modulation operation record after the frequency modulation operation.
[0082] In some embodiments, the method further includes: when the foreground application does not experience frame drop behavior, placing an operation record recovery task into the transaction processing thread, wherein the operation record recovery task is used to select whether to perform a recovery operation on the corresponding core group based on the key thread indicator and the frequency modulation operation record generated by the last frequency modulation operation.
[0083] In some embodiments, the method further includes: when performing a frequency modulation operation on any of the core groups, sending the corresponding maximum allowed frequency or the number of active cores to a processor driver to complete the frequency modulation operation; when performing a recovery operation on any of the core groups, sending the corresponding maximum allowed frequency or the number of active cores to the processor driver to complete the recovery operation. Through this step, the target parameters to be adjusted in the frequency modulation operation or the recovery operation can be sent to the processor driver so that the target parameters take effect in the processor.
[0084] Through the embodiments of the present application, the relevant parameters of the processor chip performance can be adjusted in real time according to the fluency of the foreground application, and the performance output can be released or constrained. This can solve the problem of setting the processor operating frequency for key scenarios in related technologies, resulting in insufficient performance output of the processor in other scenarios. This can achieve the technical effect of constraining the chip performance output to save power consumption when the chip load is low, and releasing the chip performance output to ensure the smoothness of use of smart terminal devices when the chip load is high.
[0085] In the embodiment of the present application, a scheme is proposed to tentatively release the frequency limit or core limit on the core group according to the CPI data of the key thread, the running and runnable time of the key thread, the total running time of the core group, and the running time of the user class and system class tasks. The scheme can be customized according to the characteristics of different mobile phones on the native kernel. The processor frequency modulation scheme in the embodiment of the present application can be implemented as an independent module in the kernel. For example, the module can be called a frequency modulation module, but the present application does not limit this.
[0086] In one embodiment of the present application, a processor is provided for performing frequency modulation according to the steps in any method embodiment of the present application. Figure 3 is a structural block diagram of a processor according to an embodiment of the present application, such as Figure 3 As shown, the processor includes:
[0087] Frameworks 32 , kernel 34 and processor driver (CPU-Driver) 36 .
[0088] The Frameworks part contains most of the system services, including the rendering system sub-module BufferQueueProducer (image buffer producer). Within the framework, it can sense the entire action of an application submitting its own screen data. Based on this, the newly added system call function (syscall) in Frameworks can synchronize the action of the foreground application submitting screen data to the rendering system to the kernel's frequency modulation module.
[0089] The CPU-Driver part is the core module for operating processor actions in the Kernel. It connects to the control of the processor in the Kernel, including turning on or off the processor core, setting the maximum and minimum operating frequencies of the processor core, etc. In the implementation steps of this application, many key indicators need to be deeply related to the Kernel scheduler. Based on this, the implementation mechanism of this solution is implemented in the Kernel. With the help of the key indicators of the Kernel scheduler in the scheduling process, after comprehensive evaluation, the corresponding performance tuning instructions are given to the CPU-Driver.
[0090] A kernel (Kernel), including a frequency modulation module, is used to execute the steps in any method embodiment of the present application.
[0091] In this embodiment, the kernel is the core part of the operating system, responsible for managing the hardware and software resources of the computer. It is the interface between the operating system and the computer hardware, providing an interface for application programs to access hardware devices and system resources. The main functions of the kernel include process management, memory management, file system management, device driver management, and system scheduling.
[0092] In this embodiment, syscall is the abbreviation of system call, which is an interface provided by the operating system to the application. The application can request the operating system to perform specific functions or services through the system call, such as file operations, network communications, and process management. The system call allows the application to access the functions and resources of the operating system, such as hardware devices, file systems, and networks. The system call is usually triggered by a soft interrupt or a special machine instruction. The operating system will process the system call request in the kernel state and return the result to the application. The system call is a bridge between the operating system and the application. It provides a safe and controlled way for the application to use the functions of the operating system to complete various tasks.
[0093] In some embodiments, the framework may be an Android Framework, which includes a series of class libraries and APIs for handling various system-level tasks, such as user interface management, application management, resource management, data storage, network communication, multimedia processing, sensor management, etc. The BufferQueueProducer module is within this framework. Exemplarily, the present application may be applied to Android systems based on Kernel 5.0 and above.
[0094] In this embodiment, BufferQueueProducer is part of the Android graphics system. Its main function is to act as a producer of a graphics buffer queue and provide graphics buffers to consumers for display or processing. BufferQueueProducer is also responsible for handling the synchronization and exchange of graphics buffers to ensure smooth display of images. It can communicate with other graphics system components (such as SurfaceFlinger) to coordinate and synchronize the use and display of graphics buffers. The embodiment of the present application actively calls syscall to synchronize the foreground application to submit screen data to the rendering system with the help of this module.
[0095] The processor in this application can be applied to terminal devices such as mobile terminals and computer terminals, and the frequency can be adjusted according to the fluency of the foreground application. This can solve the problem of setting the processor operating frequency for key scenarios in related technologies, resulting in insufficient performance output of the processor in other scenarios. This can achieve the technical effect of constraining the chip performance output to save power consumption when the chip load is low, and releasing the chip performance output to ensure the smoothness of use of smart terminal devices when the chip load is high.
[0096] Figure 4 is a flow chart of a frequency modulation method of a processor in an embodiment of the present application, such as Figure 4 As shown, the process includes the following steps:
[0097] Step S1, in the key submodule BufferQueueProducer of Frameworks, each time the application performs QueueBuffer, the kernel is synchronized with the foreground application to submit the application screen data to the screen through syscall.
[0098] Step S2: After receiving the application synchronization information, the frequency modulation module performs frame drop determination based on the time point of the synchronized picture data submission and the time of the last picture data submission;
[0099] Step S3: If the application does not have frame drop behavior, post (transfer) the operation record recovery task to the transaction processing thread to restore the frequency limit or core limit state of the processor core before the frequency modulation operation;
[0100] Step S4, record the total running time (rtime_sum) of all core groups of the processor and the running time of user class and system class tasks (can be abbreviated as u+s_rtime);
[0101] Step S5, recording the current running time and runnable time of the key thread of the foreground application;
[0102] Step S6, recording the CPI value of the processor core associated with the key thread of the foreground application at this time;
[0103] Step S7: start the internal monitoring thread to monitor the behavior of the foreground application providing picture data to the screen again.
[0104] In this embodiment, QueueBuffer means that the foreground application needs to submit its own screen data to the screen, which needs to be synthesized by the rendering system. The so-called synthesis is to synthesize multiple layers into one. For example, when the game is running in the foreground, a small window application is hung. At this time, the foreground small window application will inevitably cover part of the game screen. The rendering system needs to synthesize these two interfaces together and finally display them on the screen.
[0105] In this embodiment, step S2 performs frame drop determination based on the time point of synchronously submitting the screen data and the time of the last submission of the screen data, and the determination may be performed in the internal monitoring thread.
[0106] In the embodiment of the present application, by actively discovering the frame dropping behavior of the foreground application, a comprehensive judgment is made based on the three levels of CPI index generated when the key thread of the application is executed, the proportion of the running / runnable time of the key thread, and the proportion of the user+system running time of the processor during the period of frame dropping, to accurately identify whether the frame dropping is caused by insufficient core performance. If the frame dropping behavior is caused by insufficient performance, the present application will actively and tentatively release the core limit or the frequency limit to ensure performance. And when the foreground application runs smoothly, it will actively and tentatively restore the previous core limit and frequency limit state to achieve the purpose of saving power and controlling the heating of the fuselage. A processor frequency modulation scheme with more sensitive response and better compatibility is implemented, so that the device can actively release the processor performance in user scenarios with high performance requirements, thereby enhancing the user experience.
[0107] Figure 5 is a schematic diagram of frame drop detection of an internal monitoring thread in an embodiment of the present application, such as Figure 5As shown, in the internal monitoring thread, a frame rate monitoring timer is started, and whether a screen submission action occurs is polled at every preset monitoring polling cycle.
[0108] In this embodiment, an important indicator for judging whether the foreground application is smooth is whether the application submits its own screen data to the rendering system according to the expected frame rate cycle requirements. If the time for the foreground application to submit its own screen data exceeds the frame rate cycle requirements, it means that the game has been stuck. How to distinguish whether the stuttering is caused by insufficient performance has become the key to this implementation step. Based on this, this application is driven by the stuttering or frame dropping behavior of the foreground application, and comprehensively judges the key indicators of the processor to identify whether there is insufficient performance at this time.
[0109] For example, taking the Qualcomm 8550 platform, if the foreground game application starts at 120 frames, if the foreground game application wants to maintain the full 120 frames, it must submit 120 pieces of its own picture data to the screen within 1 second, and the submission time of each frame cannot exceed 8ms. Taking the monitoring polling cycle of 4ms as an example, if the interval between two adjacent submission actions exceeds two polling cycles, it means that the frame is dropped. Figure 5 As shown in the figure, the arrow indicates that the application has dropped frames in this frame, and the application is 4ms late in submitting the game's own screen data in this frame. Therefore, through the internal monitoring thread, based on the monitoring polling cycle, polling times, and the maximum number of cycles corresponding to the expected frame rate, it can be judged whether the frame is dropped.
[0110] Figure 6 : is a flowchart of frame drop detection of an internal monitoring thread in an embodiment of the present application, such as Figure 6 As shown, the process includes the following steps:
[0111] Step S602, determine whether the value of the counter is greater than max_tc (maximum number of cycles);
[0112] Step S604, exit and set the timer cycle again;
[0113] Step S606: Push the frame drop transaction processing task to the transaction processing thread.
[0114] In this embodiment, the internal monitoring thread actually starts a frame rate monitoring timer and a counter.
[0115] In this embodiment, the monitoring thread performs polling checks according to a preset monitoring polling cycle to check whether the foreground application thread submits the screen data to the rendering system. Exemplarily, the polling checks can be performed at a cycle of 4 ms.
[0116] In this embodiment, counter is the value of the counter (equivalent to the number of polling times), and max_tc is the maximum number of cycles corresponding to the application frame rate. For example, if the game has 120 frames, the interval between each frame is 8ms, and we use 4ms polling as a cycle, its max_tc cannot be greater than or equal to 4; if it is greater than or equal to 4, the application must have dropped frames and the interface is stuck. When the application drops frames, the frame drop transaction processing task will be posted to the transaction processing thread.
[0117] In this embodiment, after the counter exceeds the maximum number of cycles, the cycle of the timer and the counter are restarted.
[0118] Through the embodiments of the present application, the smoothness of the foreground application can be judged according to the action of the foreground application submitting the screen data, and whether each frame of data has frame drops can be detected in time.
[0119] Figure 7 FIG. 1 is a processing flow chart after the foreground application submits screen data in an embodiment of the present application. Figure 7 As shown, the process includes the following steps:
[0120] Step S701, the foreground application starts QueueBuffer (queue buffer);
[0121] Step S702, determining whether the foreground application has dropped frames;
[0122] In this embodiment, the timer_pending function can be used to determine whether the timer is in a suspended state. If the timer is in a suspended state, the function returns a non-zero value; otherwise, it returns 0.
[0123] Step S703, determining whether there is an operation record in the operation record queue;
[0124] Step S704, deciding whether to release the core restriction or the frequency restriction;
[0125] Step S705, stop the timer;
[0126] Step S706, recording rtime_sum and u+s_rtime of the current three core groups;
[0127] Step S707, recording the current running time and runnable time of the key thread of the foreground application;
[0128] Step S708, recording the CPI value of the CPU at this time;
[0129] Step S709, start the timer (interval time = 4ms).
[0130] In this embodiment, if step S702 determines that the application has no frame drops, step S703 is executed. If step S703 detects that there are operation records in the operation record queue, step S704 is executed. After step S702 / step S703 / step S704 are executed, step S705 is executed to stop the timer.
[0131] In this embodiment, what is recorded in step S708 is the CPI value of the processor associated with the key thread of the foreground application. By recording the CPI value of the CPU, it is possible to understand how much code the foreground application has submitted. At step S708, operations such as mark cleaning can be performed (when cleaning, it is necessary to pay attention to the fact that the key thread without the foreground application is currently in the execution state). The actual calculation of CPI is when the CPU context switches.
[0132] In this embodiment, steps S701 to S709 all occur after the foreground application submits the screen data. Through this embodiment of the application, the key thread indicators when the frame drop occurs can be recorded, and then in the frame drop transaction processing task, it can be determined whether to open the core limit or frequency limit according to these key thread indicators.
[0133] Figure 8 FIG. 1 is a flowchart of an operation record recovery task in an embodiment of the present application. Figure 8 As shown, the process includes the following steps:
[0134] Step S801, pop the last frequency modulation operation record (from the operation record queue);
[0135] Specifically, the frequency adjustment operation record may be an adjustment record of the number of active cores core_nums of the current core group or an adjustment record of the maximum allowed frequency cluster_max_freq.
[0136] Step S802, determining whether the operating frequency cur_freq of the current core group is equal to the maximum frequency threshold max_freq;
[0137] Step S803, determining whether the operation record is a core opening operation;
[0138] Step S804, determine whether cur_freq is greater than cluster_max_freq;
[0139] Step S805, restore cluster_max_freq;
[0140] Step S806, calculating the core group occupancy usage of the user tasks and system tasks in the most recent frame;
[0141] Specifically, usage is the ratio of the running time u+s_rtime of the user class tasks and system class tasks of the current core group to the total running time rtime_sum.
[0142] Step S807, determining whether usage is greater than or equal to 70%;
[0143] Specifically, 70% in this step corresponds to the preset second threshold in the above embodiment, and the present application does not limit the specific value of this threshold.
[0144] Step S808, restore core_nums;
[0145] Step S809, deleting the corresponding frequency modulation operation record from the operation record queue to release space.
[0146] In this embodiment, if the judgment result of step S802 is no, step S803 is executed, and if it is yes, the recovery operation on the current core group is stopped. If the judgment result of step S804 is no, step S805 is executed, and if it is yes, the recovery operation on the current core group is stopped. If the judgment result of step S807 is no, step S808 is executed, and if it is yes, the recovery operation on the current core group is stopped. After step S805 and step S808, step S809 is executed.
[0147] In some embodiments, step S807 determines whether the usage is greater than or equal to 70%. It is considered that the determination condition is met only if the CPU occupancy rate of user-class and system-class tasks of any core in the core group reaches 70%.
[0148] In this embodiment, when the CPU occupancy rate of user+system tasks is lower than 70%, the condition of rolling back the operation record is met. Exemplarily, after the data is rolled back, the debugging node can be released in the Linux file system, which can be adjusted according to different platforms.
[0149] In an embodiment of the present application, the key performance parameters of the core group can be restored by executing the operation record recovery task. When the processor core load is small, the restrictions on the core are reduced, and energy saving is achieved while ensuring the smoothness of the foreground application.
[0150] Fig. 9 FIG. 1 is a flowchart of a frame drop transaction processing task in an embodiment of the present application. Fig. 9 As shown, the process includes the following steps:
[0151] Step S901, it is found that the foreground application has dropped a frame in this frame;
[0152] Step S902, calculating the CPI of the key thread of the foreground application of this frame forward;
[0153] Step S903, determining whether the CPI of the critical thread is greater than or equal to the maximum allowed frequency cluster_max_freq;
[0154] Step S904, calculate the running / runnable time ratio of the key thread of the game frame before;
[0155] Step S905, determining whether the sum of running and runnable is equal to the statistical time of this frame;
[0156] Step S906, calculating the running time u+s_rtime of the user+system tasks of each core during the frame drop period;
[0157] Step S907, determine whether the ratio of u+s_rtime to rtime_sum (total running time) is greater than 80%;
[0158] Step S908, determine whether the ratio of u+s_rtime to rtime_sum is greater than 90% and cur_freq is equal to max_freq;
[0159] Step S909, determine whether the number of cores Cluster-nr_core of the current core group is 1;
[0160] Step S910, determining whether the total number of cores Online_cpu in the current core group is the same as the number of active cores active_cpu (ie, core_nums);
[0161] Step S911, try to release one core (i.e., the maximum number of cores plus 1);
[0162] Step S912, determining whether the operating frequency cur_freq of the current core group is equal to the preset maximum frequency threshold max_freq;
[0163] Step S913, increasing cluster_max_freq by 20% based on the currently limited max_freq;
[0164] Step S914: After the operation is completed, the operation record is pushed into the stack.
[0165] In this embodiment, the ratio of u+s_rtime to rtime_sum (total running time) is also called the CPU occupancy rate (usage) of user-type tasks and system-type tasks. The 80% in step S907 is the preset first threshold in the above embodiment. The threshold can be set according to the differences in chip platforms, and this application does not impose any restrictions on this.
[0166] In some embodiments, there may be a situation where the usage reaches 90%, but the working frequency of a single core is not fully utilized. In this case, there is still room for performance, and the core may not be adjusted. Therefore, step S908 is designed, and if the judgment is no, the frequency adjustment operation is not performed.
[0167] In some embodiments, when the foreground application runs at full load, its operating frequency deviation is the same as the maximum allowed frequency of the current core group. Therefore, the current maximum allowed frequency may also be used for determination in step S912.
[0168] In this embodiment, both step S909 and step S910 are for determining whether the current core group has any cores that have not been released. For example, some core groups may contain only one core, and the number of cores cannot be adjusted.
[0169] In this embodiment, step S913 is used to increase the maximum allowed frequency of the current core group. The adjustment range of this parameter can be increased by a preset ratio based on max_freq or the current cluster_max_freq. 20% is only used as an example, and this application is not limited to this.
[0170] In this embodiment, the stacking process in step S914 is the process of storing the operation record in the operation record queue in the above embodiment, and the operation record includes the adjustment record of the maximum allowed frequency or the number of active cores.
[0171] The tentative nature of the embodiments of the present application is that when the game is found to have frame drops, if it is comprehensively judged that the conditions for lifting the core limit are met, the cores of the core group will be released one by one, one core at a time; when all the cores in the core group are ready to receive tasks, the max_freq of the corresponding core group will be tried to be relaxed by a preset ratio based on the currently limited max_freq.
[0172] Through the embodiments of the present application, tentative frequency modulation operations can be implemented. When the processor core load is large, the restrictions on the core are released to improve the fluency of the foreground application, thereby improving the user experience. The present application implements a more flexible processor performance tuning method in the actual user usage scenario. When the user encounters higher actual performance requirements in the actual user usage scenario, the processor performance is flexibly adjusted (the core and core frequency are adjusted) to ensure the smoothness of the foreground application execution and improve the user experience.
[0173] An embodiment of the present application further provides a processor, which is used to perform frequency modulation according to the steps in any of the above method embodiments.
[0174] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program executes the steps of any of the above method embodiments when executed by a processor.
[0175] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.
[0176] An embodiment of the present application further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0177] In an exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.
[0178] For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementation modes, and this embodiment will not be described in detail herein.
[0179] Obviously, those skilled in the art should understand that the above modules or steps of the present application can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present application is not limited to any specific combination of hardware and software.
[0180] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the principles of the present application shall be included in the protection scope of the present application.
Claims
1. A frequency modulation method for a processor, characterized in that: The method comprises: Use the internal monitoring thread to determine whether the foreground application has dropped frames; Recording multiple groups of key thread indicators generated during the execution of the key thread of the foreground application, wherein each group of the key thread indicators corresponds to a core group in the processor; In the case where the foreground application has frame drop behavior, selecting whether to perform a frequency modulation operation on the corresponding core group according to the key thread indicator, and generating a frequency modulation operation record after the frequency modulation operation; In the case that the foreground application does not drop frames, whether to perform a recovery operation on the corresponding core group is selected according to the key thread indicator and the frequency modulation operation record generated by the last frequency modulation operation.
2. The method according to claim 1, characterized in that Before determining whether the foreground application has dropped frames through the internal monitoring thread, the method further includes: Synchronizing the screen submission action of the foreground application to the processor core through a system call function syscal l, wherein the screen submission action is used to submit the screen data of the foreground application to the screen; The internal monitoring thread is opened or closed according to the screen submission action.
3. The method according to claim 2, characterized in that According to the screen submission action, the internal monitoring thread is opened or closed, including: When the internal monitoring thread is closed, if the screen submission action is detected, opening the internal monitoring thread; When the internal monitoring thread is enabled, if the screen submission action is detected, the internal monitoring thread is disabled.
4. The method according to claim 2, characterized in that: Use the internal monitoring thread to determine whether the foreground application has dropped frames, including: At each preset monitoring polling cycle, checking whether the screen submission action occurs; Count the polling times between two adjacent screen submission actions according to the polling check result; When the polling number is greater than a preset maximum cycle number, determining that the foreground application has dropped frames; When the polling number is less than or equal to the maximum cycle number, it is determined that no frame dropping occurs in the foreground application.
5. The method according to claim 1, characterized in that The frequency modulation operation record includes: an adjustment record of the maximum allowed frequency or the number of active cores of any core group in each frequency modulation operation.
6. The method according to claim 5, characterized in that The key thread indicators include: The total running time of each core group, the running time of user tasks, and the running time of system tasks; The time during which the critical thread is in the execution state or the waiting execution state; The number of instruction cycles of the processor core associated with the critical thread.
7. The method according to claim 6, characterized in that Whether to perform a frequency modulation operation on the corresponding core group is selected according to the key thread indicator, and a frequency modulation operation record is generated after the frequency modulation operation, including: Obtaining the maximum allowed frequency and the number of active cores of the current core group; Selecting whether to adjust the number of active cores according to the key thread indicator; Without adjusting the number of active cores, selecting whether to adjust the maximum allowed frequency according to the key thread indicator; In case of adjusting the number of active cores or the maximum allowed frequency, the adjusted number of active cores or the adjusted maximum allowed frequency is recorded to obtain the frequency modulation operation record, and the frequency modulation operation record is put into an operation record queue.
8. The method according to claim 7, characterized in that Selecting whether to adjust the number of active cores according to the key thread indicator includes: Determine whether the instruction cycle number is less than the maximum allowed frequency to obtain a first determination result; If the first judgment result is yes, determine whether the sum of the time that the key thread is in the execution state and the waiting execution state is equal to the statistical time of the key thread in the current frame to obtain a second judgment result; If the second judgment result is no, determining the core group occupancy rates of the user class tasks and the system class tasks in the current core group according to the total running time, the running time of the user class tasks, and the running time of the system class tasks, and judging whether the core group occupancy rates are greater than a preset first threshold, to obtain a third judgment result; When the second judgment result is yes or the third judgment result is yes, judging whether the total number of cores in the current core group is the same as the number of active cores, and obtaining a fourth judgment result; When the fourth determination result is no, the number of active cores is increased by 1.
9. The method according to claim 8, characterized in that In the case where the number of active cores is not adjusted, selecting whether to adjust the maximum allowed frequency according to the key thread indicator includes: When the first judgment result is no or the fourth judgment result is yes, determining whether the maximum allowed frequency is equal to a preset maximum frequency threshold; If the judgment result is no, the maximum allowed frequency is increased by a preset ratio.
10. The method according to claim 6, characterized in that Selecting whether to perform a recovery operation on a corresponding core group according to the key thread indicator and the frequency modulation operation record generated by the last frequency modulation operation includes: Pop the last frequency modulation operation record from the operation record queue; In a case where the frequency modulation operation record is an adjustment record of the number of active cores, selecting whether to restore the number of active cores according to the key thread indicator; In the case where the frequency modulation operation record is an adjustment record of the maximum allowed frequency, selecting whether to restore the maximum allowed frequency according to the key thread indicator; When the number of active cores or the maximum allowed frequency is restored, the corresponding frequency adjustment operation record is deleted from the operation record queue.
11. The method according to claim 10, characterized in that After popping the last frequency modulation operation record from the operation record queue, the method further includes: Obtaining the operating frequency of the current core group, and comparing whether the operating frequency is equal to a preset maximum frequency threshold; When the operating frequency is equal to the maximum frequency threshold, the recovery operation on the current core group is stopped.
12. The method according to claim 10, characterized in that In a case where the frequency modulation operation record is an adjustment record of the number of active cores, selecting whether to restore the number of active cores according to the key thread indicator includes: Determine the core group occupancy rate of the user class tasks and the system class tasks in the current core group according to the total running time, the running time of the user class tasks and the running time of the system class tasks; When the core group occupancy rate is greater than a preset second threshold, stopping the restoration operation on the current core group; When the core group occupancy rate is less than or equal to the preset second threshold, a recovery operation is performed on the current core group according to the adjustment record of the number of active cores.
13. The method according to claim 10, characterized in that In a case where the frequency modulation operation record is an adjustment record of the maximum allowed frequency, selecting whether to restore the maximum allowed frequency according to the key thread indicator includes: Obtaining the operating frequency of the current core group, and comparing the operating frequency with the maximum allowed frequency; When the operating frequency is greater than the maximum allowed frequency, stopping the recovery operation on the current core group; When the operating frequency is less than or equal to the maximum allowed frequency, a recovery operation is performed on the current core group according to the adjustment record of the maximum allowed frequency.
14. The method according to claim 5, characterized in that The method further comprises: When performing a frequency modulation operation on any of the core groups, the corresponding maximum allowed frequency or the number of active cores is sent to a processor driver to complete the frequency modulation operation; When a recovery operation is performed on any of the core groups, the corresponding maximum allowed frequency or the number of active cores is sent to the processor driver to complete the recovery operation.
15. A processor, characterized in that: Used for performing frequency modulation according to the method described in any one of claims 1 to 14.
16. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, wherein the computer program executes the method described in any one of claims 1 to 14 when executed by a processor.
17. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to perform the method according to any one of claims 1 to 14.