CPU frequency determination method and device and electronic equipment
By dynamically adjusting the CPU frequency range, the problem of excessive power consumption or insufficient performance caused by the inability to dynamically adjust the CPU frequency in electronic devices is solved, and more efficient performance is achieved and lower power consumption.
Patent Information
- Application Number
- CN202411537583.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-30
- Publication Date
- 2025-02-11
AI Technical Summary
In the prior art, electronic devices cannot dynamically adjust the CPU frequency range, resulting in problems of excessive power consumption or insufficient performance.
By determining the application type, target frame rate and frame delay parameters of the target application, dynamically adjust the CPU frequency range to meet the real-time performance requirements of the application.
It realizes dynamic adjustment of the CPU frequency range according to actual needs, reduce power consumption, improve performance, extend the battery life of the device, and improve user experience.
Smart Images

Figure CN119415259A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to but is not limited to the field of information technology, and in particular to a method, device and electronic device for determining CPU frequency. Background Art
[0002] Different applications running in electronic devices have different requirements for central processing unit (CPU) resources. In related technologies, the CPU frequency range control of applications is often based on static configuration. Each application has its own CPU frequency range static configuration file. By parsing the static configuration file of the application, the corresponding hardware resources are allocated according to the CPU frequency range.
[0003] Since the configuration is static, the electronic device cannot dynamically adjust the CPU frequency range, which may result in excessive power consumption or insufficient performance of the electronic device. Summary of the invention
[0004] In view of this, the embodiments of the present application at least provide a method, device and electronic device for determining CPU frequency.
[0005] The technical solution of the embodiment of the present application is implemented as follows:
[0006] The present application provides a method for determining CPU frequency, including:
[0007] determining an application type of a target application running in the electronic device;
[0008] Determining a target frame rate corresponding to an application type of the target application;
[0009] Determine frame delay parameters for the target application;
[0010] Determine the CPU frequency range corresponding to the target application based on the target frame rate and frame delay parameters.
[0011] The embodiment of the present application provides a CPU frequency determination device, including:
[0012] A first determination module, used to determine the application type of a target application running in the electronic device;
[0013] A second determination module is used to determine a target frame rate corresponding to an application type of a target application;
[0014] A third determination module, used to determine a frame delay parameter of a target application;
[0015] The fourth determination module is used to determine the CPU frequency range corresponding to the target application according to the target frame rate and frame delay parameters.
[0016] An embodiment of the present application provides an electronic device, including a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and the processor can execute the computer program to implement the above-mentioned CPU frequency determination method.
[0017] An embodiment of the present application provides a computer-readable storage medium, which stores a computer program. The computer program can be executed by a processor to implement the above-mentioned CPU frequency determination method.
[0018] An embodiment of the present application provides a computer program, including a computer-readable code. When the computer-readable code is executed in a computer device, a processor in the computer device executes some or all of the steps for implementing the above-mentioned CPU frequency determination method.
[0019] An embodiment of the present application provides a computer program product, including a computer program or instructions. When the computer program or instructions are executed by a processor, some or all of the steps in the above-mentioned CPU frequency determination method are implemented.
[0020] It should be understood that the above general description and the following detailed description are merely exemplary and explanatory, and are not intended to limit the technical solutions of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1A A schematic diagram of a process of controlling CPU frequency range by using a static configuration-based method in the related art;
[0022] Figure 1B A schematic diagram showing an actual demand curve of a CPU frequency that changes over time in the related art;
[0023] Figure 1C A schematic diagram of a CPU determination method according to an embodiment of the present application;
[0024] Figure 1D A schematic diagram of an operation flow based on a buffer queue in the related art;
[0025] Figure 1E A schematic diagram showing an actual demand curve of CPU frequency varying with time provided in an embodiment of the present application;
[0026] Figure 2A A schematic diagram of the architecture of a CPU frequency control system provided in an embodiment of the present application;
[0027] Figure 2B A second schematic diagram of an implementation flow of a CPU determination method provided in an embodiment of the present application;
[0028] Figure 2CA schematic diagram comparing the effects of static CPU frequency configuration and dynamic CPU frequency control provided in an embodiment of the present application;
[0029] Figure 3 A schematic diagram of the structure of a CPU determination device provided in an embodiment of the present application;
[0030] Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0031] In order to make the purpose, technical solutions and advantages of the present application clearer, the technical solutions of the present application are further elaborated in detail below in conjunction with the drawings and embodiments. The described embodiments should not be regarded as limiting the present application. All other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.
[0032] In the following description, the terms "first / second / third" involved are merely used to distinguish similar objects and do not represent a specific ordering of the objects. It is understandable that "first / second / third" can be interchanged with a specific order or sequence where permitted, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein. Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by technicians in the technical field to which this application belongs. The terms used herein are only for the purpose of describing this application and are not intended to limit this application. It should also be noted that, for ease of description, only the parts related to the relevant application are shown in the accompanying drawings.
[0033] For example, the process of controlling the CPU frequency range in a static configuration-based manner in the related art is as follows: Figure 1A shown.
[0034] When an application is running in an electronic device, the system service component in the operating system is used to start and manage various services in the system to start and manage system-level services related to running applications, such as managing the life cycle of scheduled applications and controlling the power status of the device; the scene identifier is used to identify the frame rate corresponding to the current scene; the Hint Manager in the performance and power consumption system service component is used to allocate and manage resources based on the static configuration file of the application to complete the control of the CPU frequency range. Among them, the Hint Manager is the core virtual optical drive of the entire performance and power consumption system service, which is used to parse the configuration file and then allocate hardware resources according to the actual needs of the upper architecture of the operating system, thereby optimizing the performance and power consumption of the operating system and electronic devices.
[0035] Figure 1AThe static configuration files of Game 1 and Game 2 respectively show the maximum and minimum frequencies corresponding to different CPU cores, i.e., the CPU frequency range. After the prompt manager allocates CPU resources according to the static configuration file 10, the frequency range of CPU core 11 is not less than 400MHz and not more than 1800MHz, the frequency range of CPU core 12 is not less than 800MHz and not more than 1800MHz, and the frequency range of CPU core 13 is not less than 2000MHz and not more than 3050MHz; after the prompt manager allocates CPU resources according to the static configuration file 20, the frequency range of CPU core 21 is not less than 400MHz and not more than 1800MHz, the frequency range of CPU core 22 is not less than 800MHz and not more than 1600MHz, and the frequency range of CPU core 23 is not less than 2000MHz and not more than 2850MHz.
[0036] In some embodiments, core 11 and core 21 may be small cores in the CPU core, i.e., energy-efficient cores; core 13 and core 23 may be large cores in the CPU core, i.e., high-performance cores; core 12 and core 22 may be cores in the CPU core that achieve a balance between performance and power consumption.
[0037] However, since the configuration is static, electronic devices cannot dynamically adjust the CPU frequency range according to actual needs, which may lead to excessive power consumption or insufficient performance of electronic devices. Moreover, each application needs to adapt its own CPU frequency range according to its own static configuration, which is a lot of work.
[0038] For example, Figure 1B As shown, the ordinate value of the actual demand curve 30 of the CPU frequency that changes with time may exceed the upper limit 31 of the CPU frequency in the static configuration, or may be lower than the lower limit 32 of the CPU frequency in the static configuration. When the actual demand exceeds the upper limit of the CPU frequency, the system performance may not meet the current demand of the application, affecting the user experience; when the actual demand is lower than the lower limit of the CPU frequency, part of the actual power consumption will be wasted, thereby wasting device resources.
[0039] Therefore, under the premise of meeting the performance requirements of various applications, in order to further reduce the power consumption of the device, improve the battery life of the electronic device, and alleviate heat dissipation problems, a method that can dynamically adjust the CPU frequency range is needed.
[0040] On this basis, the embodiment of the present application provides a CPU frequency determination method, which can be applied to electronic devices. The electronic devices may refer to devices with data processing capabilities such as servers, laptops, tablet computers, desktop computers, smart TVs, set-top boxes, mobile devices (such as mobile phones, portable video players, personal digital assistants, dedicated messaging devices, portable gaming devices), etc.
[0041] like Figure 1C As shown, the CPU frequency determination method includes the following steps S101 to S104:
[0042] Step S101: Determine the application type of a target application running in an electronic device.
[0043] Here, the target application may be an application currently running in the electronic device, and may include but is not limited to at least one of a system application, an office application, a game application, and the like.
[0044] In some implementations, the application type of the target application may be determined when the target application is started.
[0045] For example, after starting the target application, the application type of the target application can be determined; then based on the application type of the target application, hardware resources can be allocated; wherein the hardware resources can include but are not limited to at least one of a CPU, a graphics processing unit (GPU), storage space, etc.
[0046] Application types may include, but are not limited to, system type, game type, video type, music type, office type, etc.
[0047] In some implementations, the application type of the target application may be determined based on the data type of the target application.
[0048] For example, when the data of the target application includes documents and images, it can be determined that the application type of the target application is an office application.
[0049] For another example, when the data of the target application includes video and audio, the application type of the target application may be determined to be an audio-visual application.
[0050] Step S102: Determine a target frame rate corresponding to the application type of the target application.
[0051] Here, the target frame rate may be a preset frame rate corresponding to the application type. When the display module of the electronic device displays images based on the preset frame rate corresponding to the application type, timely response speed and smooth image display can be provided to the user.
[0052] In some implementations, different application types may correspond to different target frame rates.
[0053] For example, for gaming applications and video applications that require high picture smoothness and / or high response speed, the target frame rate can be preset to 60Hz, 120Hz, etc.; for music playback applications that do not require high picture smoothness and / or high response speed, the target frame rate can be preset to 30Hz, 40Hz, etc.
[0054] Step S103: Determine the frame delay parameter of the target application.
[0055] Here, the frame delay parameter may be a parameter that can characterize the demand of the current frame of the target application on the CPU.
[0056] In some implementations, the time interval from when a frame of image is generated to when the frame of image is displayed on the display module may be determined as a frame delay parameter.
[0057] In some implementations, the CPU demand of the current frame can be calculated in real time based on the application's operation on the buffer queue. Figure 1D As shown, the target application or GPU can act as a producer 40 to first obtain a free buffer from the buffer queue 50 through a dequeue operation, render the data to fill the buffer, and then put the buffer back into the buffer queue 50 through an enqueue operation; the buffer queue 50 then notifies the consumer 60 to obtain the buffer, waits for the image to be synthesized, then releases the buffer, and puts the buffer back into the buffer queue 50; wherein the consumer 60 may include a graphics processing component for synthesizing and displaying the image.
[0058] refer to Figure 1D For the operation of the buffer queue 50, it can be seen that the frame delay includes the delay of the producer part and the delay of the consumer part. When the CPU frequency is low, the CPU may not be able to process the computing task in time, resulting in increased frame delay. Therefore, the delay of the CPU part, that is, the delay of the consumer part, can be calculated by the difference between the time when the buffer is put into the buffer queue by the producer, that is, the time when it is waiting to be taken out by the consumer, and the time when the buffer is taken out of the buffer queue by the consumer.
[0059] For example, the process of calculating the time difference between when the buffer is put into the buffer queue and when it is taken out of the buffer queue can refer to formula (1):
[0060] duration=queueStart-dequeueEnd(1);
[0061] Among them, duration is the time difference between the buffer being put into the buffer queue and being taken out of the buffer queue, that is, the frame delay parameter of the CPU part, which takes a positive value, queueStart is the moment when the buffer is put into the buffer queue by the producer, and dequeueEnd is the moment when the buffer is taken out of the buffer queue by the consumer.
[0062] Step S104: Determine a CPU frequency range corresponding to the target application according to the target frame rate and frame delay parameters.
[0063] Here, according to the target frame rate and the frame delay parameter at the current moment, the CPU frequency range corresponding to the target application to be adjusted in the next step is determined. The CPU frequency may include the frequency range of each CPU core or processor.
[0064] In some implementations, the CPU frequency range corresponding to the target application that needs to be adjusted in the next step can be determined based on the target frame rate and frame delay parameters, as well as the CPU frequency range corresponding to the target application at the current moment. In this way, the adjustment of the CPU frequency range can be smoothly transitioned, and based on the CPU frequency range corresponding to the target application at the current moment, the adaptability of the CPU frequency range corresponding to the target application at the next moment to the current scene can be improved.
[0065] For example, Figure 1E As shown, the ordinate value of the actual demand curve 30 of the CPU frequency that changes with time is between the upper limit 34 of the dynamically adjusted CPU frequency and the upper limit 35 of the dynamically adjusted CPU frequency.
[0066] In an embodiment of the present application, the application type of the target application running in the electronic device and the target frame rate corresponding to the application type are determined; the frame delay parameter corresponding to the target application is determined, and the CPU frequency range corresponding to the target application is determined based on the target frame rate and the frame delay parameter. In this way, on the one hand, the CPU frequency range of the electronic device can be dynamically adjusted based on real-time frame delay feedback to adapt to the real-time performance requirements of the target application; on the other hand, since the performance requirements of each type of application are relatively similar, the target frame rate corresponding to the application type of the target application is controlled, and there is no need for each application to adapt to its own CPU frequency range, that is, each type of application shares a set of configurations, which can reduce the workload while meeting the requirements of different applications of the same type, improve the working efficiency of the electronic device, and further improve the user experience.
[0067] In some embodiments, the above step S104 may include the following steps S111 to S112:
[0068] Step S111: Determine a frame delay error parameter of a target application according to a target frame rate and a frame delay parameter.
[0069] Here, the frame delay error parameter may be a parameter capable of characterizing the difference between the target frame delay and the actual frame delay of the current frame.
[0070] Step S112: Determine a CPU frequency range corresponding to the target application according to the frame delay error parameter.
[0071] Here, based on the frame delay error parameter, the difference between the CPU frequency range corresponding to the current target application and the CPU frequency range that meets the actual requirements of the target application can be determined, and further based on the difference, the CPU frequency range that meets the actual requirements of the target application can be determined.
[0072] In the embodiment of the present application, the frame delay error parameter of the target application is determined according to the target frame rate and the frame delay parameter; and then the CPU frequency range corresponding to the target application is determined according to the frame delay error parameter. In this way, based on the frame delay error parameter, the accuracy of determining whether the CPU frequency range meets the actual needs of the target application can be improved, further improving the user experience.
[0073] In some embodiments, the above step S111 may include the following steps S121 to S122:
[0074] Step S121: Determine a target delay parameter according to a target frame rate.
[0075] Here, the target delay parameter may be a target frame delay corresponding to a target frame rate.
[0076] In some implementations, the target delay parameter may be determined according to the target frame rate. For example, the process of determining the target delay parameter may refer to formula (2):
[0077]
[0078] Among them, DurationT is the target delay parameter, and TargetFPS is the target frame rate.
[0079] Step S122: Determine a frame delay error parameter according to the difference between the target delay parameter and the frame delay parameter.
[0080] Exemplarily, the process of determining the frame delay error parameter may refer to formula (3):
[0081] Error=DurationT-duration(3);
[0082] Among them, Error is the frame delay error parameter.
[0083] In the embodiment of the present application, the target delay parameter is determined according to the target frame rate; and the frame delay error parameter is determined according to the difference between the target delay parameter and the frame delay parameter. In this way, based on the difference between the target frame delay parameter and the actual frame delay parameter, the accuracy of the obtained frame delay error can be improved, and the accuracy of determining the CPU frequency range can be further improved.
[0084] In some embodiments, the above step S104 may include the following steps S131 to S132:
[0085] Step S131: Determine a CPU frequency adjustment parameter corresponding to the target application at time t+1 according to the configuration parameter corresponding to the target application and the frame delay error parameter corresponding to time t.
[0086] Here, the configuration parameters may include but are not limited to at least one of an upper threshold and a lower threshold of CPU frequency control, a control parameter, a window size of a frame delay, and the like.
[0087] In some embodiments, a Proportion Integral Differential (PID) algorithm can be used to determine the CPU frequency range corresponding to the target application according to the target frame rate and frame delay parameters; the control parameters in the configuration parameters can include the proportional parameter, integral parameter, and differential parameter in the PID algorithm. For example, the proportional parameter can be expressed as PID_P, the integral parameter can be expressed as PID_I, and the differential parameter can be expressed as PID_D.
[0088] The CPU frequency adjustment parameter may be a parameter used to adjust the CPU frequency corresponding to the next moment of the current moment.
[0089] In some implementations, when a PID algorithm is used for PID control, the configuration parameters include a proportional parameter, an integral parameter, and a differential parameter. The proportional adjustment parameter, the integral adjustment parameter, and the differential adjustment parameter can be calculated according to the frame delay error parameter and the proportional parameter, the integral parameter, and the differential parameter, respectively, and then the CPU frequency adjustment parameter is determined according to the proportional adjustment parameter, the integral adjustment parameter, and the differential adjustment parameter.
[0090] For example, the process of calculating the proportional adjustment parameter pOut according to the frame delay error parameter and the proportional parameter can be referred to in formula (4):
[0091] pOut = Error * PID_P (4);
[0092] The process of calculating the integral adjustment parameter iOut according to the frame delay error parameter and the integral parameter can be seen in formula (5):
[0093]
[0094] The process of calculating the differential adjustment parameter dOut according to the frame delay error parameter and the differential parameter can be seen in formula (6):
[0095]
[0096] Among them, Now is the current time, which can correspond to the tth time in the above CPU frequency determination method, Error is the frame delay error parameter corresponding to Now, lastTime is the previous time, that is, the t-1th time, and lastError is the frame delay error parameter corresponding to lastTime.
[0097] In some implementations, the CPU frequency adjustment parameter may be determined according to the sum of a proportional adjustment parameter, an integral adjustment parameter, and a derivative adjustment parameter.
[0098] For example, the process of determining the CPU frequency adjustment parameter may refer to formula (7):
[0099] PidOutput=pOut+iOut+dOut(7);
[0100] Wherein, PidOutput is the CPU frequency adjustment parameter corresponding to the next moment, that is, the moment t+1 in the above CPU frequency determination method.
[0101] Step S132: Determine the CPU frequency range corresponding to the target application at time t+1 according to the CPU frequency adjustment parameter corresponding to the target application at time t+1 and the CPU frequency range corresponding to time t.
[0102] Here, the CPU frequency adjustment parameter corresponding to the target application at time t+1 may be used to adjust the CPU frequency range corresponding to time t, and further obtain the CPU frequency range corresponding to the target application at time t+1.
[0103] In some implementations, the CPU frequency range corresponding to the target application at time t+1 may be determined based on the sum of the CPU frequency adjustment parameter corresponding to the target application at time t+1 and the CPU frequency range corresponding to time t.
[0104] In some implementations, the CPU frequency upper limit corresponding to the target application at time t+1 may be determined based on the CPU frequency adjustment parameter corresponding to the target application at time t+1 and the CPU frequency upper limit corresponding to time t.
[0105] In some implementations, the CPU frequency lower limit corresponding to the target application at time t+1 may be determined based on the CPU frequency adjustment parameter corresponding to the target application at time t+1 and the CPU frequency lower limit corresponding to time t.
[0106] For example, the process of determining the CPU frequency upper limit corresponding to the target application at time t+1 can refer to formula (8):
[0107] curCpuXCeilFreq=lastCpuXCeilFreq+PidOutput(8);
[0108] Among them, curCpuXCeilFreq is the CPU frequency upper limit corresponding to the target application at the t+1th time, and lastCpuXCeilFreq is the CPU frequency upper limit corresponding to the target application at the tth time.
[0109] The process of determining the CPU frequency lower limit corresponding to the target application at time t+1 can be seen in formula (9):
[0110] curCpuXFloorFreq=lastCpuXFloorFreq+PidOutput(9);
[0111] Among them, curCpuXFloorFreq is the CPU frequency lower limit corresponding to the target application at the t+1th time, and lastCpuXFloorFreq is the CPU frequency lower limit corresponding to the target application at the tth time.
[0112] In the embodiment of the present application, the CPU frequency adjustment parameters corresponding to the target application at the t+1 moment are determined according to the configuration parameters corresponding to the target application and the frame delay error parameters corresponding to the tth moment; and then the CPU frequency range corresponding to the target application at the t+1 moment is determined according to the CPU frequency adjustment parameters corresponding to the target application at the t+1 moment and the CPU frequency range corresponding to the tth moment. In this way, on the one hand, based on the configuration parameters corresponding to the target application, the adaptability of the obtained CPU frequency adjustment parameters to the target application can be improved; on the other hand, according to the adjustment parameters at the tth moment and the CPU frequency range, the adaptability of the obtained CPU frequency range to the t+1th moment can be improved.
[0113] In some embodiments, the above step S104 may include the following steps S141 to S142:
[0114] Step S141: Determine a CPU frequency upper limit parameter and a CPU frequency lower limit parameter corresponding to the target application according to the target frame rate and the frame delay parameter.
[0115] In some embodiments, after determining the frame delay error parameter based on the target frame rate and the frame delay parameter, the CPU upper limit parameter of the target application at the next moment after the current moment and the CPU lower limit parameter of the target application at the current moment can be determined respectively based on the frame delay error parameter and the CPU frequency upper limit parameter corresponding to the target application at the current moment and the CPU frequency lower limit parameter corresponding to the target application at the current moment.
[0116] Step S142: Determine a CPU frequency range corresponding to the target application according to a CPU frequency upper limit parameter corresponding to the target application and a CPU frequency lower limit parameter corresponding to the target application.
[0117] Here, the CPU frequency range corresponding to the target application at the next moment of the current moment may be determined according to the CPU frequency upper limit parameter corresponding to the target application at the next moment of the current moment and the CPU frequency lower limit parameter corresponding to the target application.
[0118] In the embodiment of the present application, the upper limit parameter of the CPU frequency corresponding to the target application and the lower limit parameter of the CPU frequency corresponding to the target application are determined according to the target frame rate and the frame delay parameter; and then the CPU frequency range corresponding to the target application is determined according to the upper limit parameter of the CPU frequency corresponding to the target application and the lower limit parameter of the CPU frequency corresponding to the target application. In this way, by determining the upper limit and the lower limit of the CPU frequency, the accuracy of the determined CPU frequency range can be improved.
[0119] In some embodiments, the above step S141 may include the following steps S151 to S153:
[0120] Step S151: Determine an upper limit parameter of a candidate CPU frequency corresponding to a target application and a lower limit parameter of a candidate CPU frequency corresponding to a target application according to a target frame rate and a frame delay parameter.
[0121] Here, the alternative CPU frequency upper limit parameter corresponding to the target application and the alternative CPU frequency lower limit parameter corresponding to the target application can respectively correspond to the CPU frequency upper limit parameter and the CPU frequency lower limit parameter corresponding to the target application determined according to the target frame rate and the frame delay parameters in the above-mentioned CPU frequency method.
[0122] Step S152: Determine the CPU frequency upper limit parameter corresponding to the target application according to the candidate CPU frequency upper limit parameter and the CPU frequency upper limit threshold of the electronic device.
[0123] Here, the upper limit threshold of the CPU frequency of the electronic device may be a preset upper limit of the CPU frequency that can be reached when the electronic device is running.
[0124] In some implementations, the CPU frequency upper limit threshold of the electronic device may be determined based on user preferences, hardware parameters of the device, and the like.
[0125] In some implementations, one may be selected from among the candidate CPU frequency upper limit parameters and the CPU frequency upper limit threshold of the electronic device as the CPU frequency upper limit parameter corresponding to the target application; or a CPU frequency upper limit parameter corresponding to the target application may be calculated based on the candidate CPU frequency upper limit parameters and the CPU frequency upper limit threshold of the electronic device.
[0126] Step S153: Determine the CPU frequency lower limit parameter corresponding to the target application according to the candidate CPU frequency lower limit parameter and the CPU frequency lower limit threshold of the electronic device.
[0127] Here, the upper limit threshold of the CPU frequency of the electronic device may be a preset lower limit of the CPU frequency that can be achieved when the electronic device is running.
[0128] In some implementations, the CPU frequency lower limit threshold of the electronic device may be determined based on user preferences, hardware parameters of the device, and the like.
[0129] In some implementations, a CPU lower frequency limit parameter corresponding to a target application can be selected from the candidate CPU lower frequency limit parameters and the CPU lower frequency limit threshold of the electronic device; or a CPU lower frequency limit parameter corresponding to a target application can be calculated based on the candidate CPU lower frequency limit parameters and the CPU lower frequency limit threshold of the electronic device.
[0130] In the embodiment of the present application, the upper limit parameter of the alternative CPU frequency corresponding to the target application and the lower limit parameter of the alternative CPU frequency corresponding to the target application are determined according to the target frame rate and the frame delay parameters; the upper limit parameter of the CPU frequency corresponding to the target application is determined according to the upper limit parameter of the alternative CPU frequency and the upper limit threshold of the CPU frequency of the electronic device, and the lower limit parameter of the CPU frequency corresponding to the target application is determined according to the lower limit parameter of the alternative CPU frequency and the lower limit threshold of the CPU frequency of the electronic device. In this way, based on the upper limit threshold and lower limit threshold of the CPU frequency supported by the electronic device, the upper and lower limits of the CPU frequency of the target application can be flexibly adjusted to balance the application requirements and the hardware performance of the electronic device, and further improve the user experience.
[0131] In some embodiments, the above step S152 may include at least one of the following steps S161 to S162:
[0132] Step S161: When the candidate CPU frequency upper limit parameter is not less than the CPU frequency upper limit threshold, the CPU frequency upper limit threshold is determined as the CPU frequency upper limit parameter corresponding to the target application.
[0133] Here, when the candidate CPU frequency upper limit parameter is not less than the CPU frequency upper limit threshold, the maximum CPU frequency that the electronic device can support does not exceed the CPU frequency upper limit threshold. Therefore, the CPU frequency upper limit threshold can be determined as the CPU frequency upper limit parameter corresponding to the target application to reduce problems such as excessive power consumption of the electronic device.
[0134] Step S162: When the candidate CPU frequency upper limit parameter is less than the CPU frequency upper limit threshold, determine the candidate CPU frequency upper limit parameter as the CPU frequency upper limit parameter corresponding to the target application.
[0135] Here, when the candidate CPU frequency upper limit parameter is less than the CPU frequency upper limit threshold, the maximum CPU frequency that the electronic device can support exceeds the candidate CPU frequency upper limit parameter. Therefore, the candidate CPU frequency upper limit parameter can be determined as the CPU frequency upper limit parameter corresponding to the target application, thereby reducing the waste of device resources while ensuring the actual needs of the target application.
[0136] In some embodiments, the above step S153 may include at least one of the following steps S171 to S172:
[0137] Step S171: When the candidate CPU frequency lower limit parameter is not greater than the CPU frequency lower limit threshold, the CPU frequency lower limit threshold is determined as the CPU frequency lower limit parameter corresponding to the target application.
[0138] Here, when the candidate CPU frequency lower limit parameter is not greater than the CPU frequency lower limit threshold, the minimum CPU frequency that the electronic device can support exceeds the candidate CPU frequency lower limit parameter. Therefore, the CPU frequency lower limit threshold can be determined as the CPU frequency lower limit parameter corresponding to the target application, so as to complete the regulation of the CPU frequency lower limit corresponding to the target application based on the minimum CPU frequency supported by the electronic device.
[0139] Step S172: When the candidate CPU frequency lower limit parameter is greater than the CPU frequency lower limit threshold, the candidate CPU frequency lower limit parameter is determined as the CPU frequency upper limit parameter corresponding to the target application.
[0140] Here, when the candidate CPU frequency lower limit parameter is greater than the CPU frequency lower limit threshold, the minimum CPU frequency that the electronic device can support is less than the candidate CPU frequency lower limit parameter. Therefore, the candidate CPU frequency lower limit parameter can be determined as the CPU frequency lower limit parameter corresponding to the target application, and the performance requirements of the target application can be met as much as possible while ensuring the performance of the electronic device.
[0141] In some embodiments, the CPU frequency determination method may further include the following steps S181:
[0142] Step S181 : controlling a display module of the electronic device to display a target frame of the target application according to a CPU frequency range corresponding to the target application.
[0143] Here, the target frame may be a frame to be displayed corresponding to a time within a CPU frequency range corresponding to the target application.
[0144] In some implementations, a CPU frequency range corresponding to the target application may be determined according to a target frame rate corresponding to the target frame, and based on the determined CPU frequency range, the display module may be controlled to display the target frame.
[0145] In the embodiment of the present application, according to the CPU frequency range corresponding to the target application, the display module of the electronic device is controlled to display the target frame of the target application. In this way, according to the CPU frequency range corresponding to the target application, the real-time display effect of the display module for the target frame of the target application can be improved, further improving the user experience.
[0146] In some embodiments, the above step S102 may further include the following step S191:
[0147] Step S191 : when the application type of the target application is in the target application type set, determine a target frame rate corresponding to the application type of the target application.
[0148] Here, the target application type set may be a preset set of application types that require dynamic adjustment of CPU frequency. For example, the target application type set may include a white list for screening application types whose CPU frequency is to be adjusted.
[0149] In some implementations, all applications currently running in the electronic device can be filtered through an application whitelist, and after determining the target application whose application type is in the application whitelist, the target frame rate corresponding to the application type of the target application is determined, and the next step is to calculate the frame delay parameter.
[0150] In some embodiments, when the application type of the target application is not in the target application type set, the application currently running in the electronic device does not need to dynamically adjust the CPU frequency, and therefore there is no need to determine the target frame rate corresponding to the application type of the application currently running in the electronic device to determine the CPU frequency range corresponding to the application currently running in the electronic device.
[0151] For example, for applications where the actual demand for CPU frequency in user presets and / or device factory settings does not cause large fluctuations, there is no need to dynamically adjust the CPU frequency.
[0152] In some implementations, when the target application is in a target application set determined according to the application type, a target frame rate corresponding to the application type of the target application may be determined.
[0153] For example, when the target application is a game application and the target application is in the application whitelist of the game application, a target frame rate corresponding to the game application is determined.
[0154] In the embodiment of the present application, when the application type of the target application is in the target application type set, the target frame rate corresponding to the application type of the target application is determined. In this way, the target application to be adjusted is filtered out based on the whitelist, and the application type to be adjusted can be selected according to the user and / or device performance requirements, without adjusting all applications, saving device resources.
[0155] The present application embodiment provides a CPU frequency control system for dynamically controlling the CPU frequency of a target application. Figure 2A As shown, the CPU frequency control system 200 includes: an application 210; a system service component 220, which is used to start and manage the system service of the application 210; a display system component 230, which is used to filter the target application in the application 210 through a whitelist and calculate the frame delay; a scene identifier 240, which is used to identify the target frame rate in the current scene; a performance power consumption system service component 250, which is used to adjust the performance power consumption of the electronic device, and the performance power consumption system service component 250 includes a dynamic CPU frequency range control component 251 and a prompt manager 252; the dynamic CPU frequency range control component 251 is used to perform error calculation and determine the CPU frequency range according to the frame delay parameter and the target frame rate; the prompt manager 252 is used to allocate CPU260 resources in the CPU frequency control system according to the CPU frequency range determined by the dynamic CPU frequency range control component 251.
[0156] Based on the above-mentioned CPU frequency control system, an embodiment of the present application provides a CPU frequency determination method for dynamically controlling the CPU frequency of a target application, which can be executed by an electronic device.
[0157] like Figure 2B As shown, the method includes the following steps S201 to S209:
[0158] Step S201: Determine the currently running application.
[0159] During implementation, the currently running application may include an application that is currently started, a foreground application that is currently running, an application that is currently displayed on the display screen, and the like.
[0160] Step S202: Start and manage the system service of the application.
[0161] During implementation, the system service of the application can be started and managed through the system service component 220 in the CPU frequency control system.
[0162] Step S203: Filter the target application through the whitelist.
[0163] Here, if the target application in the application is filtered out through the application whitelist, step S204 is executed; if the target application in the application is not filtered out through the application whitelist, the regulation is ended.
[0164] During implementation, the display system component 230 in the CPU frequency control system may be used to apply a whitelist to filter target applications.
[0165] During implementation, the display system component 230 in the CPU frequency control system can filter out layers of a type of application according to the application whitelist in the configuration, and further calculate the frame delay of the type of application.
[0166] Step S204: frame delay calculation.
[0167] Here, calculating the real-time frame delay of the target application may correspond to calculating the frame delay parameter in the above-mentioned CPU frequency determination method.
[0168] During implementation, the frame delay calculation may be performed by the display system component 230 in the CPU frequency control system.
[0169] Step S205: Identify the target frame rate in the current scene.
[0170] Here, when multiple applications are running in the current scene, a target frame rate corresponding to the target application is identified.
[0171] During implementation, the target frame rate corresponding to the current scene may be identified by a scene identifier.
[0172] During implementation, the target frame rate may be determined according to the application type of the target application.
[0173] During implementation, the target frame rate in the current scene can be identified by the scene identifier 240 in the CPU frequency control system.
[0174] Step S206: performing error calculation according to the frame delay parameter and the target frame rate.
[0175] Here, performing the error calculation corresponds to determining the frame delay error in the above-mentioned CPU frequency determination method.
[0176] During implementation, the error calculation may be performed by the dynamic CPU frequency range control component 251 in the CPU frequency control system.
[0177] Step S207: Determine the CPU frequency range corresponding to the target application.
[0178] During implementation, the CPU frequency range corresponding to the target application can be determined through a PID control algorithm.
[0179] During implementation, the CPU frequency range corresponding to the target application may be determined by the dynamic CPU frequency range control component 251 in the CPU frequency control system.
[0180] Step S208: Obtain the CPU frequency range.
[0181] During implementation, the CPU frequency range determined by the dynamic CPU frequency range control component 251 may be obtained through the prompt manager 252 in the CPU frequency control system.
[0182] Step S209: Allocate CPU resources according to the CPU frequency range.
[0183] During implementation, the CPU resources may be allocated according to the CPU frequency range through the prompt manager 252 in the CPU frequency control system.
[0184] In the embodiment of the present application, after determining the currently running application, the system service of the application is started and managed; when the target application is filtered out through the whitelist, the frame delay calculation is performed, and the target frame rate in the current scenario is identified; then, according to the frame delay parameters and the target frame rate, the error calculation is performed to determine the CPU frequency range corresponding to the target application; after obtaining the CPU frequency range, the CPU resources are allocated according to the CPU frequency range. In this way, on the one hand, the CPU frequency range of the electronic device can be dynamically adjusted based on real-time frame delay feedback to adapt to the real-time performance requirements of the target application; on the other hand, since each type of application has similar performance requirements, based on the application whitelist, each application does not need to adapt its own CPU frequency range, that is, each type of application shares a set of configurations, which can reduce the workload while meeting the requirements of different applications of the same type, improve the working efficiency of the electronic device, and further improve the user experience.
[0185] For example, Figure 2CAs shown, the target frame rate of the target application is 60Hz. When the CPU frequency range is statically configured, the current of the electronic device is 2557.93mA, the average frame rate is 59.16Hz, the frame interval variance as a frame error parameter is 1.72Hz, and the minimum frame rate is 44.01Hz; when the CPU frequency range is dynamically regulated, the current of the electronic device is 2373.03mA, the average frame rate is 59.6Hz, the frame interval variance as a frame error parameter is 1.82Hz, and the minimum frame rate is 46.01Hz; that is, compared with the static configuration, the dynamic regulation of the CPU frequency range reduces the current power consumption by about 200mA, and increases the average frame rate and the minimum frame rate. In this way, by dynamically adjusting the CPU frequency range of the target application, the operating current of the electronic device can be reduced on the basis of making the actual frame rate of the target application close to the target frame rate and ensuring the application performance, and further reducing the power consumption of the device.
[0186] The present application provides a CPU frequency determination device, which can be applied to electronic devices, such as Figure 3 As shown, the CPU frequency determination device 300 includes:
[0187] A first determination module 301 is used to determine the application type of a target application running in an electronic device;
[0188] A second determination module 302 is used to determine a target frame rate corresponding to the application type of the target application;
[0189] A third determination module 303, used to determine a frame delay parameter of the target application;
[0190] The fourth determination module 304 is used to determine the CPU frequency range corresponding to the target application according to the target frame rate and the frame delay parameter.
[0191] In some embodiments, the fourth determination module may also be used to: determine a frame delay error parameter of the target application based on the target frame rate and the frame delay parameter; and determine a CPU frequency range corresponding to the target application based on the frame delay error parameter.
[0192] In some embodiments, the fourth determination module may also be used to: determine a target delay parameter according to the target frame rate; and determine the frame delay error parameter according to a difference between the target delay parameter and the frame delay parameter.
[0193] In some embodiments, the fourth determination module can also be used to: determine the CPU frequency adjustment parameter corresponding to the target application at time t+1 according to the configuration parameters corresponding to the target application and the frame delay error parameter corresponding to time t; determine the CPU frequency range corresponding to the target application at time t+1 according to the CPU frequency adjustment parameter corresponding to the target application at time t+1 and the CPU frequency range corresponding to time t.
[0194] In some embodiments, the fourth determination module can also be used to: determine the CPU frequency upper limit parameter corresponding to the target application and the CPU frequency lower limit parameter corresponding to the target application based on the target frame rate and the frame delay parameter; determine the CPU frequency range corresponding to the target application based on the CPU frequency upper limit parameter corresponding to the target application and the CPU frequency lower limit parameter corresponding to the target application.
[0195] In some embodiments, the fourth determination module can also be used to: determine the alternative CPU frequency upper limit parameter corresponding to the target application and the alternative CPU frequency lower limit parameter corresponding to the target application based on the target frame rate and the frame delay parameter; determine the CPU frequency upper limit parameter corresponding to the target application based on the alternative CPU frequency upper limit parameter and the CPU frequency upper limit threshold of the electronic device; determine the CPU frequency lower limit parameter corresponding to the target application based on the alternative CPU frequency lower limit parameter and the CPU frequency lower limit threshold of the electronic device.
[0196] In some embodiments, the CPU frequency determination device may further include:
[0197] The first control module is used to control the display module of the electronic device to display the target frame of the target application according to the CPU frequency range corresponding to the target application.
[0198] In some embodiments, the second determination module may also be used to: when the application type of the target application is in a target application type set, determine a target frame rate corresponding to the application type of the target application.
[0199] The present application embodiment provides an electronic device, including: a memory and a processor. Figure 4 As shown, the electronic device 400 includes:
[0200] Memory 401, used to store computer programs that can be run on processor 402;
[0201] The processor 402 is used to execute the program stored in the memory 401 to implement the CPU frequency determination method applied to the CPU frequency determination device.
[0202] An embodiment of the present application provides a computer program, including a computer-readable code. When the computer-readable code is executed in a computer device, a processor in the computer device executes some or all of the steps for implementing the above-mentioned CPU frequency determination method.
[0203] An embodiment of the present application provides a computer program product, including a computer program or instructions, which, when executed by a processor, implements some or all of the steps in the above-mentioned CPU frequency determination method.
[0204] An embodiment of the present application provides a computer-readable storage medium, which stores a computer program. The computer program can be executed by a processor to implement the above-mentioned CPU frequency determination method.
[0205] The present application is described with reference to the flowchart and / or block diagram of the method, device and equipment according to the embodiment of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, and the combination of the process and / or box in the flowchart and / or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device produce a device for implementing the function specified in one process or multiple processes in the flowchart and / or one box or multiple boxes in the block diagram.
[0206] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device that implements the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0207] These computer program instructions may also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, whereby the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0208] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by any technician familiar with the technical field within the technical scope disclosed in the present application should be included in the protection scope of the present application.
[0209] The description of the above device embodiment is similar to the description of the above method embodiment, and has similar beneficial effects as the method embodiment. For technical details not disclosed in the device embodiment of the present application, please refer to the description of the method embodiment of the present application for understanding.
[0210] It should be understood that "one embodiment" or "an embodiment" mentioned throughout the specification means that specific features, structures or characteristics related to the embodiment are included in at least one embodiment of the present application. Therefore, "in one embodiment" or "in an embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. In addition, these specific features, structures or characteristics can be combined in one or more embodiments in any suitable manner. It should be understood that in various embodiments of the present application, the size of the sequence number of the above-mentioned processes does not mean the order of execution, and the execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application. The above-mentioned sequence numbers of the embodiments of the present application are only for description and do not represent the advantages and disadvantages of the embodiments.
[0211] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0212] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as: multiple units or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.
[0213] The units described above as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units; they may be located in one place or distributed on multiple network units; some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0214] In addition, all functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may be a separate unit, or two or more units may be integrated into one unit; the above-mentioned integrated units may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0215] A person skilled in the art can understand that all or part of the steps of implementing the above method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above method embodiment; and the aforementioned storage medium includes: mobile storage devices, read-only memories (ROM), magnetic disks or optical disks, etc., various media that can store program codes.
[0216] Alternatively, if the above-mentioned integrated unit of the present application is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application can be essentially or partly embodied in the form of a software product that contributes to the relevant technology. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROMs, magnetic disks, or optical disks.
[0217] The above is only an implementation method of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application.
Claims
1. A method for determining CPU frequency, comprising: determining an application type of a target application running in the electronic device; Determining a target frame rate corresponding to an application type of the target application; determining a frame delay parameter of the target application; A CPU frequency range corresponding to the target application is determined according to the target frame rate and the frame delay parameter.
2. The method according to claim 1, wherein determining the CPU frequency range corresponding to the target application according to the target frame rate and the frame delay parameter comprises: Determining a frame delay error parameter of the target application according to the target frame rate and the frame delay parameter; A CPU frequency range corresponding to the target application is determined according to the frame delay error parameter.
3. The method according to claim 2, wherein determining the frame delay error parameter of the target application according to the target frame rate and the frame delay parameter comprises: Determining a target delay parameter according to the target frame rate; The frame delay error parameter is determined according to a difference between the target delay parameter and the frame delay parameter.
4. The method according to claim 2, wherein determining the CPU frequency range corresponding to the target application according to the frame delay error parameter comprises: Determining a CPU frequency adjustment parameter corresponding to the target application at time t+1 according to the configuration parameter corresponding to the target application and the frame delay error parameter corresponding to time t; The CPU frequency range corresponding to the target application at time t+1 is determined according to the CPU frequency adjustment parameter corresponding to the target application at time t+1 and the CPU frequency range corresponding to time t.
5. The method according to claim 1, wherein determining the CPU frequency range corresponding to the target application according to the target frame rate and the frame delay parameter comprises: Determine, according to the target frame rate and the frame delay parameter, a CPU frequency upper limit parameter corresponding to the target application and a CPU frequency lower limit parameter corresponding to the target application; A CPU frequency range corresponding to the target application is determined according to an upper limit parameter of a CPU frequency corresponding to the target application and a lower limit parameter of a CPU frequency corresponding to the target application.
6. The method according to claim 5, wherein determining the CPU frequency upper limit parameter and the CPU frequency lower limit parameter corresponding to the target application according to the target frame rate and the frame delay parameter comprises: Determine, according to the target frame rate and the frame delay parameter, an upper limit parameter of an alternative CPU frequency corresponding to the target application and a lower limit parameter of an alternative CPU frequency corresponding to the target application; Determining the CPU frequency upper limit parameter corresponding to the target application according to the candidate CPU frequency upper limit parameter and the CPU frequency upper limit threshold of the electronic device; The CPU frequency lower limit parameter corresponding to the target application is determined according to the candidate CPU frequency lower limit parameter and the CPU frequency lower limit threshold of the electronic device.
7. The method according to any one of claims 1 to 6, further comprising: According to the CPU frequency range corresponding to the target application, the display module of the electronic device is controlled to display the target frame of the target application.
8. The method according to any one of claims 1 to 6, wherein determining a target frame rate corresponding to an application type of the target application comprises: In a case where the application type of the target application is in the target application type set, a target frame rate corresponding to the application type of the target application is determined.
9. A CPU frequency determination device, comprising: A first determination module, used to determine the application type of a target application running in the electronic device; A second determination module, used to determine a target frame rate corresponding to an application type of the target application; A third determination module, used to determine a frame delay parameter of the target application; The fourth determination module is used to determine the CPU frequency range corresponding to the target application according to the target frame rate and the frame delay parameter.
10. An electronic device comprising a memory and a processor, wherein the memory stores a data processing program executable on the processor, and the processor implements the steps of the method according to any one of claims 1 to 8 when executing the program.