CN112631415B - CPU frequency adjusting method, device, electronic equipment and storage medium - Google Patents

CPU frequency adjusting method, device, electronic equipment and storage medium Download PDF

Info

Publication number
CN112631415B
CN112631415B CN202011627467.0A CN202011627467A CN112631415B CN 112631415 B CN112631415 B CN 112631415B CN 202011627467 A CN202011627467 A CN 202011627467A CN 112631415 B CN112631415 B CN 112631415B
Authority
CN
China
Prior art keywords
cpu
scene
historical
frequency
current
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.)
Active
Application number
CN202011627467.0A
Other languages
Chinese (zh)
Other versions
CN112631415A (en
Inventor
苏钰
常欣宇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Oppo Chongqing Intelligent Technology Co Ltd
Original Assignee
Oppo Chongqing Intelligent Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Oppo Chongqing Intelligent Technology Co Ltd filed Critical Oppo Chongqing Intelligent Technology Co Ltd
Priority to CN202011627467.0A priority Critical patent/CN112631415B/en
Publication of CN112631415A publication Critical patent/CN112631415A/en
Application granted granted Critical
Publication of CN112631415B publication Critical patent/CN112631415B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F1/00Details not covered by groups G06F3/00 - G06F13/00 and G06F21/00
    • G06F1/26Power supply means, e.g. regulation thereof
    • G06F1/32Means for saving power
    • G06F1/3203Power management, i.e. event-based initiation of a power-saving mode
    • G06F1/3234Power saving characterised by the action undertaken
    • G06F1/329Power saving characterised by the action undertaken by task scheduling
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Power Sources (AREA)
  • Supply And Distribution Of Alternating Current (AREA)

Abstract

The application discloses a CPU frequency adjusting method and device, electronic equipment and a storage medium. The CPU frequency adjusting method comprises the following steps: acquiring current state data of a CPU at the current time; determining the current operation scene of the CPU at the current time from a plurality of operation scenes of the CPU according to the current state data, wherein the plurality of operation scenes of the CPU are determined based on the historical state data of the CPU at different historical times; determining a predicted operation scene of the CPU at the next moment of the current moment based on the current operation scene and a pre-trained scene prediction model, wherein the scene prediction model is obtained by training according to historical operation scenes of the CPU at different historical moments; and adjusting the CPU frequency according to the predicted operation scene. According to the method and the device, the running scene of the CPU at the next moment can be predicted in advance through the current state data of the CPU, so that the CPU frequency can be accurately adjusted in advance according to the predicted running scene in advance, and the timeliness and the accuracy of the adjustment of the CPU frequency are guaranteed.

Description

CPU frequency adjusting method, device, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of electronic devices, and more particularly, to a method and an apparatus for adjusting a CPU frequency, an electronic device, and a storage medium.
Background
With the development of computer technology, electronic devices such as smart phones, tablet computers and desktop computers play an increasingly higher role in the life of people. To save power consumption of the electronic device, the operating system generally adaptively adjusts the operating frequency of a Central Processing Unit (CPU). However, the existing CPU has a single adjustment policy, and cannot meet the requirements of different scenes.
Disclosure of Invention
In view of the above problems, the present application provides a method, an apparatus, an electronic device and a storage medium for adjusting a CPU frequency, which can improve the above problems.
In a first aspect, an embodiment of the present application provides a method for adjusting a CPU frequency, where the method includes: acquiring current state data of a CPU at the current time; determining the current running scene of the CPU at the current time from a plurality of running scenes of the CPU according to the current state data, wherein the plurality of running scenes of the CPU are determined based on historical state data of the CPU at different historical times; determining a predicted operation scene of the CPU at the next moment of the current moment based on the current operation scene and a pre-trained scene prediction model, wherein the scene prediction model is obtained by training according to historical operation scenes of the CPU at different historical moments; and adjusting the CPU frequency according to the predicted operation scene.
In a second aspect, an embodiment of the present application provides an apparatus for adjusting a CPU frequency, where the apparatus includes: the state acquisition module is used for acquiring the current state data of the CPU at the current moment; a scene determining module, configured to determine, according to the current state data, a current operating scene of the CPU at the current time from multiple operating scenes of the CPU, where the multiple operating scenes of the CPU are determined based on historical state data of the CPU at different historical times; the scene prediction module is used for determining a predicted operation scene of the CPU at the next moment of the current moment based on the current operation scene and a pre-trained scene prediction model, and the scene prediction model is obtained by training according to historical operation scenes of the CPU at different historical moments; and the frequency adjusting module is used for adjusting the CPU frequency according to the predicted operation scene.
In a third aspect, an embodiment of the present application provides an electronic device, including: one or more processors; a memory; one or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the one or more processors, the one or more application programs being configured to perform the CPU frequency adjustment method provided in the first aspect above.
In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, where a program code is stored in the computer-readable storage medium, and the program code may be called by a processor to execute the method for adjusting the CPU frequency provided in the first aspect.
According to the scheme provided by the application, the current state data of the CPU at the current time is obtained, so that the current operation scene of the CPU at the current time is determined from a plurality of operation scenes of the CPU according to the current state data, wherein the plurality of operation scenes of the CPU are determined based on the historical state data of the CPU at different historical times. And then determining a predicted operation scene of the CPU at the next moment of the current moment based on the current operation scene and a pre-trained scene prediction model, and adjusting the frequency of the CPU according to the predicted operation scene, wherein the scene prediction model is obtained by training according to historical operation scenes of the CPU at different historical moments. According to the method and the device, the internal relation between the state data of the CPU and the running scenes of the CPU in the using process of the electronic equipment is mined by analyzing the historical state data of the CPU at different historical moments, so that the change rule between the running scenes of the CPU at different historical moments is mined and learned. Therefore, the running scene of the CPU at the next moment can be predicted in advance through the current state data of the CPU, and the CPU frequency can be accurately adjusted in advance according to the predicted running scene in advance, so that the timeliness and the accuracy of the CPU frequency adjustment are ensured.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the description below are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 shows a flow chart of a CPU frequency adjustment method according to an embodiment of the present application.
Fig. 2 shows a flowchart of a CPU frequency adjustment method according to another embodiment of the present application.
Fig. 3 shows a flowchart of step S280 in the CPU frequency adjusting method according to another embodiment of the present application.
Fig. 4 shows a flowchart of step S290 in the CPU frequency adjustment method according to another embodiment of the present application.
Fig. 5 shows another flowchart of step S290 in the CPU frequency adjustment method according to another embodiment of the present application.
FIG. 6 shows a flow chart of a CPU frequency adjustment method according to yet another embodiment of the present application.
Fig. 7 shows a block diagram of a CPU frequency adjustment apparatus according to an embodiment of the present application.
Fig. 8 is a block diagram of an electronic device for executing a CPU frequency adjustment method according to an embodiment of the present application.
Fig. 9 is a storage unit for storing or carrying a program code implementing the CPU frequency adjustment method according to the embodiment of the present application.
Detailed Description
In order to make the technical solutions better understood by those skilled in the art, 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.
Currently, in order to save energy consumption of an electronic device, an operating system generally adaptively adjusts a working frequency of a Central Processing Unit (CPU). Taking an operating system as an Android (Android) system as an example, the Android system is based on a Linux kernel, and two adjustment strategies for a CPU are provided in Linux: a scheduler strategy based on load sampling and a CPU frequency modulation mechanism based on the scheduler. The scheduler strategy based on load sampling comprises a load sampling module, the CPU load needs to be calculated at regular intervals, and the CPU frequency modulation mechanism based on the scheduler is obtained by improving the scheduler strategy based on load sampling because the scheduler can obtain the CPU load by itself and does not need to do load sampling. Through the strategies, the operating system can realize the change and adjustment of the running frequency of the CPU according to the system load condition so as to achieve the balance between the performance and the power consumption. That is, the current mainstream idea is to ensure that the CPU of the electronic device can achieve both performance and power consumption by using the mapping relationship between the load and the frequency strongly related thereto.
The inventor finds that, in several modes in the scheduler strategy based on load sampling, no matter the on demand mode or the Interactive alternating current loop mode is biased to high-frequency execution, for example, in a user click behavior or an application execution process, a strategy is triggered to cause the highest frequency modulation of a CPU, but in this scenario, rapid adjustment to the highest frequency is not required, and this frequency modulation often causes increased energy consumption. In a game scene or a scene needing high CPU requirements, the CPU is insensitive to the frequency requirements and requirements in the scene, so that the adjustment is not timely when high-frequency operation is needed, and frame dropping or a pause phenomenon occurs. For the CPU frequency modulation mechanism based on the scheduler, although the response speed is improved to a certain extent, the adjustment opportunity is more timely compared with the scheduler strategy based on load sampling, the burden of the scheduler is increased, and an additional thread is needed to prevent the CPU from sleeping. And the strategy also lacks a solution of excessive performance, and also faces the problems of overhigh energy consumption and the like in some strong interaction scenes.
In other words, the performance of Android performance and power consumption are not well balanced by the current CPU frequency modulation strategy, performance of several modes in performance and power consumption is good or bad, and internal relations among Application programs (APPs) with different functions, scenes and users and the CPU frequency are not mined, so that the same set of CPU frequency modulation strategy is used by different APPs or users with different requirements, and the differentiated optimization result is poor.
The inventor finds and provides a method, a device, an electronic device and a storage medium for adjusting the frequency of the CPU provided by the embodiment of the application through long-term research, and provides a brand-new method for dynamically adjusting the frequency of the CPU, namely an intelligent frequency adjustment based on historical frequency point data of the CPU of a user, which is different from a traditional Dynamic frequency adjustment scheme based on a Dynamic voltage and frequency scaling (Dynamic voltage and frequency adjustment) of DVFS (Dynamic voltage and frequency adjustment) (by setting the size of a threshold of a load, when the load is higher than a current threshold, the frequency point of the CPU is increased, and when the load is lower than the current threshold, the frequency point of the CPU is decreased), so that a balance point of performance and power consumption is achieved. By mining the internal relation between the state data of the CPU and the operation scenes of the CPU in the using process of the electronic equipment, the change rule between the operation scenes of the CPU at different historical moments is mined and learned, so that the scenes with strong user performance requirements are predicted in advance, corresponding frequency increasing is performed in advance, the scenes with strong user power consumption requirements are extracted and predicted, and corresponding frequency reducing operation is performed in advance. The specific CPU frequency adjustment method is explained in detail in the following embodiments.
Referring to fig. 1, fig. 1 is a schematic flowchart illustrating a CPU frequency adjustment method according to an embodiment of the present disclosure. In a specific embodiment, the CPU frequency adjusting method can be applied to the CPU frequency adjusting apparatus 700 shown in fig. 7 and the electronic device (fig. 8) equipped with the CPU frequency adjusting apparatus 700. As will be described in detail with respect to the flow shown in fig. 1, the CPU frequency adjustment method may specifically include the following steps:
step S110: and acquiring the current state data of the CPU at the current time.
In the embodiment of the present application, the CPU state data may be data for characterizing the operating state of the CPU, which may be operating frequency data of the CPU, operating power consumption data of the CPU, operating performance data of the CPU, and the like, and is not limited herein. When the CPU is a multi-core processor, the operating frequency data, the operating power consumption data, and the operating performance data of the CPU may also be operating frequency data, operating power consumption data, and operating performance data of each CPU core during operation, and the type of the CPU is not limited here.
In the embodiment of the application, the electronic device can acquire the current state data of the CPU at the current moment in real time so as to predict the frequency requirement at the next moment in advance, thereby realizing accurate frequency modulation in advance. As a mode, the electronic device may obtain, in real time, current state data of the CPU at a current time according to a preset sampling time interval, so as to predict, in advance, a frequency requirement at a next time. The time distance between the next time and the current time may be a sampling time interval, and the sampling time interval may be set reasonably according to actual requirements, and is not limited herein, for example, the sampling time interval may be set to 100ms, 200ms, and the like. Therefore, the electronic equipment can acquire the state data of the CPU at each moment and can also predict the state data of the CPU at each moment.
In some embodiments, when the current status data of the CPU includes the operating frequency data of the CPU, the operating frequency data of the CPU may be a specific operating frequency value, or may be a pre-divided frequency bin value. When the operating frequency data of the CPU is the operating frequency gear value of the CPU, the electronic device may acquire real-time operating frequency gear information of all CPU cores. As one mode, the electronic device may obtain the Linux kernel information through a command line, so that the real-time operation frequency step information of all cores may be obtained from the Linux kernel information.
In some embodiments, when the current state data of the CPU includes the operation power consumption data of the CPU, the operation power consumption data of the CPU may be various index data for evaluating the power consumption of the CPU. As one mode, data such as Bandwidth, frame length, RunningTime, and the like may be obtained and collectively used as a measurement index of CPU power consumption. The running time RunningTime may be the running time of the CPU in the sampling time interval T1. Alternatively, the index data may be substituted into the following power consumption formula: power ═ w 1 ×RunningTime+w 2 ×FrameLength+w 3 And multiplying the Bandwidth + bias to calculate the power consumption data of the CPU.
In some embodiments, when the current state data of the CPU includes the operational performance data of the CPU, the operational performance data of the CPU may be various index data for evaluating the performance of the CPU. As one mode, the real-time instruction execution count instractioncount in the Linux kernel may be obtained, which may be used to evaluate the real-time performance state of the CPU, or the access conditions of the Cache, L3CacheMissCount, L2CacheMissCount, and instractioncount, may be obtained together as performance indexes for evaluating the CPU, or load information, frame rate information, and the like during the operation of the CPU may be obtained as index data for measuring performance. Without limitation, it is only necessary to be able to evaluate the CPU performance state. For example, the CPU operating performance data may be determined by acquiring status information (schedulstat information) of processes having different PIDs (Process Identification numbers) of the CPU.
It should be understood that the above-mentioned operating power consumption data of the CPU and the operating performance data of the CPU are only examples, and the operating power consumption data of the CPU and the operating performance data of the CPU are not limited in this application.
Step S120: and determining the current operation scene of the CPU at the current time from a plurality of operation scenes of the CPU according to the current state data, wherein the plurality of operation scenes of the CPU are determined based on the historical state data of the CPU at different historical times.
In the embodiment of the application, a plurality of operation scenes of the CPU can be determined according to the historical state data of the CPU of the electronic device at different historical times, wherein each operation scene of the CPU can be used to characterize the scene classification result of the CPU performance and the power consumption in the operation process of the CPU. Therefore, the internal relation between the state data of the CPU and the running scene of the CPU in the process of using the electronic equipment by the user is mined. Therefore, the plurality of running scenes of the CPU are excavated through the historical state data of the CPU, so that the excavated running scenes of the CPU can be differentiated when different users use the electronic equipment, and the requirement of the running scenes of the CPU, which is more suitable for the current users, can be obtained. The running scene of a plurality of fixed CPUs which is not set manually and is suitable for all users.
In the unsupervised learning algorithm, the data type is unknown, that is, the type is not manually labeled in advance, and the intrinsic properties and rules of the data need to be automatically mined and found, so that the data with similar intrinsic properties and rules are automatically divided together to obtain a plurality of division results, that is, the data are automatically divided into a plurality of classes. Therefore, in some embodiments, the above-mentioned determining multiple operating scenarios of the CPU according to the historical state data of the CPU at different historical times may be performed by classifying the historical state data of the CPU through an unsupervised learning algorithm, so as to determine the multiple operating scenarios of the CPU according to the classification result. As one mode, a historical state data set of a CPU in an electronic device used by a user may be collected according to a certain time window, then the historical state data set is subjected to feature extraction and feature analysis, and then mapped into a feature space in a specific manner, and then the feature space is classified according to an unsupervised learning algorithm to obtain a plurality of classification results, so that a plurality of operating scenarios of the CPU are determined according to the plurality of classification results. Therefore, the CPU state data with similar internal properties and laws can be divided into the same CPU operation scene, and the internal relation between the CPU state data and the CPU operation scene is further excavated.
In some embodiments, after obtaining a plurality of classification results based on the historical state data of the CPU at different historical times, an operation scenario may be defined for each classification result, so as to characterize the scenario classification results of the CPU performance and the power consumption in the CPU operation process. For example, there is an M-class result, which may be defined as an M-class operation scenario during the operation of the CPU, and the M-class may be defined as M-classes from low to high, which are sequentially defined as CPU excess performance, CPU excessive power consumption and CPU insufficient power consumption, and thus embody the CPU performance and power consumption during the operation of the CPU.
In this embodiment of the application, after obtaining a plurality of operating scenes of the CPU determined based on the historical state data of the CPU, the electronic device may determine, according to the current state data, a current operating scene of the CPU at a current time from the plurality of operating scenes of the CPU. Because a plurality of operation scenes of the CPU are determined according to the historical state data of the CPU with similar internal properties and rules, if the historical state data of the CPU with similar internal properties and rules with the current state data exists, the current operation scene of the CPU at the current moment can be determined from the plurality of operation scenes of the CPU.
In some embodiments, the historical state data with the maximum similarity may be determined by obtaining the similarity between the current state data of the CPU and the historical state data of the CPU, so that a CPU operation scene divided by the historical state data with the maximum similarity may be used as the current operation scene of the CPU.
Step S130: and determining the predicted operation scene of the CPU at the next moment of the current moment based on the current operation scene and a pre-trained scene prediction model, wherein the scene prediction model is obtained by training according to the historical operation scenes of the CPU at different historical moments.
In the embodiment of the present application, the pre-trained scene prediction model may be generated by training in advance according to a large number of training samples by a machine learning method. The training sample may be a historical operating scene of the CPU at different adjacent historical times when the user uses the electronic device, and the machine learning method may be a random forest method, a neural network method, a decision tree method, or the like, which is not limited herein. Therefore, the pre-trained scene prediction model can be used for outputting the predicted operation scene of the CPU at the next adjacent moment according to the current operation scene at the current moment, so that the performance and power consumption demand scene of the CPU at the next moment can be predicted in advance, and the targeted frequency adjustment can be extracted.
In some embodiments, the historical operating scenario of the CPU may be determined according to historical state data of the CPU. Specifically, since a plurality of operating scenarios of the CPU have been previously determined based on the historical state data of the CPU at different historical times, the historical operating scenarios of the CPU at all historical times can be determined according to the CPU operating scenarios divided by the historical state data at each historical time, respectively.
In some embodiments, the training and generating process of the scene prediction model may be performed in a server or on an electronic device, which is not limited herein. After the scene prediction model is trained and generated or updated in the server, the trained or updated scene prediction model can be sent to the electronic device, so that the pre-trained scene prediction model is deployed in the electronic device.
It can be understood that, if the CPU state data at the next time is predicted directly according to the CPU state data at the current time, since the CPU state data is more and more complex, not only the trained prediction model is more complex, but also the prediction accuracy is lower. Therefore, in the embodiment of the application, a layer of scene information can be abstracted based on the CPU state data, so that the next time scene is predicted through the current scene, the complexity of the model is reduced, the prediction accuracy is improved, and the model has better prediction effect and better robustness.
Step S140: and adjusting the CPU frequency according to the predicted operation scene.
In the embodiment of the application, after the operation scene of the CPU at the next time is predicted, the electronic device may determine the scene requirements of the user on the performance and power consumption of the CPU in advance, so that the CPU frequency extraction may be adaptively adjusted according to the predicted operation scene. Because the CPU frequency is properly adjusted at the current moment, the CPU can just respond to the proper CPU frequency value at the next moment, thereby balancing the performance of the CPU and the performance of the power consumption in time, and improving the user embodiment, and the phenomenon of frame dropping or blocking.
For example, if the predicted CPU running scene at the next moment is a scene with a relatively strong performance requirement, the electronic device may perform a corresponding frequency-up operation, that is, increase the CPU frequency step; if the predicted CPU operation scene at the next moment is a scene with a stronger power consumption requirement, the electronic equipment can perform corresponding frequency reduction operation, namely, the frequency gear of the CPU is reduced.
In some embodiments, a corresponding relationship between the CPU operating scenario and the CPU frequency adjustment policy may also be pre-established, so that after the predicted operating scenario of the CPU at the next time is predicted, the corresponding CPU frequency adjustment policy may be determined according to the corresponding relationship, and the CPU frequency may be accurately adjusted according to the CPU frequency adjustment policy.
According to the CPU frequency adjusting method provided by the embodiment of the application, the current state data of the CPU at the current time is obtained, so that the current operation scene of the CPU at the current time is determined from a plurality of operation scenes of the CPU according to the current state data, wherein the plurality of operation scenes of the CPU are determined based on the historical state data of the CPU at different historical times. And then determining a predicted operation scene of the CPU at the next moment of the current moment based on the current operation scene and a pre-trained scene prediction model, and adjusting the frequency of the CPU according to the predicted operation scene, wherein the scene prediction model is obtained by training according to historical operation scenes of the CPU at different historical moments. According to the method and the device, the internal relation between the state data of the CPU and the running scenes of the CPU in the using process of the electronic equipment is mined by analyzing the historical state data of the CPU at different historical moments, so that the change rule between the running scenes of the CPU at different historical moments is mined and learned. Therefore, the running scene of the CPU at the next moment can be predicted in advance through the current state data of the CPU, and the CPU frequency can be accurately adjusted in advance according to the predicted running scene in advance, so that the timeliness and the accuracy of the CPU frequency adjustment are ensured.
Referring to fig. 2, fig. 2 is a schematic flowchart illustrating a CPU frequency adjustment method according to another embodiment of the present application. As will be described in detail with respect to the flow shown in fig. 2, the CPU frequency adjustment method may specifically include the following steps:
step S200: and acquiring historical state data of the CPU at different historical times.
In some embodiments, in order to ensure the accuracy and richness of the mined state data of the CPU and the internal relation of the operating scene of the CPU, the state data of the CPU in different use states of the electronic device may be collected and stored according to a certain time window, that is, a sampling time period T1, so that the electronic device may acquire the historical state data of the CPU at different historical times. The electronic device may be in different use states, where the electronic device runs different application programs, and the running application programs may be one or more application programs, which is not limited herein, and only needs to acquire state data of the CPU in different situations.
For example, if the sampling time period T1 is set to 100 milliseconds, the electronic device may collect the state data of the CPU at intervals of 100 milliseconds, and each collection operation may be executed in 0 millisecond, 100 millisecond, 200 millisecond … …, and the like, so that the state data of the CPU at different times may be acquired.
Step S210: and carrying out clustering analysis on the historical state data to obtain a plurality of clustering results.
In some embodiments, a clustering algorithm may be used to classify historical state data, such that similar historical state data are partitioned together to obtain multiple clustering results. The clustering algorithm is one of unsupervised learning algorithms, and may be a K-means clustering algorithm, a K-medoids clustering algorithm, a Clara clustering algorithm, and the like, and the clustering algorithm may not be limited herein.
As a way, when the K-means clustering algorithm is used to perform clustering analysis on the historical state data, the preset number M of categories to be classified can be obtained. The historical state data can thus be divided into M clustering results using a clustering algorithm. Wherein, the clustering process may be:
randomly selecting M pieces of historical state data as M initial clustering centers, respectively calculating the similarity between each piece of historical state data and the M initial clustering centers, and respectively classifying each piece of historical state data to the initial clustering center with the highest similarity according to the calculation result to obtain M initial clustering results; respectively recalculating the respective clustering centers of the M initial clustering results according to the clustering results; and clustering each historical state data again according to the new clustering center, and continuously repeating the process until the clustering result is not changed any more, so as to obtain M final clustering results. The similarity between each piece of historical state data and the M initial clustering centers may be calculated by calculating an euclidean distance between each piece of historical state data and the M initial clustering centers, or by calculating a manhattan distance or a minkowski distance, which is not limited herein, and only the similarity between the two elements may be determined.
In some embodiments, the historical state data may be data processed prior to performing the cluster analysis. As a mode, when the state data of the CPU includes the operation frequency data of the CPU, the operation power consumption data of the CPU, and the operation performance data of the CPU, a corresponding characteristic vector value may be established for the operation frequency data of the CPU, the operation power consumption data of the CPU, and the operation performance data of the CPU at each time, and corresponding characteristic processing (for example, normalization and compensation of missing of a characteristic value may be performed on the characteristic vector value, and then the characteristic vector value after the characteristic processing is mapped into a characteristic space, so that each characteristic node in the characteristic space represents the CPU state data at one time.
Step S220: and determining an operation scene corresponding to each clustering result to obtain a plurality of operation scenes of the CPU, wherein different clustering results correspond to different operation scenes.
It can be understood that, since the acquired historical state data is the state data of a plurality of CPUs in the continuous sampling time, the state data of the CPUs at adjacent times can present a certain regularity, and the change trend and the height condition of the continuous state data can reflect the power consumption and the performance state, for example, when the operating frequency of the current CPU is high, the power consumption of the current CPU is generally high, and when the operating frequency of the CPU for a period of time is gradually increased, the performance deficiency of the current CPU can be generally reflected (when the performance of the CPU is deficient, the background needs to rapidly increase the operating frequency of the CPU). Therefore, the state data with similar intrinsic properties and rules can be clustered together through the clustering algorithm, and the CPU operation performance and power consumption scene corresponding to each clustering result can be determined according to the characteristics and rules of the clustered state data, so that the operation scene corresponding to each clustering result can be determined, and a plurality of operation scenes of the CPU can be obtained.
In some embodiments, since the operating frequency of the CPU may reflect the power consumption and performance status of the CPU to some extent, the collection of the historical status data, the cluster analysis, and the determination of the operating scenario may also be performed only according to the operating frequency of the CPU, so as to reduce the complexity of the calculation. Of course, the running power consumption data and the running performance data of the CPU can also be collected to serve as auxiliary analysis data, so that the classification accuracy of the running scene is improved.
It can be understood that, because different users use the electronic device with different requirements for performance and power consumption, the historical state data of the CPU and the internal relation of the operating scenario of the CPU may be mined only according to the historical state data of the CPU when each user uses the electronic device, that is, the operating scenarios that different users may excavate may be different. Therefore, the CPU frequency can be correspondingly adjusted according to the individualized CPU operation scene, the use experience of a user is improved, and meanwhile, the performance expression and the power consumption expression are optimized.
Step S230: and acquiring the current state data of the CPU at the current time.
In the embodiment of the present application, step S230 may refer to the contents of the foregoing embodiments, which are not described herein again.
Step S240: and acquiring the clustering center of each clustering result in the plurality of clustering results.
In some embodiments, after a plurality of operating scenarios of the CPU are mined according to the historical state data of the CPU, the current state data of the CPU at the current time may be obtained in real time, so as to determine the operating scenarios at the current time according to the data characteristics and rules of the current state data. Specifically, a plurality of clustering results after the CPU's historical state data is clustered may be obtained, and then the clustering center of each clustering result may be determined according to the plurality of clustering results, so as to determine a clustering center similar to the feature and rule of the CPU's current state data.
In some embodiments, the cluster center of each clustered result may refer to the center point of each clustered result. As one way, taking a certain clustering result as an example, a feature vector C of each historical state data in the clustering result may be obtained first, and then a clustering center G may be calculated according to the feature vector C of each historical state data. The clustering center G may be obtained by calculating the sum of the feature vectors C of all the historical state data and then dividing by the number of the historical state data in the clustering result.
Step S250: and acquiring the similarity value of the current state data and the clustering center of each clustering result.
In some embodiments, after the cluster center of each clustering result is obtained, the similarity value between the current state data and the cluster center of each clustering result may be obtained to determine the cluster center similar to the data characteristics and rules of the current state data. As one way, the calculating the similarity may be calculating the euclidean distance between the feature vector C of the current state data and the cluster center G of each cluster result. Therefore, the similarity between the current state data and the clustering center of each clustering result can be determined according to the numerical value of the Euclidean distance.
Step S260: and acquiring the target cluster center with the maximum similarity value from the plurality of cluster centers.
It can be understood that the greater the similarity value between the current state data and the cluster center of a certain cluster result, the more similar the data features and rules of the current state data and the data features and rules of the cluster center, so that the target cluster center most similar to the current state data can be determined from a plurality of cluster centers according to the maximum similarity value, and the CPU running length most matched with the current state data can be determined.
Step S270: and taking the operation scene corresponding to the target clustering center as the current operation scene of the CPU at the current moment.
After the target clustering center with the maximum similarity value is determined, the data characteristics and the data rule presented by the target clustering center can be considered to be most similar to the current state data, so that the operation scene corresponding to the target clustering center can be used as the operation scene corresponding to the current state data, and the current operation scene of the CPU at the current moment can be obtained.
In some embodiments, in practical applications, the current state data of the CPU at the current time may also be collected in real time according to the sampling time period T2. Wherein, the sampling time period T2 may be the same as the sampling time period T1 when the aforementioned CPU operating scene is mined; or less than the sampling time period T1, to improve the prediction effect of the scene prediction model. If the sampling time period T2 is less than the sampling time period T1, when determining the current operating scene corresponding to the current state data, corresponding dimensionality reduction processing needs to be performed on the clustering center to reduce the dimensionality of the clustering center to the dimensionality same as the sampling time period T2, and then similarity calculation is performed.
Step S280: and determining the predicted operation scene of the CPU at the next moment of the current moment based on the current operation scene and a pre-trained scene prediction model, wherein the scene prediction model is obtained by training according to the historical operation scenes of the CPU at different historical moments.
In the embodiment of the application, after the current operation scene of the CPU at the current time is determined, the operation scene of the CPU at the next time at the current time can be predicted based on the current operation scene and a pre-trained scene prediction model, so that the scene requirement at the next time can be predicted in advance, frequency adjustment can be completed in advance, and performance of the performance and power consumption of the CPU can be balanced in time.
In some embodiments, referring to fig. 3, the pre-trained scene prediction model is obtained by training the following steps:
step S281: and acquiring historical operation scenes of the CPU at different historical moments.
In some embodiments, a historical operating scene of the CPU may be used as a training sample to train the scene prediction model, so that the scene prediction model may learn a rule of the operating scene change of the CPU, and thus the pre-trained scene prediction model may predict an operating scene at the next time according to the current operating scene. It can be understood that, because different users have different habits on using the electronic device, the operating scene change reflected to the CPU is different, and thus the trained scene prediction models are different.
In some embodiments, since the historical state data of the CPU at different historical times are obtained, the mined multiple operation scenes of the CPU may be used to perform scene tag classification on each historical state data, so that a scene tag result of each historical state data may be obtained, that is, the historical operation scenes of the CPU at different historical times are obtained. The historical operating scenarios of the CPU at the different historical times may subsequently be used to train training samples of the scene prediction model.
In some embodiments, the scene tag classification may be performed on each historical state data, and the historical operating scenario of the CPU at each historical time is determined from the plurality of operating scenarios of the mined CPU according to the historical state data at each historical time, so that the scene tag labeling may be performed on each historical state data. For a specific way of determining the historical operating scenario of the historical state data, reference may be made to the above way of determining the current operating scenario of the current state data, which is not described herein again.
In some embodiments, in order to ensure that the prediction result of the scene prediction model is more suitable for the use habit of the current user, the scene prediction model may also be trained by acquiring only the historical operating scene of the CPU in the latest time period.
Step S282: and acquiring a first operation scene at a first moment and a second operation scene at a second moment from the historical operation scenes, wherein the first moment is any historical moment, and the second moment is the next moment of the first moment.
In some embodiments, in order to learn the rule of the operating scene change of the CPU, the historical operating scenes at adjacent times may be used as training samples to train the scene prediction model, so that the trained scene prediction model may accurately predict the operating scene at the next adjacent time according to the operating scene at the current time. Specifically, a first operation scenario at a first time and a second operation scenario at a second time may be obtained from the historical operation scenarios as a set of training samples, and the scene prediction model is trained. The first time is any historical time, and the second time is the next time of the first time.
In some embodiments, when training a scene prediction model, a large number of training samples are typically required to improve the accuracy of the prediction. Therefore, a plurality of sets of training samples can be obtained in the above manner to train the scene prediction model. That is, the operation scene at each moment and the operation scene at the next moment at each moment are obtained from all the historical operation scenes to obtain a plurality of groups of training samples.
Step S283: and taking the first operation scene as the input of the scene prediction model, taking the second operation scene as the expected output of the scene prediction model, and training the scene prediction model to obtain the pre-trained scene prediction model.
In some embodiments, after the first operation scenario and the second operation scenario at adjacent time are obtained, the first operation scenario may be used as an input sample, and the second operation scenario may be used as an output sample to train the scenario prediction model. Specifically, the first operating scenario may be used as an input of the scene prediction model, the second operating scenario may be used as an expected output (i.e., a learning target) of the scene prediction model, and then the scene prediction model is trained through an actual output and the expected output of the scene prediction model, so that the previously trained scene prediction model may be obtained.
In some embodiments, a first operation scenario at a first time may be input into the scene prediction model for forward calculation, so as to obtain an actual output of the scene prediction model, where the actual output is an operation scenario predicted by the scene prediction model at a second time. Because the second operation scene at the second moment is used as the expected output of the scene prediction model, the model parameters can be updated according to the error between the predicted operation scene at the second moment and the real second operation scene at the second moment, and then the pre-trained scene prediction model can be obtained through a large amount of iterative training.
In some embodiments, the influence of different data characteristics in different CPU state data on the final prediction accuracy may also be considered, and the data characteristic with the highest matching accuracy is selected for optimization, so that the complexity of the algorithm may be further reduced.
Step S290: and adjusting the CPU frequency according to the predicted operation scene.
In some embodiments, since different users may mine different operation scenarios, different frequency adjustment schemes may be formulated according to the scenario requirements of different users. Specifically, referring to fig. 4, step S290 may also include:
step S291: and acquiring a predicted frequency modulation strategy corresponding to the predicted operation scene according to the corresponding relation between the operation scene and the frequency modulation strategy, wherein the corresponding relation is determined according to the predicted operation scene output when the scene prediction model is trained and the second operation scene.
Step S292: and adjusting the CPU frequency according to the predicted frequency modulation strategy.
In some embodiments, frequency modulation strategies of different gears may be formulated according to a predicted operation scene output during the training of the scene prediction model and an actual second operation scene, so that a corresponding relationship between the predicted operation scene and the frequency modulation strategies may be established. Therefore, when the trained scene prediction model is deployed to the electronic equipment, after the predicted operation scene at the next moment is predicted by using the trained scene prediction model, the predicted frequency modulation strategy corresponding to the predicted operation scene can be obtained according to the corresponding relation between the operation scene and the frequency modulation strategy, and the CPU frequency can be adjusted according to the predicted frequency modulation strategy.
In some embodiments, the frequency modulation strategies of different gears are formulated according to the predicted operation scene output during the training of the scene prediction model and the actual second operation scene, which may be prediction accuracy during the training of the scene prediction model to adjust the CPU frequency modulation strategy. Specifically, referring to fig. 5, before step S291, the method for adjusting the CPU frequency according to the present application may also include:
step S2901: and in the training process of the scene prediction model, acquiring an operation scene actually output by the scene prediction model.
Step S2902: and determining a predicted frequency modulation strategy corresponding to the predicted operation scene according to the difference value between the actually output operation scene and the expected output second operation scene.
In some embodiments, in the training process of the scene prediction model, a predicted operating scene at a second time, which is actually output by the scene prediction model, may be obtained, the predicted operating scene at the second time is compared with a learning target, that is, the second operating scene at the actual second time, to obtain a difference between the actual output and the expected output, all the differences are normalized, CPU frequency modulation strategies at different gears are determined according to the difference, that is, a CPU frequency modulation strategy corresponding to the predicted operating scene is obtained, and the predicted operating scene and the predicted CPU frequency modulation strategy may be recorded. The CPU frequency modulation strategy can comprise a CPU core to be adjusted and a CPU operation frequency point predicted to be adjusted. Therefore, when the scene prediction model is trained better and the predicted operation scene is more and more accurate, the CPU frequency modulation strategy is determined more and more accurate. Therefore, the CPU historical state data differentiation generated when different users use the electronic equipment is realized, and the differentiated CPU frequency modulation strategy is appointed for the electronic equipment of different users. A better balance is achieved between CPU performance and power consumption.
According to the CPU frequency adjusting method provided by the embodiment of the application, a plurality of operation scenes of the CPU are obtained by clustering and analyzing the historical state data of the CPU, so that the internal relation between the historical state data of the CPU and the operation scenes of the CPU is learned and mined, and the change rules between the operation scenes of the CPU at different historical moments are learned and learned. Therefore, the running scene of the CPU at the next moment can be predicted in advance through the current state data of the CPU, and the CPU frequency can be accurately adjusted in advance according to the predicted running scene in advance, so that the timeliness and the accuracy of the CPU frequency adjustment are ensured. In addition, by formulating corresponding frequency adjustment schemes aiming at different scenes, the advanced adjustment of the CPU frequency under different scenes (performance requirements and power consumption requirements) can be realized, and the performance of the CPU performance and the power consumption can be balanced and optimized. And because the difference of user's use of different APP or different demands for different users ' CPU historical state data also presents the difference, formulate the scheme that CPU frequency point adjusts and also can present the difference, more laminated user's in-service use experience.
Referring to fig. 6, fig. 6 is a schematic flowchart illustrating a method for adjusting a CPU frequency according to another embodiment of the present application. As will be described in detail with respect to the flow shown in fig. 6, the CPU frequency adjustment method may specifically include the following steps:
step S310: and acquiring the current state data of the CPU at the current time.
Step S320: and determining the current operation scene of the CPU at the current time from a plurality of operation scenes of the CPU according to the current state data, wherein the plurality of operation scenes of the CPU are determined based on the historical state data of the CPU at different historical times.
Step S330: and determining the predicted operation scene of the CPU at the next moment of the current moment based on the current operation scene and a pre-trained scene prediction model, wherein the scene prediction model is obtained by training according to the historical operation scenes of the CPU at different historical moments.
Step S340: and adjusting the CPU frequency according to the predicted operation scene.
In the embodiment of the present application, steps S310 to S340 may refer to the contents of the foregoing embodiments, and are not described herein again.
Step S350: and acquiring the performance data of the CPU after the CPU frequency is adjusted.
In some embodiments, when the CPU frequency is not adjusted well, a compensation mechanism may be further set to ensure the user experience. Specifically, after the CPU frequency is adjusted according to the predicted operation scenario at the next time predicted by the pre-trained scenario prediction model, the adjusted CPU performance data may be monitored to determine whether the adjusted CPU frequency is appropriate according to the CPU performance data. The performance data of the CPU may be data representing the current performance state and power consumption state of the CPU by a user, and may be data related to the performance state and power consumption state of the CPU, such as instruction execution, access cache, data loss, power consumption, and the like.
Step S360: and when the performance data do not meet the preset data condition, performing compensation adjustment on the CPU frequency.
In some embodiments, after the performance data of the CPU after the CPU frequency is adjusted is acquired, it may be determined whether the performance data of the CPU satisfies a preset data condition. The preset data condition may be a determination condition for evaluating whether the performance data of the CPU is normal, and may be set reasonably according to an actual situation, which is not limited herein. It can be understood that, when the performance data of the CPU does not satisfy the preset data condition, the adjusted performance data of the CPU may be considered to be abnormal, and the adjusted CPU frequency is not appropriate, and the CPU frequency needs to be compensated and adjusted to make the adjusted performance data of the CPU normal. When the performance data of the CPU meets the preset data condition, the adjusted performance data of the CPU can be considered to be normal, the adjusted CPU frequency is proper, and the compensation adjustment of the CPU frequency is not needed.
In some embodiments, the performance data of the CPU may be frame loss data. Whether the adjusted CPU frequency is suitable or not can be determined according to the frame loss condition. Specifically, the CPU frequency may be increased when the frame loss data is greater than a preset frame loss threshold. The frame loss data is greater than the preset frame loss threshold, which may be that the frame loss data amount is greater than the preset frame loss data amount, or that the frame loss rate is greater than the preset frame loss rate, and is not limited here. The preset frame loss threshold may be a frame loss condition when the program runs smoothly, and if the adjusted frame loss data is greater than the frame loss condition when the program runs smoothly, the adjusted CPU frequency may be considered to be inappropriate, the performance of the adjusted CPU is still insufficient, and the CPU frequency needs to be increased.
For example, if the frame loss rate is greater than 20% after the CPU frequency is currently adjusted in the frame loss information in the current operating scene, it may be considered that the adjusted CPU performance is still insufficient, which indicates that the current adjusted CPU frequency is still not high enough, and the CPU frequency needs to be further increased.
In some embodiments, the performance data of the CPU may also be frame loss data or the number of real-time instruction execution pieces, and when the number of real-time instruction execution pieces is very small or 0, the CPU performance may be considered to be excessive, and the CPU frequency needs to be reduced due to the fact that the adjusted CPU frequency is too high.
In other embodiments, the performance data of the CPU may also be power consumption data. Whether the adjusted CPU frequency is suitable or not can be determined according to the power consumption condition of the CPU. Specifically, the CPU frequency may be decreased when the power consumption data is greater than a preset power consumption threshold. The preset power consumption threshold may be a reasonable power consumption condition in the current operating scenario, and if the adjusted power consumption data of the CPU is already greater than the average power consumption of the operating scenario, it may be considered that the adjusted CPU frequency is too high, and the CPU frequency needs to be reduced.
In some embodiments, when the correspondence between the operating scenario and the frequency modulation policy is established, if the CPU frequency is compensated and adjusted, the correspondence between the operating scenario and the frequency modulation policy may be updated according to the compensation and adjustment condition, so as to ensure that accurate frequency modulation may be implemented when a similar operating scenario is encountered subsequently.
According to the CPU frequency adjusting method provided by the embodiment of the application, the internal relation between the state data of the CPU and the running scene of the CPU in the using process of the electronic equipment is mined by analyzing the historical state data of the CPU at different historical moments, so that the change rule between the running scenes of the CPU at different historical moments is mined and learned. Therefore, the running scene of the CPU at the next moment can be predicted in advance through the current state data of the CPU, and the CPU frequency can be accurately adjusted in advance according to the predicted running scene, so that the timeliness and the accuracy of the CPU frequency adjustment are ensured. In addition, a corresponding compensation mechanism is designed, and the method is further perfected aiming at the scene state which cannot be adjusted in time in the CPU frequency adjustment. The two mechanisms operate simultaneously, so that the CPU can timely and effectively perform frequency modulation action, and the user experience is improved.
Referring to fig. 7, a block diagram of a CPU frequency adjusting apparatus 700 according to an embodiment of the present disclosure is shown, where the CPU frequency adjusting apparatus 700 may include: a state acquisition module 710, a scene determination module 720, a scene prediction module 730, and a frequency adjustment module 740. The state obtaining module 710 is configured to obtain current state data of the CPU at a current time; the scene determining module 720 is configured to determine, according to the current state data, a current operating scene of the CPU at the current time from multiple operating scenes of the CPU, where the multiple operating scenes of the CPU are determined based on historical state data of the CPU at different historical times; the scene prediction module 730 is configured to determine a predicted operation scene of the CPU at a next time of the current time based on the current operation scene and a pre-trained scene prediction model, where the scene prediction model is obtained by training according to historical operation scenes of the CPU at different historical times; the frequency adjusting module 740 is configured to adjust the CPU frequency according to the predicted operation scenario.
In some embodiments, the CPU frequency adjusting apparatus 700 may further include: the model training module is used for acquiring historical operation scenes of the CPU at different historical moments; acquiring a first operation scene at a first moment and a second operation scene at a second moment from the historical operation scenes, wherein the first moment is any historical moment, and the second moment is the next moment of the first moment; and taking the first operation scene as the input of the scene prediction model, taking the second operation scene as the expected output of the scene prediction model, and training the scene prediction model to obtain the pre-trained scene prediction model.
In some embodiments, the frequency adjustment module 740 may also be specifically configured to: and acquiring a predicted frequency modulation strategy corresponding to the predicted operation scene according to the corresponding relation between the operation scene and the frequency modulation strategy, wherein the corresponding relation is determined according to the predicted operation scene output when the scene prediction model is trained and the second operation scene.
In some embodiments, the CPU frequency adjusting apparatus 700 may further include: the strategy determining module is used for acquiring an operation scene actually output by the scene prediction model in the training process of the scene prediction model; and determining a predicted frequency modulation strategy corresponding to the predicted operation scene according to the difference value between the actually output operation scene and the expected output second operation scene.
In some embodiments, the CPU frequency adjusting apparatus 700 may further include: the state clustering module is used for acquiring historical state data of the CPU at different historical moments; performing clustering analysis on the historical state data to obtain a plurality of clustering results; and determining the operation scene corresponding to each clustering result to obtain a plurality of operation scenes of the CPU, wherein different clustering results correspond to different operation scenes.
In this embodiment, the obtaining of the historical operating scenario of the CPU at different historical times in the model training module may specifically include: and determining the historical operating scene of the CPU at each historical time from a plurality of operating scenes of the CPU according to the historical state data at each historical time to obtain the historical operating scenes of the CPU at different historical times.
In this embodiment, the scene determining module 720 may be specifically configured to: acquiring a clustering center of each clustering result in the plurality of clustering results; obtaining the similarity value between the current state data and the clustering center of each clustering result; obtaining a target cluster center with the maximum similarity value from the plurality of cluster centers; and taking the operation scene corresponding to the target clustering center as the current operation scene of the CPU at the current moment.
In some embodiments, the CPU frequency adjusting apparatus 700 may further include: the performance acquisition module is used for acquiring performance data of the CPU after the CPU frequency is adjusted; and the compensation adjusting module is used for performing compensation adjustment on the CPU frequency when the performance data does not meet the preset data condition.
In some embodiments, the performance data may include frame loss data, and the compensation adjustment module may be specifically configured to: and when the frame loss data is larger than a preset frame loss threshold value, increasing the CPU frequency.
In other embodiments, the performance data may include power consumption data, and the compensation adjustment module may be specifically configured to: and when the power consumption data is larger than a preset power consumption threshold value, reducing the CPU frequency.
It can be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described apparatuses and modules may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In several embodiments provided in the present application, the coupling of the modules to each other may be electrical, mechanical or other forms of coupling.
In addition, functional modules in the embodiments of the present application may be integrated into one processing module, or each of the modules may exist alone physically, or two or more modules are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode.
To sum up, the CPU frequency adjusting apparatus provided in the embodiment of the present application is used to implement the corresponding CPU frequency adjusting method in the foregoing method embodiment, and has the beneficial effects of the corresponding method embodiment, which are not described herein again.
Referring to fig. 8, a block diagram of an electronic device according to an embodiment of the present disclosure is shown. The electronic device 100 may be a terminal device capable of running an application, such as a PC computer or a mobile terminal. The electronic device 100 in the present application may include one or more of the following components: a processor 110, a memory 120, and one or more applications, wherein the one or more applications may be stored in the memory 120 and configured to be executed by the one or more processors 110, the one or more applications configured to perform the methods as described in the aforementioned method embodiments.
Processor 110 may include one or more processing cores. The processor 110 connects various parts within the overall electronic device 100 using various interfaces and lines, and performs various functions of the electronic device 100 and processes data by executing or executing instructions, programs, code sets, or instruction sets stored in the memory 120 and calling data stored in the memory 120. Alternatively, the processor 110 may be implemented in hardware using at least one of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), and Programmable Logic Array (PLA). The processor 110 may integrate one or more of a Central Processing Unit (CPU), a GPU (Graphics Processing Unit), a modem, and the like. Wherein, the CPU mainly processes an operating system, a user interface, an application program and the like; the GPU is used for rendering and drawing display content; the modem is used to handle wireless communications. It is understood that the modem may not be integrated into the processor 110, but may be implemented by a communication chip.
The Memory 120 may include a Random Access Memory (RAM) or a Read-Only Memory (Read-Only Memory). The memory 120 may be used to store instructions, programs, code sets, or instruction sets. The memory 120 may include a stored program area and a stored data area, wherein the stored program 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. The data storage area may also store data created by the electronic device 100 during use (e.g., phone book, audio-video data, chat log data), and the like.
It will be appreciated that the configuration shown in FIG. 8 is merely exemplary, and that electronic device 100 may include more or fewer components than shown in FIG. 8, or may have a completely different configuration than shown in FIG. 8. The embodiments of the present application do not limit this.
Referring to fig. 9, a block diagram of a computer-readable storage medium according to an embodiment of the present application is shown. The computer-readable medium 800 has stored therein a program code that can be called by a processor to execute the method described in the above-described method embodiments.
The computer-readable storage medium 800 may be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read only memory), an EPROM, a hard disk, or a ROM. Alternatively, the computer-readable storage medium 800 includes a non-volatile computer-readable medium. The computer readable storage medium 800 has storage space for program code 810 to perform any of the method steps of the method described above. The program code can be read from or written to one or more computer program products. The program code 810 may be compressed, for example, in a suitable form.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit the same; although the present application has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not depart from the spirit and scope of the corresponding technical solutions in the embodiments of the present application.

