CN111338838A - Method for controlling frequency of central processing unit and related device - Google Patents
Method for controlling frequency of central processing unit and related device Download PDFInfo
- Publication number
- CN111338838A CN111338838A CN202010208321.6A CN202010208321A CN111338838A CN 111338838 A CN111338838 A CN 111338838A CN 202010208321 A CN202010208321 A CN 202010208321A CN 111338838 A CN111338838 A CN 111338838A
- Authority
- CN
- China
- Prior art keywords
- processing unit
- frequency
- central processing
- data
- target application
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000012545 processing Methods 0.000 title claims abstract description 92
- 238000000034 method Methods 0.000 title claims abstract description 72
- 230000015654 memory Effects 0.000 claims description 28
- 238000004590 computer program Methods 0.000 claims description 14
- 238000009877 rendering Methods 0.000 claims description 3
- 230000000903 blocking effect Effects 0.000 abstract description 16
- 230000006870 function Effects 0.000 description 14
- 238000004891 communication Methods 0.000 description 11
- 238000010586 diagram Methods 0.000 description 9
- 230000003993 interaction Effects 0.000 description 9
- 230000008569 process Effects 0.000 description 7
- 239000002699 waste material Substances 0.000 description 4
- 230000008878 coupling Effects 0.000 description 3
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 230000002159 abnormal effect Effects 0.000 description 2
- 238000011161 development Methods 0.000 description 2
- 230000033001 locomotion Effects 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 208000003028 Stuttering Diseases 0.000 description 1
- 230000005856 abnormality Effects 0.000 description 1
- 238000013528 artificial neural network Methods 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 238000004422 calculation algorithm Methods 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 238000009795 derivation Methods 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 230000010365 information processing Effects 0.000 description 1
- 238000012544 monitoring process Methods 0.000 description 1
- 230000009467 reduction Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/0703—Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
- G06F11/0706—Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation the processing taking place on a specific hardware platform or in a specific software environment
- G06F11/0721—Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation the processing taking place on a specific hardware platform or in a specific software environment within a central processing unit [CPU]
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/0703—Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
- G06F11/0793—Remedial or corrective actions
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- User Interface Of Digital Computer (AREA)
Abstract
The application provides a control method and a related device of central processing unit frequency, wherein electronic equipment firstly obtains drawing data of a key thread corresponding to a target application, wherein the key thread comprises a user interface thread; then, judging whether the target application has a frame drop condition or not based on the drawing data; then, if the frame dropping condition exists in the target application, judging whether the central processing unit is in a full-load working state; and finally, if the central processing unit is not in the full-load working state, improving the working frequency of the central processing unit based on the drawing data. Whether the current application program has the frame dropping and blocking situations or not can be judged based on the drawing data of the user interface thread, the working frequency of a CPU is dynamically adjusted based on the drawing data, and the frame dropping and blocking situations or the like of a picture are avoided.
Description
Technical Field
The present application relates to the field of central processing unit control, and in particular, to a method and related apparatus for controlling a frequency of a central processing unit.
Background
A Central Processing Unit (CPU) is a final execution Unit for information Processing and program operation, and as for the CPU, the indexes affecting the performance mainly include frequency, the number of bits of the CPU, and a cache instruction set of the CPU. The frequency of the CPU is the clock frequency, which directly determines the performance of the CPU. When the current electronic equipment runs the application program, the display of the application program needs to be ensured not to have the situations of frame dropping and the like, but how to reasonably control the frequency of the CPU makes the situations of frame dropping, blocking and the like not to occur when the application program runs and also does not waste the performance of the CPU become a difficult problem.
Disclosure of Invention
Based on the above problems, the present application provides a method and a related device for controlling a frequency of a central processing unit, which can determine whether a current application program has a frame drop or not through drawing data of a user interface thread, and dynamically adjust a working frequency of the CPU, thereby avoiding a frame drop and a pause in a picture.
In a first aspect, an embodiment of the present application provides a method for controlling a frequency of a central processing unit, which is applied to an electronic device, and the method includes:
obtaining drawing data of a key thread corresponding to a target application, wherein the key thread comprises a user interface thread;
judging whether the target application has a frame drop condition or not based on the drawing data;
if the frame dropping condition exists in the target application, judging whether the central processing unit is in a full-load working state;
and if the central processing unit is not in the full-load working state, improving the working frequency of the central processing unit based on the drawing data.
In a second aspect, an embodiment of the present application provides an apparatus for controlling a frequency of a central processing unit, where the apparatus includes:
the device comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring drawing data of a key thread corresponding to a target application, and the key thread comprises a user interface thread;
a frame drop judging unit, configured to judge whether a frame drop condition exists in the target application based on the drawing data;
the processor judging unit is used for judging whether the central processing unit is in a full-load working state or not when the frame dropping condition exists in the target application;
and the frequency control unit is used for increasing the working frequency of the central processing unit based on the drawing data when the central processing unit is not in the full-load working state.
In a third aspect, an embodiment of the present application provides an electronic device, including an application processor, a communication interface, and a memory, where the application processor, the communication interface, and the memory are connected to each other, where the memory is used to store a computer program, and the computer program includes program instructions, and the application processor is configured to call the program instructions to perform all or part of the steps of the method described in the first aspect of the embodiment of the present application.
A fourth aspect of embodiments of the present application provides a computer storage medium storing a computer program comprising program instructions which, when executed by a processor, cause the processor to perform all or part of the steps of a method as described in the first aspect of embodiments of the present application.
A fifth aspect of embodiments of the present application provides a computer program product, wherein the computer program product comprises a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to cause a computer to perform some or all of the steps as described in any one of the methods of the first aspect of embodiments of the present application. The computer program product may be a software installation package.
It can be seen that, in the embodiment of the present application, the electronic device first obtains drawing data of a key thread corresponding to a target application, where the key thread includes a user interface thread; then, judging whether the target application has a frame drop condition or not based on the drawing data; then, if the frame dropping condition exists in the target application, judging whether the central processing unit is in a full-load working state; and finally, if the central processing unit is not in the full-load working state, improving the working frequency of the central processing unit based on the drawing data. Whether the current application program has the frame dropping and blocking situations or not can be judged based on the drawing data of the user interface thread, the working frequency of a CPU is dynamically adjusted based on the drawing data, and the frame dropping and blocking situations or the like of a picture are avoided.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1A is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure;
fig. 1B is a schematic diagram of a hardware and software system of an electronic device according to an embodiment of the present disclosure;
fig. 2 is a schematic flowchart of a method for controlling a frequency of a central processing unit according to an embodiment of the present disclosure;
FIG. 3 is a flowchart illustrating a method of step 204 in FIG. 2 according to an embodiment of the present disclosure;
FIG. 4 is a schematic flow chart of another method provided by the embodiment of the present application in step 204 of FIG. 2;
fig. 5 is a schematic flowchart of another method for controlling a frequency of a central processing unit according to an embodiment of the present application;
fig. 6A is a schematic view of an application scenario of a method for controlling a central processing unit frequency according to an embodiment of the present application;
fig. 6B is a schematic diagram of an application scenario of a method for controlling a central processing unit frequency according to an embodiment of the present application;
fig. 7 is a schematic flowchart of another method for controlling a frequency of a central processing unit according to an embodiment of the present application;
fig. 8 is a block diagram illustrating functional units of a device for controlling a central processing unit frequency according to an embodiment of the present disclosure;
fig. 9 is a block diagram illustrating functional units of another apparatus for controlling a central processing unit frequency according to an embodiment of the present disclosure.
Detailed Description
In order to make the technical solutions of the present application better understood, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The terms "first," "second," and the like in the description and claims of the present application and in the above-described drawings are used for distinguishing between different objects and not for describing a particular order. Furthermore, the terms "include" and "have," as well as any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to only those steps or elements listed, but may alternatively include other steps or elements not listed, or inherent to such process, method, article, or apparatus.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the application. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. It is explicitly and implicitly understood by one skilled in the art that the embodiments described herein can be combined with other embodiments.
In order to better understand the scheme of the embodiments of the present application, the following first introduces the related terms and concepts that may be involved in the embodiments of the present application.
Frame rate (FPS), which means the number of Frames transmitted Per Second, the higher the frame rate, the smoother the displayed motion. Otherwise, the lower the frame rate is, the people can feel that the frame is stuck, which greatly influences the watching experience.
The target application may include a native program of the operating system itself, or a third-party application developed by a third-party developer, and specifically may include application programs such as a camera, a gallery, a calendar, a call, a map, navigation, WLAN, bluetooth, music, a video, and a short message.
The key Thread may include a User Interface Thread (User Interface Thread) and other related threads called in drawing the image of the target application, such as a related Thread for representing the identity of the target application, and the UI Thread is a main Thread for performing a task of drawing the image and constitutes a key Thread together with the other related threads.
The drawing data can comprise drawing messages and corresponding drawing time stamps, and the drawing time required for drawing one frame of image can be calculated according to the drawing messages and the corresponding drawing time stamps of each frame of image.
The method comprises the steps of judging whether a currently running application program is abnormal or not through drawing data of a UI thread, namely judging whether a frame dropping condition exists in the target application or not based on the drawing data; then, if the target application has the conditions of frame dropping, blocking and the like, judging whether the central processing unit is in a full-load working state or not; and finally, if the central processing unit is not in the full-load working state, improving the working frequency of the central processing unit based on the drawing data. Therefore, the working frequency of the CPU can be dynamically adjusted based on the drawing data, and the situations of frame dropping, blocking and the like of the picture are avoided.
First, a software and hardware operating environment of the method for controlling a central processing unit frequency according to the embodiment of the present application is described, as shown in fig. 1A and 1B.
Fig. 1A is a schematic structural diagram of an electronic device according to an embodiment of the present application, where the electronic device 100 may be an electronic device with a communication capability, and the electronic device may include various handheld devices, vehicle-mounted devices, wearable devices, computing devices or other processing devices connected to a wireless modem, and various forms of User Equipment (UE), a Mobile Station (MS), a terminal device (terminal device), and the like. The electronic device 100 in the present application may include one or more of the following components: a processor 110, a memory 120, and an input-output device 130.
A memory 120 may be provided in the processor 110 for storing instructions and data. In some embodiments, the memory 120 in the processor 110 is a cache memory. The memory 120 may hold instructions or data that have just been used or recycled by the processor 110. If the processor 110 needs to use the instruction or data again, it can be called directly from the memory 120. Avoiding repeated accesses, reducing the latency of the processor 110, and increasing system efficiency.
It is to be understood that the processor 110 may be mapped to a System On Chip (SOC) in an actual product, and the processing unit and/or the interface may not be integrated into the processor 110, and the corresponding functions may be implemented by a communication Chip or an electronic component alone. The above-described interface connection relationship between the modules is merely illustrative, and does not constitute a unique limitation on the structure of the electronic apparatus 100.
The Memory 120 may include a Random Access Memory (RAM) or a Read-Only Memory (Read-Only Memory). Optionally, the memory 120 includes a non-transitory computer-readable medium. The memory 120 may be used to store instructions, programs, code sets, or instruction sets. The memory 120 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playing function, an image playing function, etc.), instructions for implementing various method embodiments described below, and the like, and the operating system may be an Android (Android) system (including a system based on Android system depth development), an IOS system developed by apple inc (including a system based on IOS system depth development), or other systems. The storage data area may also store data created during use of the electronic device 100.
The input-output device 130 may include a touch display screen for receiving a touch operation of a user thereon or nearby using any suitable object such as a finger, a touch pen, or the like, and displaying a user interface of the respective application programs. The touch display screen is generally provided at a front panel of the terminal 100. The touch display screen may be designed as a full-screen, a curved screen, or a shaped screen. The touch display screen can also be designed to be a combination of a full-face screen and a curved-face screen, and a combination of a special-shaped screen and a curved-face screen, which is not limited in the embodiment of the present application.
Fig. 1B is a schematic diagram of a software and hardware system of an electronic device according to an embodiment of the present disclosure, which includes a display driver layer 121, a display overlay layer 122, a display service layer 123, and a frame rate adjustment module 111, where the display driver layer 121, the display overlay layer 122, and the display service layer 123 may communicate with each other through a software interface, and are mainly used to control a display effect of an application program, the display service layer 123 may include a plurality of application programs, such as a game application, a video application, a camera application, a user interaction application, and the like, and may switch a frame rate of display based on display requirements of different application programs, for example, a frame rate requirement of the game application may be 30 frames or 60 frames, a frame rate requirement of the video application may be 30 frames, a frame rate requirement of the camera application may be 20 frames, a frame rate requirement of the user interaction application may be 60 frames, and the like, the frame rate adjusting module 111 is integrated in the processor 110, and is configured to control the display driving layer 121, the display overlay layer 122 and the display service layer 123 to enable a frame rate displayed by a current application program to meet a frame rate requirement of the current application program. Specifically, the frame rate adjusting module 111 may monitor the display state of the current application program in real time through drawing data of the UI thread, and dynamically increase the CPU frequency after a frame drop occurs, so that the frame rate of the game application is maintained at 30 frames or 60 frames, the frame rate of the video application is maintained at 30 frames, the frame rate of the camera application is maintained at 20 frames, the frame rate of the user interaction application is maintained at 60 frames, and the like.
By the software and hardware operating environment, whether the current application program has the frame dropping and blocking situations or not can be judged based on the drawing data of the user interface thread, the working frequency of the CPU is dynamically adjusted based on the drawing data, the frame dropping and blocking situations or the like of the picture are avoided, meanwhile, the power consumption of the CPU can be timely reduced, and the situation of CPU performance waste is avoided.
The software and hardware operating environment of the present application is introduced above, and the following describes in detail a method for controlling a frequency of a central processing unit in an embodiment of the present application with reference to fig. 2, where fig. 2 is a schematic flow chart of the method for controlling a frequency of a central processing unit provided in the embodiment of the present application, and specifically includes the following steps:
The method comprises the steps that firstly, a processor can monitor the system state of the electronic equipment, when a target application is started, the processor can call a key thread formed by a UI thread and a related thread corresponding to the target application to draw the target application, and receive drawing data of the key thread, wherein the drawing data can comprise drawing time consumed by the UI thread for drawing a frame of image aiming at the target application, and the drawing time can reflect the current actual frame rate of the target application.
The target frame rate data of the target application may be obtained first, and then the drawing data is calculated to obtain the current actual frame rate data of the target application, it can be understood that, in the present application, the meaning of the X frame is that an X frame image is transmitted every second, the actual frame rate data is set to be N, and the drawing duration is set to be M, and then the actual frame rate data may be obtained by combining the following formula:
specifically, the target frame rate data may include a target frame rate and a preset frame drop duration, where the target frame rate may reflect a frame rate requirement of the target application, for example, the target frame rate of the game application may be 60 frames, the expected frame rate of the video application may be 30 frames, and the preset frame drop duration may be set to 0.5 second, for example, in a scene of the game application, a frame drop may be considered when an actual frame rate is lower than 60 frames and exceeds 0.5 second, and a frame drop may not be considered when an actual frame rate is lower than 60 frames and does not exceed 0.5 second. If the actual frame rate is lower than the target frame rate and the frame dropping duration of the actual frame rate lower than the target frame rate is greater than the preset frame dropping duration, determining that the target application has a frame dropping condition, and executing step 203; if the actual frame rate is equal to the target frame rate, the working frequency of the CPU is maintained, and the system operation state of the electronic equipment is continuously monitored.
Therefore, whether the target application is in the frame dropping and blocking or not is judged by drawing data, whether the target application is in the frame dropping and blocking or not can be accurately detected under the condition that the running of the target application is not influenced, and the use experience of a user using the target application is not influenced.
When the target application has a frame drop condition, executing the step.
The method comprises the steps of firstly inquiring the current working frequency of a CPU and the current working core of the CPU, specifically, acquiring the identification data of the key thread, then inquiring the current working frequency of the CPU and the current working core corresponding to the key thread based on the identification data, and judging whether the CPU is in a full-load working state or not by judging whether the current working frequency reaches a preset frequency or whether the current working core is a main working core.
If the CPU is in a full load working state, warning information can be sent to a user, wherein the warning information is used for indicating that the CPU is overloaded and is not described again; if the CPU is not in the full load operating state, step 204 is executed.
Therefore, whether the central processing unit is in a full-load working state or not is judged, the working frequency of the central processing unit can be conveniently and dynamically adjusted, a user can be timely notified when automatic adjustment cannot be carried out, and the use experience of the user is optimized.
And 204, improving the working frequency of the central processing unit based on the drawing data.
Fig. 3 is a schematic flowchart of a process of step 204 provided in this embodiment, and specifically includes the following steps:
For example, when the target application is a video-type application and the target frame rate data is 30 frames, the time consumed for drawing one frame of image should be 33.3 milliseconds, and at this time, the drawing time condition may be determined to be 33.3 milliseconds.
And 302, increasing the working frequency of the central processing unit until the drawing time meets the drawing time condition.
For example, when the drawing time condition is 33.3 milliseconds, the amplitude of the drawing time exceeding 33.3 milliseconds can be preset to be within 5 milliseconds, within 5 milliseconds to 10 milliseconds, and corresponding CPU operating frequency increasing amplitude from 10 milliseconds to 15 milliseconds, and it can be understood that the larger the amplitude of the drawing time exceeding 33.3 milliseconds is, the larger the corresponding CPU operating frequency increasing amplitude is, and after the drawing time meets the drawing time condition, the CPU operating frequency is maintained unchanged, and the system operating state of the electronic device is continuously monitored.
Therefore, the working frequency of the CPU is dynamically improved, the working frequency of the CPU can be ensured to be close to the actual requirement of the target application as far as possible, and the power consumption of the CPU can be reduced under the condition that the target application is not dropped and is blocked.
Optionally, another method of step 204 is described in detail with reference to fig. 4, where fig. 4 is a schematic flow chart of another step 204 provided in this embodiment of the present application, and specifically includes the following steps:
The current frequency data of the CPU, which represents the current operating frequency, may be determined in combination with the drawing duration.
The target frequency data indicates the operating frequency of the CPU required by the target application to reach the target frame rate, and may be obtained by querying related information of the target application, for example, the operating frequency of the CPU required by the game application to reach 60 frames is generally higher than the operating frequency of the CPU required by the video application to reach 30 frames, and different target applications may correspond to different target frequency data, where it is to be noted that the target frequency data is not greater than the maximum frequency supported by the CPU.
Wherein, the frequency boost value data of the CPU can be obtained by calculating the difference value between the current frequency data and the target frequency data.
And step 404, increasing the working frequency of the central processing unit based on the working frequency increase value.
And the working frequency of the CPU can be directly increased according to the frequency increasing value data, so that the working frequency of the CPU accords with the target frequency data.
It can be understood that the implementation methods of the two steps 204 in fig. 3 and fig. 4 can be performed synchronously, and the processor can flexibly switch specific implementation manners according to its own working state, the current process working state, and the like, so that various options can be provided for the method for improving the working frequency.
Therefore, the method determines whether the current application program has the conditions of frame dropping and the like through the drawing data of the user interface thread, dynamically improves the working frequency of the CPU, and avoids the conditions of frame dropping, blocking and the like of the picture.
Fig. 5 is a flowchart illustrating another method for controlling a frequency of a central processing unit in this embodiment of the present application in detail, where fig. 5 is a flowchart illustrating another method for controlling a frequency of a central processing unit in this embodiment of the present application, and specifically includes the following steps:
For a specific implementation, please refer to the method of step 201 in fig. 2, which is not described herein again.
For a specific implementation, please refer to the method of step 202 in fig. 2, which is not described herein again.
If the target application does not have the frame dropping condition, executing step 503; and if the target application has a frame drop condition, dynamically increasing the current working frequency of the CPU.
The drawing data comprises drawing time consumed by the UI thread for drawing one frame of image for the target application, and when the drawing time is shorter than the target drawing time corresponding to the frame rate required by the target application and the difference value exceeds a preset time range, the CPU working frequency is far higher than the CPU working frequency required by the target application at the moment, the CPU working frequency is in a performance excess state, and the CPU current working frequency needs to be reduced. For example, if the target application is a user interaction application, the required frame rate is 60 frames, the target drawing time is 16.6 milliseconds at this time, and the preset time range is 5 milliseconds, it can be determined that when the drawing time is less than or equal to 11.6 milliseconds, the current operating frequency of the CPU is too high, and the current operating frequency of the CPU needs to be reduced; when the drawing time length is more than 11.6 milliseconds and less than or equal to 16.6 milliseconds, the current working frequency of the CPU is only slightly more than the working frequency of the CPU required by the user interaction application to reach 60 frames, the CPU is not in a performance excess state, and the current working frequency of the CPU is not required to be reduced. It can be understood that the preset duration range can be flexibly changed according to the self requirements of the user.
If the cpu is in a performance excess state, go to step 504; if the cpu is not in the performance excess state, the operation of step 501 is repeatedly executed.
Specifically, how to reduce the operating frequency of the CPU is described in detail in the example in which the target application is the user interaction application, and it can be known from the above example that the frame rate requirement of the user interaction application is 60 frames, the target drawing time length is 16.6 milliseconds, and the preset time length range is 5 milliseconds, so that the current operating frequency of the CPU is reduced until the drawing time length of the UI thread for the user interaction application is greater than 11.6 milliseconds and less than or equal to 16.6 milliseconds, and the frequency reduction operation on the CPU is stopped. And then, continuously monitoring the system state of the electronic equipment.
By the method, when the working frequency of the CPU exceeds that of the CPU required by the target application to reach the target frame rate, the working frequency of the CPU is timely reduced to that required by the target application to reach the target frame rate, and the phenomenon of performance waste of the CPU is avoided while the experience of a user using the target application is not influenced.
For convenience of understanding, an application scenario of a method for controlling the frequency of the central processing unit in the embodiment of the present application is illustrated below with reference to fig. 6A and 6B, where an application program currently running on the electronic device is a game-like application, and specifically, a finger of a user is required to swipe a virtual button area on a screen to control a character in a game to move correspondingly. It should be noted that, under the normal operation condition, as shown in fig. 6A, the frame rate of the game-like application is 60 frames, which meets the frame rate requirement, that is, the character moving track in the game is smooth and natural movement, and the user can control the character in the game to smoothly move from point a to point B without feeling frame stutter; in the case of abnormal operation, as shown in fig. 6B, when the actual frame rate of the game-like application is lower than 60 frames, a display abnormality occurs, and when a user operates a character in the game to move from point a to point B, the character in the game is stopped at point a and moves to point B after a while, and a phenomenon of frame dropping and pausing occurs.
In this embodiment, the processor may monitor an operating state of the electronic device system, when a game application program is running, the processor may invoke a UI thread and a thread corresponding to the game application program to draw the game application program in real time, so as to obtain real-time drawing data, where the drawing data may include a drawing time consumed by the UI thread to draw a frame of image for the game application program, and the processor may determine, according to the drawing time, whether a current actual frame rate of the game application program corresponds to 60 frames, specifically, since 60 frames are 60 frames per 1 second, when the actual frame rate is 60 frames, the time consumed by drawing a frame of image should be 16.6 milliseconds, a current actual frame rate may be calculated by reverse derivation according to the drawing time according to the calculation rule, and if the current actual frame rate corresponds to 60 frames, the operating state of the electronic device system is continuously monitored, if the current actual frame rate does not meet 60 frames, two situations of non-compliance may occur, one is that the current actual frame rate is lower than 60 frames, and the other is that the current actual frame rate is higher than 60 frames, which are sequentially described as follows:
when the current actual frame rate of the game application is lower than 60 frames, inquiring the current working state information of the CPU, and judging whether the CPU is in a full load working state or not based on the current working state information of the CPU, wherein the working state information can comprise the current working frequency of the CPU, the CPU core information operated by the current key thread and the like, if the current working frequency of the CPU is lower than the preset maximum working frequency or the CPU core operated by the current key thread is not the main core of the CPU, the CPU is not in the full load working state, and at the moment, the working frequency of the CPU can be dynamically increased until the actual frame rate of the game application accords with 60 frames;
when the current actual frame rate is higher than 60 frames, the working state information of the CPU is inquired at first, the current working frequency and the CPU core information of the key thread operation are obtained, then the working frequency of the CPU is dynamically reduced by combining the drawing data, specifically, the preset time length range can be set as a, and when the drawing time length is less than 16.6 milliseconds or the difference value of the drawing time length less than 16.6 milliseconds is greater than a, the working frequency of the CPU is reduced until the drawing time length belongs to (16.6-a, 16.6).
It should be noted that, the current actual frame rate is calculated according to the drawing time, and in the actual use of some target applications, a frame locking situation may occur, that is, the target application may lock the maximum frame rate to 60 frames, and at this time, the current actual frame rate of the target application may be 60 frames, but the actual frame rate calculated according to the drawing time is greater than 60 frames.
It is to be understood that the application scenario is an alternative embodiment, and does not represent a limitation of the present application, and the embodiment may also be applied to various application programs such as a video application, a camera application, a user interaction application, and the like, and is not limited to a game application.
Therefore, whether the current frame rate of the target application meets the requirement of the target frame rate is determined by obtaining the drawing data, and the working frequency of the CPU is dynamically improved by combining the current working state of the CPU and the drawing data, so that the phenomenon of frame dropping and blocking is avoided, the use experience of a user when the target application program is used is greatly improved, and meanwhile, when the working frequency of the CPU is too high, the working frequency of the CPU is dynamically reduced by combining the current working state of the CPU and the drawing data, so that the performance waste of the CPU is avoided.
The following is a schematic flow chart of another method for controlling a frequency of a central processing unit in the embodiment of the present application, which reflects relevant steps as a whole, and as shown in fig. 7, the specific steps include:
If the target application has a frame drop condition, executing step 703; if the target application does not have a frame drop, step 705 is executed.
If the cpu is in a full load operating state, step 704 is executed.
If the cpu is in a performance excess state, go to step 706; if the cpu is not in the performance excess state, the operation of step 701 is repeatedly executed.
The steps that are not described in detail may refer to some or all of the method steps in fig. 2, fig. 3, fig. 4, and fig. 5, and are not described again here.
By the method, whether the target application is in the frame dropping and blocking state or not can be judged based on the drawing data, the working frequency of the CPU is dynamically increased to prevent the target application from being in the frame dropping and blocking state, the performance of the CPU is saved to the maximum extent when the frame dropping and blocking state does not exist, and the power consumption of the electronic equipment is reduced while the use experience of a user is not influenced.
The above description has introduced the solution of the embodiment of the present application mainly from the perspective of the method-side implementation process. It is understood that the above methods can be implemented independently or in combination, and the electronic device includes hardware structures and/or software modules for performing the above functions. Those of skill in the art will readily appreciate that the present application is capable of hardware or a combination of hardware and computer software implementing the various illustrative elements and algorithm steps described in connection with the embodiments provided herein. Whether a function is performed as hardware or computer software drives hardware depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the embodiment of the present application, the electronic device may be divided into the functional units according to the method example, for example, each functional unit may be divided corresponding to each function, or two or more functions may be integrated into one processing unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit. It should be noted that the division of the unit in the embodiment of the present application is schematic, and is only a logic function division, and there may be another division manner in actual implementation.
In the case of dividing each functional module according to each function, fig. 8 shows a functional unit composition block diagram of a control apparatus for a central processing unit frequency according to the above embodiment. As shown in fig. 8, the apparatus 800 for controlling the frequency of the cpu includes:
an obtaining unit 810, configured to obtain drawing data of a key thread corresponding to a target application, where the key thread includes a user interface thread;
a dropped frame judging unit 820, configured to judge whether a dropped frame situation exists in the target application based on the drawing data;
a processor determining unit 830, configured to determine whether the central processing unit is in a full-load working state when the target application has the frame dropping condition;
a frequency control unit 840, configured to, when the central processing unit is not in the full load operating state, increase the operating frequency of the central processing unit based on the drawing data.
All relevant contents of each step related to the above method embodiment may be referred to the functional description of the corresponding functional module, and are not described herein again.
In the case of an integrated unit, fig. 9 is a block diagram of functional units of another cpu frequency control apparatus 900 according to the embodiment of the present application. The control device 900 for the central processor frequency is applied to an electronic device supporting a display function, the electronic device includes a processor, a display module, and the like, the control device 900 for the central processor frequency includes a processing unit 901 and a communication unit 902, wherein the processing unit 901 is configured to execute any step in the above method embodiments, and when data transmission such as sending is performed, the communication unit 902 is optionally invoked to complete the corresponding operation.
The control device 900 for controlling the frequency of the central processing unit may further include a storage unit 903 for storing program codes and data of the electronic device. The processing unit 901 may be a central processing unit, the communication unit 902 may be a touch display screen or a transceiver, and the storage unit 903 may be a memory.
It can be understood that, since the method embodiment and the apparatus embodiment are different presentation forms of the same technical concept, the content of the method embodiment portion in the present application should be synchronously adapted to the apparatus embodiment portion, and is not described herein again. The cpu frequency control apparatus 800 and the cpu frequency control apparatus 900 may each perform the method for controlling the frequency of the whole cpu included in the above embodiments,
embodiments of the present application also provide a computer storage medium, where the computer storage medium stores a computer program for electronic data exchange, the computer program enabling a computer to execute part or all of the steps of any one of the methods described in the above method embodiments, and the computer includes an electronic device.
Embodiments of the present application also provide a computer program product comprising a non-transitory computer readable storage medium storing a computer program operable to cause a computer to perform some or all of the steps of any of the methods as described in the above method embodiments. The computer program product may be a software installation package, the computer comprising an electronic device.
It should be noted that, for simplicity of description, the above-mentioned method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present application is not limited by the order of acts described, as some steps may occur in other orders or concurrently depending on the application. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and modules referred to are not necessarily required in this application.
In the foregoing embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus may be implemented in other manners. For example, the above-described embodiments of the apparatus are merely illustrative, and for example, the above-described division of the units is only one type of division of logical functions, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of some interfaces, devices or units, and may be an electric or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit may be stored in a computer readable memory if it is implemented in the form of a software functional unit and sold or used as a stand-alone product. Based on such understanding, the technical solution of the present application may be substantially implemented or a part of or all or part of the technical solution contributing to the prior art may be embodied in the form of a software product stored in a memory, and including several instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the above-mentioned method of the embodiments of the present application. And the aforementioned memory comprises: a U-disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic or optical disk, and other various media capable of storing program codes.
Those skilled in the art will appreciate that all or part of the steps in the methods of the above embodiments may be implemented by associated hardware instructed by a program, which may be stored in a computer-readable memory, which may include: flash Memory disks, Read-Only memories (ROMs), Random Access Memories (RAMs), magnetic or optical disks, and the like.
The foregoing detailed description of the embodiments of the present application has been presented to illustrate the principles and implementations of the present application, and the above description of the embodiments is only provided to help understand the method and the core concept of the present application; meanwhile, for a person skilled in the art, according to the idea of the present application, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present application.
Claims (11)
1. A control method of a central processing unit frequency is applied to electronic equipment, and is characterized by comprising the following steps:
obtaining drawing data of a key thread corresponding to a target application, wherein the key thread comprises a user interface thread;
judging whether the target application has a frame drop condition or not based on the drawing data;
if the frame dropping condition exists in the target application, judging whether the central processing unit is in a full-load working state;
and if the central processing unit is not in the full-load working state, improving the working frequency of the central processing unit based on the drawing data.
2. The method of claim 1, wherein said drawing data includes a drawing duration consumed by drawing a frame of image, and said increasing the operating frequency of the central processing unit based on said drawing data comprises:
calculating based on the target frame rate data corresponding to the target application to obtain a drawing time condition;
and increasing the working frequency of the central processing unit until the drawing time meets the drawing time condition.
3. The method of claim 1, wherein said boosting the operating frequency of the central processor based on the rendering data comprises:
determining current frequency data of the central processor based on the plotted data;
acquiring target frequency data corresponding to the target application, wherein the target frequency data represents the working frequency of the central processing unit required by the target application when reaching a target frame rate;
determining frequency boost value data for a central processor based on a difference between the current frequency data and the target frequency data;
and increasing the working frequency of the central processing unit based on the working frequency increasing value.
4. The method of claim 1, wherein the determining whether the target application has a dropped frame condition based on the drawing data comprises:
acquiring target frame rate data of the target application;
calculating based on the drawing data to obtain actual frame rate data of the target application;
and judging whether the target application has a frame drop condition by judging whether the actual frame rate data conforms to the target frame rate data.
5. The method of claim 4, wherein the actual frame rate data comprises an actual frame rate, the target frame rate data comprises a target frame rate and a preset frame drop duration, and the determining whether the target application has a frame drop condition by determining whether the actual frame rate data conforms to the target frame rate data comprises:
acquiring the frame dropping time length of the actual frame rate lower than the target frame rate;
and judging whether the frame dropping condition exists in the target application or not by judging whether the frame dropping time length is greater than the preset frame dropping time length or not.
6. The method of claim 1, wherein determining whether a central processing unit of the electronic device is in a full load operating state comprises:
inquiring the current working frequency and the current working core of the central processing unit;
and judging whether a central processing unit of the electronic equipment is in a full-load working state or not by judging whether the current working frequency reaches a preset frequency or whether the current working core is a main working core.
7. The method of claim 6, wherein said querying the current operating frequency and current operating core of the central processor comprises:
acquiring the identity identification data of the key thread;
and inquiring the current working frequency of the central processing unit and the current working core corresponding to the key thread based on the identification data.
8. The method of claim 1, wherein after determining whether the target application has a dropped frame condition based on the rendering data, the method further comprises:
and if the target application does not have the frame drop condition, reducing the working frequency of the central processing unit based on the drawing data.
9. An apparatus for controlling a frequency of a central processing unit, the apparatus comprising:
the device comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring drawing data of a key thread corresponding to a target application, and the key thread comprises a user interface thread;
a frame drop judging unit, configured to judge whether a frame drop condition exists in the target application based on the drawing data;
the processor judging unit is used for judging whether the central processing unit is in a full-load working state or not when the frame dropping condition exists in the target application;
and the frequency control unit is used for increasing the working frequency of the central processing unit based on the drawing data when the central processing unit is not in the full-load working state.
10. An electronic device comprising a processor, a memory, and one or more programs stored in the memory and configured for execution by the processor, the programs comprising instructions for performing the steps of the method of any of claims 1-8.
11. A computer storage medium, characterized in that the computer storage medium stores a computer program comprising program instructions that, when executed by a processor, cause the processor to perform the method according to any one of claims 1 to 8.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010208321.6A CN111338838A (en) | 2020-03-23 | 2020-03-23 | Method for controlling frequency of central processing unit and related device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010208321.6A CN111338838A (en) | 2020-03-23 | 2020-03-23 | Method for controlling frequency of central processing unit and related device |
Publications (1)
Publication Number | Publication Date |
---|---|
CN111338838A true CN111338838A (en) | 2020-06-26 |
Family
ID=71186199
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010208321.6A Pending CN111338838A (en) | 2020-03-23 | 2020-03-23 | Method for controlling frequency of central processing unit and related device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111338838A (en) |
Cited By (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111831462A (en) * | 2020-07-01 | 2020-10-27 | Oppo广东移动通信有限公司 | IO request processing method and device, storage medium and electronic equipment |
CN111831439A (en) * | 2020-07-01 | 2020-10-27 | Oppo广东移动通信有限公司 | IO request processing method and device, storage medium and electronic equipment |
CN111930464A (en) * | 2020-10-14 | 2020-11-13 | 蘑菇车联信息科技有限公司 | Resource allocation method and device of map engine and electronic equipment |
CN112114975A (en) * | 2020-10-28 | 2020-12-22 | Oppo广东移动通信有限公司 | Processor frequency adjusting method and device, storage medium and electronic equipment |
CN112130940A (en) * | 2020-08-25 | 2020-12-25 | 北京小米移动软件有限公司 | Terminal control method and device, storage medium and electronic equipment |
CN112578896A (en) * | 2020-12-18 | 2021-03-30 | Oppo(重庆)智能科技有限公司 | Frequency adjusting method, frequency adjusting device, electronic apparatus, and storage medium |
WO2022135014A1 (en) * | 2020-12-21 | 2022-06-30 | 深圳市万普拉斯科技有限公司 | Graphics pipeline adjustment method and apparatus, computer device, and storage medium |
CN115103210A (en) * | 2022-07-12 | 2022-09-23 | 北京字跳网络技术有限公司 | Information processing method, device, terminal and storage medium |
CN115268713A (en) * | 2022-07-20 | 2022-11-01 | Oppo广东移动通信有限公司 | Thread identification method and device, storage medium and electronic equipment |
CN117130766A (en) * | 2023-01-17 | 2023-11-28 | 荣耀终端有限公司 | Thread processing method and electronic equipment |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106020990A (en) * | 2016-06-30 | 2016-10-12 | 宇龙计算机通信科技(深圳)有限公司 | Control method for central processing unit and terminal equipment |
CN106681833A (en) * | 2016-12-27 | 2017-05-17 | 宇龙计算机通信科技(深圳)有限公司 | Method and device for regulating CPU frequency |
CN109831585A (en) * | 2019-02-22 | 2019-05-31 | 维沃移动通信有限公司 | A kind of operating parameter method of adjustment and mobile terminal |
CN109857559A (en) * | 2019-01-25 | 2019-06-07 | 维沃移动通信有限公司 | Terminal control method and terminal |
CN109960584A (en) * | 2019-01-30 | 2019-07-02 | 努比亚技术有限公司 | CPU frequency modulation control method, terminal and computer readable storage medium |
-
2020
- 2020-03-23 CN CN202010208321.6A patent/CN111338838A/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106020990A (en) * | 2016-06-30 | 2016-10-12 | 宇龙计算机通信科技(深圳)有限公司 | Control method for central processing unit and terminal equipment |
CN106681833A (en) * | 2016-12-27 | 2017-05-17 | 宇龙计算机通信科技(深圳)有限公司 | Method and device for regulating CPU frequency |
CN109857559A (en) * | 2019-01-25 | 2019-06-07 | 维沃移动通信有限公司 | Terminal control method and terminal |
CN109960584A (en) * | 2019-01-30 | 2019-07-02 | 努比亚技术有限公司 | CPU frequency modulation control method, terminal and computer readable storage medium |
CN109831585A (en) * | 2019-02-22 | 2019-05-31 | 维沃移动通信有限公司 | A kind of operating parameter method of adjustment and mobile terminal |
Cited By (15)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111831462A (en) * | 2020-07-01 | 2020-10-27 | Oppo广东移动通信有限公司 | IO request processing method and device, storage medium and electronic equipment |
CN111831439A (en) * | 2020-07-01 | 2020-10-27 | Oppo广东移动通信有限公司 | IO request processing method and device, storage medium and electronic equipment |
CN112130940A (en) * | 2020-08-25 | 2020-12-25 | 北京小米移动软件有限公司 | Terminal control method and device, storage medium and electronic equipment |
CN112130940B (en) * | 2020-08-25 | 2023-11-17 | 北京小米移动软件有限公司 | Terminal control method and device, storage medium and electronic equipment |
CN111930464A (en) * | 2020-10-14 | 2020-11-13 | 蘑菇车联信息科技有限公司 | Resource allocation method and device of map engine and electronic equipment |
CN112114975A (en) * | 2020-10-28 | 2020-12-22 | Oppo广东移动通信有限公司 | Processor frequency adjusting method and device, storage medium and electronic equipment |
CN112114975B (en) * | 2020-10-28 | 2023-06-27 | Oppo广东移动通信有限公司 | Processor frequency adjusting method and device, storage medium and electronic equipment |
CN112578896B (en) * | 2020-12-18 | 2023-03-28 | Oppo(重庆)智能科技有限公司 | Frequency adjusting method, frequency adjusting device, electronic apparatus, and storage medium |
CN112578896A (en) * | 2020-12-18 | 2021-03-30 | Oppo(重庆)智能科技有限公司 | Frequency adjusting method, frequency adjusting device, electronic apparatus, and storage medium |
WO2022135014A1 (en) * | 2020-12-21 | 2022-06-30 | 深圳市万普拉斯科技有限公司 | Graphics pipeline adjustment method and apparatus, computer device, and storage medium |
CN115103210A (en) * | 2022-07-12 | 2022-09-23 | 北京字跳网络技术有限公司 | Information processing method, device, terminal and storage medium |
CN115103210B (en) * | 2022-07-12 | 2024-02-20 | 北京字跳网络技术有限公司 | Information processing method, device, terminal and storage medium |
CN115268713A (en) * | 2022-07-20 | 2022-11-01 | Oppo广东移动通信有限公司 | Thread identification method and device, storage medium and electronic equipment |
CN117130766A (en) * | 2023-01-17 | 2023-11-28 | 荣耀终端有限公司 | Thread processing method and electronic equipment |
CN117130766B (en) * | 2023-01-17 | 2024-06-07 | 荣耀终端有限公司 | Thread processing method and electronic equipment |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111338838A (en) | Method for controlling frequency of central processing unit and related device | |
CN108491275B (en) | Program optimization method, device, terminal and storage medium | |
US10460643B2 (en) | Method, device and non-transitory computer-readable storage medium for controlling frame rate of mobile terminal | |
CN116501210B (en) | Display method, electronic equipment and storage medium | |
CN114443269B (en) | Frame rate adjusting method and related device | |
CN111147749A (en) | Photographing method, photographing device, terminal and storage medium | |
CN105677265A (en) | Display method and terminal | |
CN110262659B (en) | Application control method and related device | |
CN108170361B (en) | Application running state control method and mobile terminal | |
CN111078172B (en) | Display fluency adjusting method and device, electronic equipment and storage medium | |
CN112203034B (en) | Frame rate control method and device and electronic equipment | |
CN111813490A (en) | Method and device for processing interpolation frame | |
CN111124668A (en) | Memory release method and device, storage medium and terminal | |
CN108549575B (en) | Processing method and device for quitting split screen, storage medium and electronic equipment | |
CN114077465A (en) | UI (user interface) rendering method and device, electronic equipment and storage medium | |
CN111949239A (en) | Screen sharing method and device, storage medium and terminal | |
CN108334349B (en) | Mobile terminal, display image switching method thereof and computer-readable storage medium | |
CN111767136B (en) | Process management method, terminal and device with storage function | |
CN114327714A (en) | Application program control method, device, equipment and medium | |
CN113610699A (en) | Hardware layer rendering scheduling method, device, equipment and storage medium | |
CN112416131A (en) | Terminal control method and electronic equipment | |
CN114710804A (en) | Data transmission adjusting method and device, electronic equipment and readable storage medium | |
CN112637409B (en) | Content output method and device and electronic equipment | |
CN112905269A (en) | Network access method, device, terminal and storage medium of application program | |
CN114339410A (en) | Frame insertion method and device and electronic equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20200626 |
|
RJ01 | Rejection of invention patent application after publication |