Claims (11)

1. A method for adjusting a CPU frequency, the method comprising:
acquiring historical state data of a CPU at different historical moments; performing clustering analysis on the historical state data to obtain a plurality of clustering results; determining an operation scene corresponding to each clustering result to obtain a plurality of operation scenes of the CPU, wherein different clustering results correspond to different operation scenes; acquiring current state data of a CPU at the current time;
acquiring a clustering center of each clustering result in the plurality of clustering results; acquiring similarity values of the current state data and the clustering centers of each clustering result; obtaining a target cluster center with the maximum similarity value from the plurality of cluster centers; taking the operation scene corresponding to the target clustering center as the current operation scene of the CPU at the current moment;
determining a predicted operation scene of the CPU at the next moment of the current moment based on the current operation scene and a pre-trained scene prediction model, wherein the scene prediction model is obtained by training according to historical operation scenes of the CPU at different historical moments;
and adjusting the CPU frequency according to the predicted operation scene.
2. The method of claim 1, wherein the pre-trained scene prediction model is trained by:
acquiring historical operation scenes of a CPU at different historical moments;
acquiring a first operation scene at a first moment and a second operation scene at a second moment from the historical operation scenes, wherein the first moment is any historical moment, and the second moment is the next moment of the first moment;
and taking the first operation scene as the input of the scene prediction model, taking the second operation scene as the expected output of the scene prediction model, and training the scene prediction model to obtain the pre-trained scene prediction model.
3. The method of claim 2, wherein said adjusting a CPU frequency based on said predicted operational scenario comprises:
acquiring a predicted frequency modulation strategy corresponding to the predicted operation scene according to the corresponding relation between the operation scene and the frequency modulation strategy, wherein the corresponding relation is determined according to the predicted operation scene output when the scene prediction model is trained and the second operation scene;
and adjusting the CPU frequency according to the predicted frequency modulation strategy.
4. The method according to claim 3, wherein before the obtaining of the predicted frequency modulation strategy corresponding to the predicted operation scenario according to the correspondence between the operation scenario and the frequency modulation strategy, the method further comprises:
in the training process of the scene prediction model, acquiring an operation scene actually output by the scene prediction model;
and determining a predicted frequency modulation strategy corresponding to the predicted operation scene according to the difference value between the actually output operation scene and the expected output second operation scene.
5. The method according to claim 2, wherein the obtaining the historical operating scenarios of the CPU at different historical time instants comprises:
and determining the historical operating scene of the CPU at each historical time from a plurality of operating scenes of the CPU according to the historical state data at each historical time to obtain the historical operating scenes of the CPU at different historical times.
6. The method of any of claims 1-4, wherein after said adjusting the CPU frequency according to the predicted operational scenario, the method further comprises:
acquiring the performance data of the CPU after the CPU frequency is adjusted;
and when the performance data do not meet the preset data condition, performing compensation adjustment on the CPU frequency.
7. The method of claim 6, wherein the performance data comprises frame loss data, and wherein the performing a compensation adjustment on the CPU frequency when the performance data does not satisfy a predetermined data condition comprises:
and when the frame loss data is larger than a preset frame loss threshold value, increasing the CPU frequency.
8. The method of claim 6, wherein the performance data comprises power consumption data, and wherein performing a compensation adjustment on the CPU frequency when the performance data does not satisfy a preset data condition comprises:
and when the power consumption data is larger than a preset power consumption threshold value, reducing the CPU frequency.
9. An apparatus for adjusting a CPU frequency, the apparatus comprising:
the state acquisition module is used for acquiring historical state data of the CPU at different historical moments; performing clustering analysis on the historical state data to obtain a plurality of clustering results; determining an operation scene corresponding to each clustering result to obtain a plurality of operation scenes of the CPU, wherein different clustering results correspond to different operation scenes; acquiring current state data of a CPU at the current time;
the scene determining module is used for acquiring the clustering center of each clustering result in the plurality of clustering results; acquiring similarity values of the current state data and the clustering centers of each clustering result; obtaining a target cluster center with the maximum similarity value from the plurality of cluster centers; taking the operation scene corresponding to the target clustering center as the current operation scene of the CPU at the current moment;
the scene prediction module is used for determining a predicted operation scene of the CPU at the next moment of the current moment based on the current operation scene and a pre-trained scene prediction model, and the scene prediction model is obtained by training according to historical operation scenes of the CPU at different historical moments;
and the frequency adjusting module is used for adjusting the CPU frequency according to the predicted operation scene.
10. An electronic device, comprising:
one or more processors;
a memory;
one or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the one or more processors, the one or more applications configured to perform the method of any of claims 1-8.
11. A computer-readable storage medium, having stored thereon program code that can be invoked by a processor to perform the method according to any one of claims 1 to 8.
CN202011627467.0A 2020-12-31 2020-12-31 CPU frequency adjusting method, device, electronic equipment and storage medium Active CN112631415B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011627467.0A CN112631415B (en) 2020-12-31 2020-12-31 CPU frequency adjusting method, device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011627467.0A CN112631415B (en) 2020-12-31 2020-12-31 CPU frequency adjusting method, device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN112631415A CN112631415A (en) 2021-04-09
CN112631415B true CN112631415B (en) 2022-09-02

Family

ID=75290239

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011627467.0A Active CN112631415B (en) 2020-12-31 2020-12-31 CPU frequency adjusting method, device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112631415B (en)

Families Citing this family (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117377923A (en) * 2021-05-27 2024-01-09 华为技术有限公司 Power consumption adjusting method and device
CN113487707A (en) * 2021-06-30 2021-10-08 北京达佳互联信息技术有限公司 Webpage animation processing method and device, electronic equipment and storage medium
CN113434034B (en) * 2021-07-08 2023-04-18 北京华恒盛世科技有限公司 Large-scale cluster energy-saving method for adjusting CPU frequency of calculation task by utilizing deep learning
CN113778663B (en) * 2021-07-28 2023-05-12 荣耀终端有限公司 Scheduling method of multi-core processor and electronic equipment
CN114840072A (en) * 2022-04-22 2022-08-02 Oppo广东移动通信有限公司 Image quality adjusting method and device, storage medium and electronic equipment
CN116737357A (en) * 2022-09-28 2023-09-12 荣耀终端有限公司 Method and device for adjusting processor frequency
CN116414215B (en) * 2023-06-05 2023-10-20 荣耀终端有限公司 Frequency modulation method and frequency modulation device
CN116931703B (en) * 2023-09-18 2023-12-26 惠州市鑫晖源科技有限公司 Electronic contest host power supply voltage adjusting method based on data analysis
CN117492552B (en) * 2024-01-03 2024-04-16 芯瞳半导体技术(山东)有限公司 Dynamic voltage frequency adjustment method, controller, device, equipment and storage medium
CN117687495B (en) * 2024-02-04 2024-07-12 荣耀终端有限公司 Data acquisition method, training method and electronic equipment

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108228270A (en) * 2016-12-19 2018-06-29 腾讯科技(深圳)有限公司 Start resource loading method and device
CN110008977A (en) * 2018-12-05 2019-07-12 阿里巴巴集团控股有限公司 Clustering Model construction method and device
CN111460145A (en) * 2020-03-18 2020-07-28 天闻数媒科技(北京)有限公司 Learning resource recommendation method, device and storage medium

Family Cites Families (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7831538B2 (en) * 2007-05-23 2010-11-09 Nec Laboratories America, Inc. Evolutionary spectral clustering by incorporating temporal smoothness
CN103324270B (en) * 2013-06-25 2016-02-10 东莞宇龙通信科技有限公司 A kind of mobile terminal and regulate the method for its cpu frequency
CN105094272A (en) * 2014-05-14 2015-11-25 中兴通讯股份有限公司 Regulating method and regulating device for hardware refresh rate of terminal
US10043591B1 (en) * 2015-02-06 2018-08-07 Brain Trust Innovations I, Llc System, server and method for preventing suicide
EP3089034B1 (en) * 2015-04-29 2019-06-12 Tata Consultancy Services Limited System and method for optimizing energy consumption by processors
CN106095047B (en) * 2016-05-31 2020-07-24 联想(北京)有限公司 Control method and electronic equipment
CN108200473B (en) * 2018-02-01 2020-12-08 深圳创维-Rgb电子有限公司 CPU power control method, smart television and storage medium
CN109166170A (en) * 2018-08-21 2019-01-08 百度在线网络技术(北京)有限公司 Method and apparatus for rendering augmented reality scene
CN109445918B (en) * 2018-10-17 2021-06-18 Oppo广东移动通信有限公司 Task scheduling method, device, terminal and storage medium
CN109947569B (en) * 2019-03-15 2021-04-06 Oppo广东移动通信有限公司 Method, device, terminal and storage medium for binding core
CN111797867A (en) * 2019-04-09 2020-10-20 Oppo广东移动通信有限公司 System resource optimization method and device, storage medium and electronic equipment
CN111798259A (en) * 2019-04-09 2020-10-20 Oppo广东移动通信有限公司 Application recommendation method and device, storage medium and electronic equipment
CN110209501B (en) * 2019-06-03 2022-02-08 Oppo广东移动通信有限公司 Frequency adjusting method and device of graphic processor, terminal and storage medium
CN110864400A (en) * 2019-11-27 2020-03-06 广东美的制冷设备有限公司 Control method and device of air conditioning equipment and air conditioning equipment
CN110971761B (en) * 2019-12-09 2021-04-06 Oppo广东移动通信有限公司 Method and device for generating display parameter curve, mobile terminal and storage medium
CN111342937B (en) * 2020-03-17 2022-05-06 北京百瑞互联技术有限公司 Method and device for dynamically adjusting voltage and/or frequency of coding and decoding processor
CN111523593B (en) * 2020-04-22 2023-07-21 北京康夫子健康技术有限公司 Method and device for analyzing medical images

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108228270A (en) * 2016-12-19 2018-06-29 腾讯科技(深圳)有限公司 Start resource loading method and device
CN110008977A (en) * 2018-12-05 2019-07-12 阿里巴巴集团控股有限公司 Clustering Model construction method and device
CN111460145A (en) * 2020-03-18 2020-07-28 天闻数媒科技(北京)有限公司 Learning resource recommendation method, device and storage medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
"Online Anomaly Prediction for Robust Cluster Systems";Xiaohui Gu等;《IEEE International Conference on Data Engineering》;20090410;第1000-1011页 *
"Power-Performance Modelling of Mobile Gaming Workloads on Heterogeneous MPSoCs";Anuj Pathania等;《ACM》;20150607;第1-6页 *

Also Published As

Publication number Publication date
CN112631415A (en) 2021-04-09

Similar Documents

Publication Publication Date Title
CN112631415B (en) CPU frequency adjusting method, device, electronic equipment and storage medium
CN111078479B (en) Memory detection model training method, memory detection method and device
US11747888B2 (en) Object detection using multiple neural network configurations
CN112114986B (en) Data anomaly identification method, device, server and storage medium
CN112363842A (en) Frequency adjusting method and device for graphic processor, electronic equipment and storage medium
CN112153650B (en) Reliable federal learning method and system based on terminal reputation in wireless network
US20220180209A1 (en) Automatic machine learning system, method, and device
CN110782043A (en) Model optimization method and device, storage medium and server
CN109754077B (en) Network model compression method and device of deep neural network and computer equipment
CN115437778A (en) Kernel scheduling method and device, electronic equipment and computer readable storage medium
CN114500578A (en) Load balancing scheduling method and device for distributed storage system and storage medium
CN112672405B (en) Power consumption calculation method, device, storage medium, electronic equipment and server
CN109937410B (en) Core scheduling method and terminal
CN113055984B (en) Terminal control method and device, mobile terminal and storage medium
CN113064660A (en) Device control method, device, electronic device and storage medium
CN111459682A (en) Frequency adjustment method, frequency adjustment device, electronic device and storage medium
CN115797726A (en) Model obtaining method and device, electronic equipment and storage medium
CN113169890B (en) Classification system and method
CN111191675A (en) Pedestrian attribute recognition model implementation method and related device
CN117750135B (en) Video transmission optimization method, device, equipment and medium
CN117971509B (en) Heterogeneous computing power cluster operation performance optimization method, heterogeneous computing power cluster operation performance optimization device, heterogeneous computing power cluster operation performance optimization equipment and medium
CN116225311B (en) Configuration method, device and server for terminal equipment storage system parameters
CN111435596B (en) Method and device for adjusting running state of target equipment, storage medium and electronic device
US11816134B1 (en) System and method for reduction of data transmission in dynamic systems using causal graphs
CN112800227B (en) Training method of text classification model, equipment and storage medium thereof

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
GR01 Patent grant
GR01 Patent grant