WO2014032250A1 - 一种控制中央处理器的方法和装置 - Google Patents

一种控制中央处理器的方法和装置 Download PDF

Info

Publication number
WO2014032250A1
WO2014032250A1 PCT/CN2012/080765 CN2012080765W WO2014032250A1 WO 2014032250 A1 WO2014032250 A1 WO 2014032250A1 CN 2012080765 W CN2012080765 W CN 2012080765W WO 2014032250 A1 WO2014032250 A1 WO 2014032250A1
Authority
WO
WIPO (PCT)
Prior art keywords
frequency
possible implementation
less
equal
operating frequency
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.)
Ceased
Application number
PCT/CN2012/080765
Other languages
English (en)
French (fr)
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.)
Huawei Device Co Ltd
Original Assignee
Huawei Device 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 Huawei Device Co Ltd filed Critical Huawei Device Co Ltd
Priority to EP12878637.3A priority Critical patent/EP2725450A4/en
Priority to JP2014532227A priority patent/JP5871075B2/ja
Priority to CN201280002858.0A priority patent/CN103415823B/zh
Priority to PCT/CN2012/080765 priority patent/WO2014032250A1/zh
Priority to US14/138,029 priority patent/US9405353B2/en
Publication of WO2014032250A1 publication Critical patent/WO2014032250A1/zh
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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/324Power saving characterised by the action undertaken by lowering clock frequency
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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/3206Monitoring of events, devices or parameters that trigger a change in power modality
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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
    • G06F9/505Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the load
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/34Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
    • G06F11/3409Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment for performance assessment
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/34Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
    • G06F11/3409Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment for performance assessment
    • G06F11/3433Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment for performance assessment for load management
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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]
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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/5094Allocation of resources, e.g. of the central processing unit [CPU] where the allocation takes into account power or heat criteria
    • 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

Definitions

  • the present invention relates to the field of communications, and in particular, to a method and apparatus for controlling a central processing unit.
  • the processor is moving toward a high-frequency, multi-core direction, and the parallel processing capability per unit time is greatly increased, and a large power consumption burden is also brought. Reducing the processor's inefficient power consumption issues is important for computing systems, especially mobile handheld computing devices.
  • the prior art proposes a technical solution that once the CPU usage is greater than the occupancy threshold, the CPU frequency is set to the highest frequency.
  • a frequency modulation method causes the CPU to work at the highest frequency after the CPU usage is greater than the occupancy rate, which causes unnecessary power consumption of the CPU.
  • the embodiment of the invention provides a method and a device for controlling a central processing unit, which can reduce CPU power consumption when the CPU usage is greater than the occupancy rate.
  • a method of controlling a CPU of a central processing unit comprising: obtaining an occupancy rate and a working frequency of a working CPU;
  • the method further includes:
  • the working frequency is greater than or equal to the first frequency
  • determining whether the working frequency is less than or equal to the second frequency the second frequency is greater than the first frequency and less than the highest frequency; when the working frequency is less than Or equal to the second frequency, confirm that the operating frequency is the first Two frequencies.
  • the operating frequency is confirmed to be the second frequency.
  • the method further includes:
  • the cycle keeps the count value plus one.
  • the operating frequency is greater than the second frequency, confirm that the operating frequency is a third frequency, and the third frequency is equal to the highest frequency.
  • the method further includes:
  • the loop keeps the count value.
  • the method further includes: When the occupancy rate is less than or equal to the occupancy threshold, obtain the product of the occupancy rate and the operating frequency, confirm that the operating frequency is the frequency value closest to the product, and clear the loop hold Count value.
  • the method further includes:
  • the operating frequency is greater than or equal to the first frequency, it is confirmed that the operating frequency is the highest frequency.
  • the working frequency when the working frequency is less than the first frequency, confirm that the working frequency is the first frequency , Specifically:
  • the operating frequency is confirmed to be the first frequency.
  • the method further includes:
  • the cycle keeps the count value plus one.
  • the method further includes:
  • the occupancy rate is less than or equal to the occupancy threshold, obtaining a product of the occupancy rate and the operating frequency, confirming that the operating frequency is the frequency value closest to the product, and clearing the The loop keeps the count value.
  • the method further includes: when the system is idle, the timer stops timing.
  • the method further includes: when the system exits idle , the timer starts timing.
  • the method further includes:
  • the timer If the timer is continuously clocked, the operating frequency corresponding to the timer is the maximum frequency, and the working frequency is the frequency maximum just greater than the maximum frequency duration. Then the timer stops counting.
  • the highest frequency duration period threshold is:
  • the working frequency is the frequency maximum, the number of times is just greater than the highest frequency, and the number of times is:
  • the number of times the operating frequency is the maximum value of the frequency is the highest frequency and the number of times the period is wide plus the first aspect, or the first possible implementation of the first aspect, or the second possible implementation of the first aspect Or a third possible implementation of the first aspect, or a fourth possible implementation of the first aspect, or a fifth possible implementation of the first aspect, or a sixth possible aspect of the first aspect Implementation, or a seventh possible implementation of the first aspect, or an eighth possible implementation of the first aspect, or a ninth possible implementation of the first aspect, or a tenth aspect of the first aspect a possible implementation, or an eleventh possible implementation of the first aspect, or a twelfth possible implementation of the first aspect, or a thirteenth possible implementation of the first aspect, or the first a fourteenth possible implementation of the aspect, or a fifteenth possible implementation of the first aspect, or a sixteenth possible implementation of the first aspect, or a seventeenth
  • the first slope is smaller than the second slope
  • the first slope is a slope of a straight line formed by a measurement point having a lower frequency than the inflection point; and the second slope is a slope of a straight line formed by a measurement point having a higher frequency than the inflection point.
  • the The two frequencies are an average of the first frequency and the highest frequency.
  • a terminal includes a processor, where the processor is configured to: acquire an occupation rate and a working frequency of a working CPU;
  • the processor is further configured to: when the working frequency is greater than or equal to the first frequency, determine whether the working frequency is less than or equal to the second frequency, The second frequency is greater than the first frequency and less than the highest frequency; when the operating frequency is less than or equal to the second frequency, it is confirmed that the operating frequency is the second frequency.
  • the processor when the working frequency is less than or equal to the second frequency, confirms that the working frequency is a second Frequency, including:
  • the operating frequency is confirmed to be the second frequency.
  • the processor is further configured to:
  • the cycle keeps the count value plus one.
  • the processor is also used to:
  • the processor is further configured to:
  • the loop keeps the count value.
  • the processor is further configured to:
  • the occupancy rate is less than or equal to the occupancy threshold, obtaining a product of the occupancy rate and the operating frequency, confirming that the operating frequency is the frequency value closest to the product, and clearing the The loop keeps the count value.
  • the processor is further configured to: when the operating frequency is greater than or equal to the first frequency, confirm that the operating frequency is the highest frequency.
  • the processor when the working frequency is less than the first frequency, confirms that the working frequency is A frequency, specifically:
  • the processor is further configured to:
  • the cycle keeps the count value plus one.
  • the processor is further configured to:
  • the processor is further configured to:
  • the occupancy rate is less than or equal to the occupancy threshold, obtaining a product of the occupancy rate and the operating frequency, confirming that the operating frequency is the frequency value closest to the product, and clearing the The loop keeps the count value.
  • the processor is further configured to: when the timing of the timer corresponding to the CPU arrives, perform the method A step of.
  • the processor is further configured to: when the system is idle, the timer stops timing.
  • the processor is further configured to: When the system exits idle, the timer starts timing.
  • the processor is further configured to:
  • the timer If the timer is continuously clocked, the operating frequency corresponding to the timer is the maximum frequency, and the working frequency is the frequency maximum just greater than the maximum frequency duration. Then the timer stops counting.
  • the maximum frequency duration period threshold is:
  • the working frequency is the frequency maximum, the number of times is just greater than the highest frequency, and the number of consecutive periods is:
  • the number of times the operating frequency is the maximum value of the frequency is the highest frequency, the number of consecutive periods, and the second aspect, or the first possible implementation of the second aspect, or the second possible implementation of the second aspect Or a third possible implementation of the second aspect, or a fourth possible implementation of the second aspect, or a fifth possible implementation of the second aspect, or a sixth possible aspect of the second aspect
  • the implementation manner, or the seventh possible implementation manner of the second aspect, or the eighth possible implementation manner of the second aspect, or the ninth possible implementation manner of the second aspect, or the tenth aspect of the second aspect a possible implementation, or an eleventh possible implementation of the second aspect, or a twelfth possible implementation of the second aspect, or a thirteenth possible implementation of the second aspect, or a second a fourteenth possible implementation of the aspect, or a fifteenth possible implementation of the second aspect, or a sixteenth possible implementation of the second aspect, or a seventeenth possible aspect of the second aspect Implementation, possible implementation of the eighteenth embodiment, the frequency of the first current -
  • the first slope is a slope of a straight line formed by a measurement point having a lower frequency than the inflection point; and the second slope is a slope of a straight line formed by a measurement point having a higher frequency than the inflection point.
  • the second frequency is an average of the first frequency and the highest frequency.
  • an apparatus comprising:
  • the first unit obtains the occupancy rate and working frequency of the working CPU
  • the second unit when the occupancy rate is greater than the occupancy rate threshold, determining whether the working frequency is smaller than the first frequency
  • a third unit when the operating frequency is less than the first frequency, confirming that the operating frequency is a first frequency; wherein the first frequency is smaller than a highest frequency of the CPU.
  • the device further includes:
  • a fourth unit configured to determine, when the working frequency is greater than or equal to the first frequency, whether the working frequency is less than or equal to a second frequency, where the second frequency is greater than the first frequency and less than the highest frequency;
  • a fifth unit configured to confirm that the operating frequency is the second frequency when the operating frequency is less than or equal to the second frequency.
  • the fifth unit is specifically configured to: when the operating frequency is less than or equal to the second frequency, and the loop keeps counting When the value is less than the loop hold count threshold, it is confirmed that the operating frequency is the second frequency.
  • the method further includes: a sixth unit, configured to add the loop hold count value to one.
  • a seventh unit configured to: when the operating frequency is greater than the second frequency, confirm that the working frequency is a third frequency, and the third frequency is equal to the highest frequency.
  • an eighth unit configured to confirm that the operating frequency is the highest frequency when the loop hold count value is greater than or equal to the loop hold count threshold.
  • the method further includes:
  • a ninth unit configured to clear the loop hold count value when the occupancy rate is greater than the occupancy rate threshold, and the operating frequency is less than or equal to the first frequency.
  • the method further includes: a tenth unit, configured to: when the occupancy rate is less than or equal to the occupancy threshold, obtain a product of the occupancy rate and the working frequency, and confirm that the working frequency is a frequency value closest to the product , and clear the loop to keep the count value.
  • the method further includes:
  • the eleventh unit is configured to confirm that the operating frequency is the highest frequency when the operating frequency is greater than or equal to the first frequency.
  • the third unit is specifically used to:
  • the operating frequency is confirmed to be the first frequency.
  • the twelfth unit is further configured to increase the cycle hold count value by one.
  • the method further includes:
  • a thirteenth unit configured to confirm that the operating frequency is the highest frequency when the loop hold count value is greater than or equal to the loop hold count threshold.
  • a fourteenth unit configured to: when the occupancy rate is less than or equal to the occupancy threshold, obtain a product of the occupancy rate and the working frequency, and confirm that the working frequency is a frequency closest to the product Value, and clear the loop to keep the count value.
  • the method further includes: a timer, when the timing of the timer corresponding to the CPU arrives, Perform the steps of the method.
  • the method further includes a fifteenth unit, configured to: when the system is idle, the timer stops timing.
  • the method further includes a sixteenth unit, When: The system starts timing when the system exits idle.
  • the method further includes:
  • a seventeenth unit configured to: when the timer arrives at a continuous timing, the operating frequency corresponding to the timer is a maximum frequency, and the working frequency is a frequency maximum just greater than the highest frequency If the duration of the cycle is wide, the timer stops counting.
  • the highest frequency duration period threshold is:
  • the working frequency is the frequency maximum, the number of times is just greater than the highest frequency, and the number of consecutive periods is:
  • the number of times the operating frequency is the maximum value of the frequency is the highest frequency and the number of times the period is wide plus the third aspect, or the first possible implementation of the third aspect, or the third aspect
  • the seventeenth possible implementation manner, in the eighteenth possible implementation manner, the first frequency is a frequency corresponding to an
  • the first slope is smaller than the second slope
  • the first slope is a slope of a straight line formed by a measurement point having a lower frequency than the inflection point; and the second slope is a slope of a straight line formed by a measurement point having a higher frequency than the inflection point.
  • the second ten possible implementation manner is an average of the first frequency and the highest frequency.
  • a computer program for carrying program code when the computer program is run on a computer, the program code performs a first aspect in combination with the present invention; or the first possibility of the first aspect Implementation of the second aspect; or a second possible implementation of the first aspect; or a third possible implementation of the first aspect; or a fourth possible implementation of the first aspect; or a fifth aspect of the first aspect a possible implementation; or a sixth possible implementation of the first aspect; or a seventh possible implementation of the first aspect; or an eighth possible implementation of the first aspect; or the first aspect a ninth possible implementation; or a tenth possible implementation of the first aspect; or an eleventh possible implementation of the first aspect; or a twelfth possible implementation of the first aspect; or a thirteenth possible implementation of the first aspect; or a fourteenth possible implementation of the first aspect; or a fifteenth possible implementation of the first aspect; or the first aspect a sixteenth possible implementation of the first aspect; or a seventeenth possible implementation of the first aspect; or an
  • a computer readable storage medium the computer storing computer program code, when the computer program code is executed by a computer, the computer program code may cause the computer to execute a binding book
  • a first aspect of the invention or a first possible implementation of the first aspect; or a second possible implementation of the first aspect; or a third possible implementation of the first aspect; or the first aspect a fourth possible implementation; or a fifth possible implementation of the first aspect; or a sixth possible implementation of the first aspect; or a seventh possible implementation of the first aspect; or first An eighth possible implementation of the aspect; or a ninth possible implementation of the first aspect; or a tenth possible implementation of the first aspect; or an eleventh possible implementation of the first aspect; Or a twelfth possible implementation of the first aspect; or a thirteenth possible implementation of the first aspect; or a fourteenth possible aspect of the first aspect Implementation manner; or a fifteenth possible implementation of the first aspect; or a sixteenth possible implementation of the first aspect; or a seventeenth possible implementation of the
  • a computer program product comprising: computer program code, when the computer program code is executed by a computer, the computer program code can cause the computer to execute a binding program A first aspect of the invention; or a first possible implementation of the first aspect; or a second possible implementation of the first aspect; or a third possible implementation of the first aspect; or the first aspect
  • the fourth possible implementation Or a fifth possible implementation of the first aspect; or a sixth possible implementation of the first aspect; or a seventh possible implementation of the first aspect; or an eighth possible aspect of the first aspect
  • the method and device for controlling the central processing unit provided by the embodiment of the present invention further determines whether the working frequency is smaller than the first frequency after the CPU usage is greater than the occupancy rate threshold.
  • the operating frequency is less than the first frequency, it is confirmed that the operating frequency is a first frequency that is less than the highest frequency of the CPU. This way of adjusting the frequency is not to adjust the CPU frequency to the highest frequency at one time, so it can reduce the CPU power consumption when the CPU usage is greater than the occupancy threshold in the frequency adjustment.
  • FIG. 1 is a schematic flow chart of a method of controlling a CPU in a first embodiment of the present invention
  • FIG. 2 is a detailed flowchart of a method of controlling a CPU in a second embodiment of the present invention
  • FIG. 3 is a control CPU in a third embodiment of the present invention.
  • FIG. 4 is a schematic diagram of a current-frequency curve in a fourth embodiment of the present invention.
  • FIG. 5 is a schematic structural diagram of a terminal in a fifth embodiment of the present invention.
  • Figure 6 is a block diagram showing a part of the structure of a mobile phone in a sixth embodiment of the present invention.
  • Figure 7 is a schematic structural view of a device in a seventh embodiment of the present invention.
  • FIG. 8A is a first detailed structural diagram of a device in an eighth embodiment of the present invention.
  • FIG. 8B is a second detailed structural diagram of the device in the eighth embodiment of the present invention.
  • FIG. 8C is a schematic structural diagram of a timer in the apparatus in the eighth embodiment of the present invention. detailed description
  • a first embodiment of the present invention provides a method for controlling a CPU. As shown in the schematic flowchart of FIG. 1, the method includes the following steps:
  • Step 1 01 Get the CPU usage and working frequency of the working CPU.
  • Step 1 02 When the occupancy rate is greater than the occupancy rate threshold, determine whether the working frequency is smaller than the first frequency.
  • the occupancy threshold can take different values depending on the platform. The value can range from 90% to 95%.
  • the different platforms here refer to different hardware chipsets.
  • Step 1 03 When the operating frequency is less than the first frequency, confirm that the operating frequency is the first frequency.
  • determining... is the first frequency means that if the operating frequency is not the first frequency, the operating frequency is changed to the first frequency. If the operating frequency is the first frequency, the operating frequency is maintained at the first frequency.
  • the first frequency is less than a highest frequency of the CPU.
  • the method for controlling the central processing unit provided by the embodiment of the present invention further determines whether the working frequency is smaller than the first frequency after the CPU occupancy rate is greater than the occupancy rate threshold. When the operating frequency is less than the first frequency, it is confirmed that the operating frequency is a first frequency that is less than the highest frequency of the CPU. This way of adjusting the frequency is not to adjust the CPU frequency to the highest frequency at one time, so it can reduce the power consumption of the CPU in the frequency adjustment.
  • a second embodiment of the present invention provides a method of controlling a CPU that is executed by a CPU responsible for scheduling. That is, the CPU executing the method can schedule other ordinary CPUs that execute instructions and operations.
  • the CPU responsible for scheduling may be a separate CPU other than the CPU that normally executes the instructions and operations, and may also integrate the scheduling function into a CPU that executes ordinary instructions and operations.
  • the hardware form of the CPU responsible for scheduling (hereinafter referred to as "scheduling CPU") may be an advanced reduced instruction set computer. (Advanced Reduced Ins compute ion Set Computing (RISC ) Machines , ARM ) chip, can also be other chips such as microcontroller. As shown in the detailed flowchart of FIG. 2, the following steps are included:
  • Step 201 Obtain an occupancy rate and an operating frequency of the currently working CPU.
  • the CPU occupancy value and the operating frequency value can be obtained by detection, respectively.
  • Step 202 Determine whether the occupancy rate of the CPU is greater than the occupancy threshold. If it is greater, proceed to step 204. Otherwise, the process proceeds to step 203.
  • Step 203 If the occupancy rate of the CPU is less than or equal to the occupancy threshold, obtain the product of the occupancy rate and the operating frequency, confirm that the working frequency is the frequency value closest to the product, and clear the loop hold count value.
  • the operating frequency is a discrete value, it is possible that the product and the discrete values do not coincide, so it may be necessary to set the operating frequency to the frequency value closest to the product.
  • the operating frequency can be set to a frequency value corresponding to the product.
  • “determining” means that if the product and the discrete values do not coincide, the operating frequency is set to the frequency value closest to the product; if the product and the discrete values are coincident, the operating frequency is set. Is the frequency value corresponding to the product.
  • the loop hold count value is compared with the loop hold count threshold, and if it is less than the loop hold count threshold, the count continues on the basis of the original count. Once the loop hold count value is greater than or equal to the loop hold count threshold, the existing frequency is adjusted to a higher frequency than the existing frequency.
  • Step 204 If the CPU usage rate is greater than the occupancy rate threshold, continue to determine whether the CPU operating frequency is less than the first frequency. If the operating frequency is less than the first frequency, then step 205 is entered. Otherwise, proceed to step 206.
  • Step 205 When the operating frequency is less than the first frequency, confirm that the working frequency is the first frequency. Further, the cycle can also keep the count value.
  • Step 206 When the operating frequency is greater than or equal to the first frequency, continue to determine whether the CPU operating frequency is less than or equal to the second frequency. Wherein the second frequency is greater than or equal to the first frequency and less than the highest frequency. If the operating frequency is less than or equal to the second frequency, then step 207 is entered. Otherwise, go to step 209.
  • Step 207 When the operating frequency is less than or equal to the second frequency, continue to determine whether the loop hold count value is less than the loop hold count threshold. If the loop hold count value is less than the loop hold count threshold, the flow proceeds to step 208. Otherwise, go to step 209.
  • Step 208 When the loop hold count value is less than the loop hold count threshold, confirm that the working frequency is the second frequency. Further, the cycle hold count value can be increased by one.
  • Step 209 When the loop hold count value is greater than or equal to the loop hold count threshold, or the CPU operating frequency is greater than the second frequency, confirm that the operating frequency is a third frequency, and the third frequency is greater than the second frequency.
  • the third frequency can be the highest frequency of the CPU or a frequency greater than the second frequency and less than the highest frequency.
  • the method for controlling a central processing unit achieved a finer division of the frequency level by setting a second frequency higher than the first frequency and a third frequency higher than the second frequency, and is suitable for having a working frequency High (such as the highest frequency up to 1. 5GHz (gigahertz)) CPU hardware chipset. Therefore, when the CPU frequency is high, the user experience and the CPU performance are guaranteed, instead of frequency-adjusting the frequency to the maximum frequency, but adjusting the frequency in stages, the CPU power consumption can be further saved.
  • a third embodiment of the present invention provides a method of controlling a CPU, which is executed by a CPU responsible for scheduling. As shown in the detailed flowchart of FIG. 3, the following steps are included:
  • Step 301 Obtain an occupancy rate and a working frequency of the current working CPU.
  • the CPU occupancy value and the operating frequency value can be obtained by detection, respectively.
  • Step 302 Determine whether the occupancy rate of the CPU is greater than the occupancy rate threshold. If the CPU usage is greater than the occupancy threshold, then step 304 is entered. Otherwise, go to step 303. Step 303: When the occupancy rate of the CPU is less than or equal to the occupancy threshold, obtain the product of the occupancy rate and the operating frequency, confirm that the working frequency is the frequency value closest to the product, and clear the loop hold count value.
  • the operating frequency is a discrete value, it is possible that the product and the discrete values do not coincide, so it may be necessary to set the operating frequency to the frequency value closest to the product. Of course, if the product coincides with discrete values, the operating frequency can be set to a frequency value corresponding to the product.
  • the loop hold count value is compared with the loop hold count threshold, and if it is less than the loop hold count threshold, the count continues on the basis of the original count. Once the loop hold count value is greater than or equal to the loop hold count threshold, the existing frequency is adjusted to a higher frequency than the existing frequency.
  • Step 304 Determine whether the working frequency is less than the first frequency. If the operating frequency is less than the first frequency, then step 305 is entered. Otherwise, proceed to step 307. Wherein the first frequency is less than the highest frequency.
  • Step 305 When the operating frequency is less than the first frequency, determine whether the loop hold count value is less than a loop hold count threshold. If the loop hold count value is less than the loop hold count threshold, the flow proceeds to step 306. Otherwise, proceed to step 307.
  • Step 306 When the loop hold count value is less than the loop hold count threshold, confirm that the operating frequency is the first frequency, and further increase the loop hold count value by one.
  • Step 307 When the loop hold count value is greater than or equal to the loop hold count threshold, or the working frequency is greater than or equal to the first frequency, confirm that the CPU operating frequency is the highest frequency.
  • the method for controlling a central processing unit achieves frequency grading by setting a first frequency lower than a highest frequency, and the method of the embodiment can be applied to a medium working frequency (for example, a maximum frequency of up to 1 GHz).
  • a medium working frequency for example, a maximum frequency of up to 1 GHz.
  • CPU hardware chipset Therefore, when the CPU frequency is high, the user experience and the CPU performance are guaranteed, instead of raising the frequency to the maximum frequency at one time, but adjusting the frequency in stages (for example, adjusting to the first frequency first), the CPU power consumption can be further saved. .
  • the method for controlling a central processing unit may also be applied to Finer frequency grading in the CPU hardware chipset.
  • the operating frequency can reach 2 GHz.
  • a first frequency, a second frequency, a third frequency, or even a fourth frequency smaller than the highest frequency can be set.
  • the third frequency may be set at a median frequency of the first frequency and the second frequency in the second embodiment
  • the fourth frequency may be set at a median of the second frequency and the highest frequency in the second embodiment.
  • N is a positive integer greater than or equal to two.
  • a timing function can be added. That is, whenever the timing of the timer arrives, the method of the first embodiment, the second embodiment or the third embodiment described above is executed.
  • One way to control the timer includes:
  • the timer stops timing when the system is idle.
  • the method may further include: when the system exits idle, the timer starts timing.
  • the system is idle or not, and the operating system of the device where the scheduling CPU executing the method of the embodiment is located notifies the CPU responsible for scheduling.
  • Another way to control the timer includes:
  • the timer If the timer is continuously clocked, the operating frequency corresponding to the timer is the maximum frequency, and the working frequency is the frequency maximum just greater than the maximum frequency duration. Then the timer stops counting.
  • the definition of the maximum frequency duration period threshold can be:
  • the sensitivity factor threshold can be set to 200.
  • the open kernel space is an integer greater than or equal to one, such as a value of 1 0.
  • the working frequency is the frequency maximum, the number of times is just greater than the maximum frequency. It is assumed that: the number of times the working frequency is the maximum value of the frequency is the highest frequency and the number of times of the cycle is the threshold value.
  • a fourth embodiment of the present invention provides a method of controlling a CPU, which is based on the first embodiment, the second embodiment, or the third embodiment described above, and explains how various frequencies less than the highest frequency are generated. of.
  • Figure 4 it is a schematic diagram of the current-frequency curve of the CPU of a common execution instruction and operation.
  • the abscissa is the frequency, the unit is MHz (megahertz), and the frequency increases from left to right.
  • the ordinate is the current consumption of the ordinary CPU. From bottom to top, the current consumption increases in turn.
  • the frequency of the abscissa is discrete, that is, the ordinary CPU works at discrete frequency points.
  • the black point of each diamond in the middle of Figure 4 is the measured point of measurement, the current consumption when operating at a specific frequency point. According to each measurement point, a curve representing the relationship between current and frequency can be roughly drawn, as shown by the solid black line in Fig. 4.
  • the solid black line is not a straight line with a fixed slope, but is formed by two straight lines with a fixed slope.
  • the slope of the line connected by the measurement point whose frequency is smaller than the power consumption inflection point frequency can be called a slope
  • a slope of a straight line which may be referred to as a second slope
  • the power point of the power point ie, the measurement point on the right side of the measurement point corresponding to the power inflection point frequency
  • the power inflection point frequency corresponds to a specific value of 918 MHz, which is roughly located between the highest frequency of 1512 MHz and the lowest frequency of 384 MHz, and the frequency in the middle is to ensure the user experience and the running performance of the system.
  • this value can also take other values on different platforms, such as 702MHz, 81 0MHz, or 1 026MHz.
  • the power consumption knee frequency correspondingly consumes relatively low current (corresponding to 150 mA current consumption), so the power consumption knee frequency can be set as the optimal operating frequency point when the normal CPU is working.
  • the first frequency can be Set to the power knee frequency.
  • the power consumption of the ordinary CPU can be further saved, so that other frequencies can be further set between the power inflection point frequency and the highest frequency, so that when the normal CPU frequency is higher than the power consumption After the inflection frequency, the operating frequency of the normal CPU is not adjusted to the highest frequency at one time.
  • the power consumption median frequency can be set at the midpoint of the power knee frequency and the highest frequency.
  • the operating frequency of the normal CPU can be adjusted to the power consumption median frequency instead of being adjusted to the highest frequency at one time, thereby saving the power consumption of the ordinary CPU.
  • the power consumption median frequency can be set to the second frequency.
  • a fifth embodiment of the present invention provides a terminal, as shown in FIG.
  • the terminal 501 described above includes a processor 501 1 .
  • the processor 501 1 may be a CPU responsible for scheduling, and is responsible for scheduling and controlling one or more normal CPUs.
  • the processor 501 1 is configured to: obtain an occupation rate and a working frequency of the working CPU; when the occupancy rate is greater than the occupancy rate threshold, determine whether the working frequency is less than the first frequency; when the working frequency is less than the first frequency When it is confirmed, the operating frequency is the first frequency.
  • the occupancy threshold can take different values depending on the platform. The value can range from 90% to 95%.
  • the different platforms here refer to different hardware chipsets.
  • the processor can include the following functions: Further, the processor is further configured to: when the operating frequency is greater than or equal to the first frequency, determine whether the working frequency is less than or equal to the second frequency, and the second frequency is greater than the first frequency and less than the highest frequency; When the operating frequency is less than or equal to the second frequency, it is confirmed that the operating frequency is the second frequency.
  • the processor determines that the working frequency is the second frequency, and specifically includes:
  • the operating frequency is confirmed to be the second frequency.
  • the loop keeps the count value as compared to the loop hold count threshold. If it is less than the loop hold count threshold, the count continues on the original count. Once the loop hold count value is greater than or equal to the loop hold count threshold, the existing frequency is adjusted to a higher frequency than the existing frequency. Further, the processor is further configured to: add the loop hold count value to one.
  • the processor is further configured to: when the operating frequency is greater than the second frequency, confirm that the operating frequency is a third frequency, and the third frequency is equal to the highest frequency.
  • the processor is further configured to: when the cycle hold count value is greater than or equal to the cycle hold count threshold, confirm that the operating frequency is the highest frequency.
  • the processor is further configured to: when the occupancy rate is greater than the occupancy threshold, and the operating frequency is less than or equal to the first frequency, clear the loop hold count value.
  • the processor is further configured to: when the occupancy rate is less than or equal to the occupancy threshold, obtain a product of the occupancy rate and the working frequency, and confirm that the working frequency is closest to the product The frequency value, and clear the loop to keep the count value.
  • the processor can include the following functions:
  • the processor is further configured to: when the operating frequency is greater than or equal to the first frequency, confirm that the operating frequency is the highest frequency.
  • the processor determines that the working frequency is the first frequency when the operating frequency is less than the first frequency, and specifically: when the operating frequency is less than the first frequency, and the loop keeps the count value less than When the loop keeps counting the threshold, it is confirmed that the operating frequency is the first frequency. Further, the processor is further configured to: add the loop hold count value to one.
  • the processor is further configured to: when the cycle hold count value is greater than or equal to the cycle hold count threshold, confirm that the operating frequency is the highest frequency.
  • the processor is further configured to: when the occupancy rate is less than or equal to the occupancy threshold, obtain a product of the occupancy rate and the working frequency, and confirm that the working frequency is a frequency value closest to the product , and clear the loop to keep the count value.
  • processors are applicable to the first embodiment and the second embodiment described above:
  • the processor is further configured to perform the function of the processor in each of the embodiments described above when the timing of the timer corresponding to the CPU arrives.
  • the processor is further configured to: when the system is idle, the timer stops counting. Further, the processor is further configured to: when the system exits idle, the timer starts timing. The system is idle or not, and the operating system of the device where the scheduling CPU of the method of the embodiment is executed is notified to the CPU responsible for scheduling.
  • the processor is further configured to: if the timer arrives at a continuous timing, the acquired operating frequency of the timer is a maximum frequency, and the working frequency is the frequency maximum If the threshold is greater than the highest frequency duration, the timer stops counting.
  • the definition of the maximum frequency duration period threshold may be: (turning on the CPU power sensitivity factor threshold X-opening kernel space) / (occupancy threshold X frequency weight), wherein the frequency weight is The first weight is described, and the value can be 4.
  • the CPU power sensitivity factor threshold can be set to 200.
  • the open kernel space is an integer greater than or equal to one, such as 1 0.
  • the working frequency is the frequency maximum.
  • the number of times is just greater than the highest frequency.
  • the number of times is the maximum:
  • the number of times the working frequency is the maximum value of the frequency is the highest frequency. For example, if the running time corresponding to the timer is the maximum frequency and the maximum frequency duration is 0, the timer stops counting.
  • the first frequency may be a frequency corresponding to an inflection point in the current-frequency curve.
  • the first slope is smaller than the second slope
  • the first slope is a slope of a straight line formed by a measurement point having a lower frequency than the inflection point; and the second slope is a slope of a straight line formed by a measurement point having a higher frequency than the inflection point.
  • the second frequency is an average of the first frequency and the highest frequency.
  • the terminal provided by the fifth embodiment of the present invention achieves frequency grading by setting a first frequency lower than a highest frequency, or further including a second frequency.
  • the terminal of this embodiment can be applied to a CPU hardware chipset having a medium operating frequency (for example, a maximum frequency of up to 1 GHz), or a CPU hardware chip having a high operating frequency (for example, a maximum frequency of up to 1.5 GHz (gigahertz)). group. Therefore, when the CPU frequency is high, the user experience and the CPU performance are guaranteed, instead of adjusting the frequency to the maximum frequency at one time, but adjusting the frequency in stages (for example, adjusting to the first frequency or the second frequency), further saving can be achieved.
  • CPU power consumption for example, adjusting to the first frequency or the second frequency
  • the sixth embodiment of the present invention further provides a mobile phone, which is a specific form of the terminal provided by the fifth embodiment of the present invention.
  • the terminal may further include a tablet computer, a PDA (Personal Digital Assistant), a POS (Point of Sales), a car computer, and the like.
  • PDA Personal Digital Assistant
  • POS Point of Sales
  • Figure 6 is a block diagram of a portion of the structure of the handset. Referring to FIG.
  • the mobile phone 100 includes an RF (Radio Frequency) circuit 110, a memory 120, an input unit 130, a display unit 140, a sensor 150, an audio circuit 160, a WiFi (Wireless Fidelity) module 170, and a processor. 180, and power supply 190 and other components.
  • RF Radio Frequency
  • the structure of the handset does not constitute a limitation to the handset, and may include more or fewer components than those illustrated, or some components may be combined, or different components may be arranged.
  • the RF circuit 110 can be used for receiving and transmitting signals during and after receiving or transmitting information, and in particular, receiving downlink information of the base station and processing it to the processor 180; in addition, transmitting the designed uplink data to the base station.
  • RF circuits include, but are not limited to, an antenna, at least one amplifier, a transceiver, a coupler, an LNA (Low Noise Amplifier), a duplexer, and the like.
  • RF circuitry 110 can also communicate with the network and other devices via wireless communication.
  • the wireless communication may use any communication standard or protocol, including but not limited to GSM (Global System of Mobile communication), GPRS (General Packet Radio Service), CDMA (Code Division). Multiple Access, Code Division Multiple Access, WCDMA (Wideband Code Division Multiple Access), LTE (Long Term Evolution), e-mail, SMS (Short Messaging Service), and so on.
  • the memory 120 can be used to store software programs and modules, and the processor 180 executes various functional applications and data processing of the mobile phone 100 by running software programs and modules stored in the memory 120.
  • the memory 120 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application required for at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may be stored. Data (such as audio data, phone book, etc.) created according to the use of the mobile phone 100.
  • memory 120 can include high speed random access memory, and can also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
  • the input unit 130 can be configured to receive input numeric or character information, and to generate key signal inputs related to user settings and function control of the handset 100.
  • the input unit 130 may include a touch panel 131 and other input devices 132.
  • the touch panel 131 also referred to as a touch screen, can collect touch operations on or near the user (such as the user using any suitable object such as a finger, a stylus, etc.)
  • the body or the attachment is operated on or near the touch panel 131, and the corresponding connecting device is driven according to a preset program.
  • the touch panel 131 may include two parts: a touch detection device and a touch controller.
  • the touch detection device detects the touch orientation of the user, and detects a signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts the touch information into contact coordinates, and sends the touch information
  • the processor 180 is provided and can receive commands from the processor 180 and execute them.
  • the touch panel 131 can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic waves.
  • the input unit 130 may also include other input devices 132.
  • other input devices 132 may include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control buttons, switch buttons, etc.), trackballs, mice, joysticks, and the like.
  • the display unit 140 can be used to display information input by the user or information provided to the user as well as various menus of the mobile phone 100.
  • the display unit 140 may include a display panel 141.
  • the display panel may be configured in the form of an LCD (Liquid Crystal Display), an OLED (Organic Light-Educing Diode), or the like.
  • the touch panel 131 can cover the display panel 141. When the touch panel 131 detects a touch operation on or near the touch panel 131, the touch panel 131 transmits to the processor 180 to determine the type of the touch event, and then the processor 180 according to the touch event. The type provides a corresponding visual output on display panel 141.
  • touch panel 131 and the display panel 141 are used as two independent components to implement the input and input functions of the mobile phone 100 in FIG. 6, in some embodiments, the touch panel 131 may be integrated with the display panel 141. The input and output functions of the mobile phone 100 are implemented.
  • the handset 100 can also include at least one type of sensor 150, such as a light sensor, motion sensor, and other sensors.
  • the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel 141 according to the brightness of the ambient light, and the proximity sensor may close the display panel 141 when the mobile phone 100 moves to the ear. / or backlight.
  • the accelerometer sensor can detect the acceleration of each direction (usually three axes), and the magnitude and direction of gravity can be detected at rest, which can be used to identify the attitude of the mobile phone.
  • the audio circuit 160, the speaker 161, and the microphone 162 provide an audio interface between the user and the handset 100.
  • the audio circuit 160 can transmit the converted electrical data of the received audio data to the speaker 161 for conversion to the sound signal output by the speaker 161; on the other hand, the microphone 162 converts the collected sound signal into an electrical signal by the audio circuit 160. After receiving, it is converted into audio data, and the audio data is output to the RF circuit 108 for transmission to, for example, another mobile phone, or the audio data is output to the memory 120 for further processing.
  • WiF i is a short-range wireless transmission technology
  • the mobile phone 100 can help users to send and receive e-mail, browse web pages, and access streaming media through the WiF i module 170, which provides users with wireless broadband Internet access.
  • FIG. 1 shows the WiFi module 170, it can be understood that it does not belong to the essential configuration of the mobile phone 100, and may be omitted as needed within the scope of not changing the essence of the invention.
  • the processor 180 is the control center of the handset 100, connecting various portions of the entire handset using various interfaces and lines, by running or executing software programs and/or modules stored in the memory 120, and recalling data stored in the memory 120, The various functions and processing data of the mobile phone 100 are executed to perform overall monitoring of the mobile phone.
  • the processor 180 can integrate an application processor and a modulation and demodulation processor, wherein the application processor mainly processes an operating system, a user interface, an application, etc., and the modem processor mainly processes wireless communication. It will be appreciated that the above described modem processor may also not be integrated into the processor 180.
  • the processor 180 can include one or more processing units.
  • One or more processing units may include a separate scheduling CPU and one or more normal CPUs.
  • the scheduling CPU can schedule a normal CPU.
  • the hardware form of the scheduling CPU may be an Advanced Reduced Ins truction Set Computation (RISC) Machines (ARM) chip, or other chips such as a single chip microcomputer.
  • RISC Advanced Reduced Ins truction Set Computation
  • ARM Advanced Reduced Ins truction Set Computation
  • a normal CPU is a CPU that normally executes instructions and operations.
  • the function of the scheduling CPU can also be integrated in one or several common CPUs, which is not limited in this embodiment. For details of the functions of the scheduling CPU, refer to the foregoing first to fifth embodiments, and details are not described herein again.
  • the mobile phone 1 00 also includes a power supply 190 (such as a battery) that supplies power to various components.
  • a power supply 190 such as a battery
  • the power supply can be logically coupled to the processor 180 through a power management system to manage functions such as charging, discharging, and power consumption through the power management system.
  • the mobile phone 100 may also include a camera, a Bluetooth module, etc., and will not be described herein.
  • the seventh embodiment of the present invention further provides an apparatus. As shown in FIG. 7, the apparatus 701 includes: a first unit 701 1 that acquires an occupancy rate and a working frequency of a working CPU; and a second unit 7012, when the occupancy rate If the working frequency is less than the first frequency, the third unit 701 3 determines that the working frequency is the first frequency.
  • the first frequency is less than a highest frequency of the CPU.
  • the occupancy threshold can take different values depending on the platform. The value can range from 90% to 95%.
  • the different platforms here refer to different hardware chipsets.
  • the device provided by the embodiment of the present invention further determines whether the working frequency is smaller than the first frequency after the CPU usage is greater than the occupancy threshold. When the operating frequency is less than the first frequency, it is confirmed that the operating frequency is a first frequency that is less than the highest frequency of the CPU. This way of adjusting the frequency does not adjust the CPU frequency to the highest frequency once, so it can reduce the CPU's power consumption in frequency adjustment.
  • the eighth embodiment of the present invention further provides a device. As shown in FIG. 8A, the device further includes:
  • a fourth unit configured to determine the work when the working frequency is greater than or equal to the first frequency Whether the frequency is less than or equal to the second frequency, the second frequency is greater than the first frequency and less than the highest frequency.
  • a fifth unit configured to confirm that the operating frequency is the second frequency when the operating frequency is less than or equal to the second frequency.
  • the fifth unit is further specifically configured to: when the operating frequency is less than or equal to the second frequency, and the loop hold count value is less than the loop hold count threshold, confirm that the operating frequency is the second frequency.
  • the apparatus may further include: a sixth unit, configured to hold the count value of the cycle.
  • the apparatus may further include: a seventh unit, configured to: when the operating frequency is greater than the second frequency, confirm that the operating frequency is a third frequency, the third frequency being equal to the highest frequency.
  • the apparatus may further include: an eighth unit, configured to confirm that the operating frequency is the highest frequency when the loop hold count value is greater than or equal to the loop hold count threshold.
  • the device may further include: a ninth unit, configured to: when the occupancy rate is greater than the occupancy threshold, and the operating frequency is less than or equal to the first frequency, clear the cycle to keep counting value.
  • the device may further include: a tenth unit, configured to: when the occupancy rate is less than or equal to the occupancy threshold, obtain a product of the occupancy rate and the working frequency, and confirm that the working frequency is The frequency value closest to the product, and clearing the loop hold count value.
  • a tenth unit configured to: when the occupancy rate is less than or equal to the occupancy threshold, obtain a product of the occupancy rate and the working frequency, and confirm that the working frequency is The frequency value closest to the product, and clearing the loop hold count value.
  • the device provided by the embodiment of the invention achieves a finer division of the frequency level by setting a second frequency higher than the first frequency and a third frequency higher than the second frequency, and is suitable for having a higher operating frequency (eg, the highest frequency) CPU hardware chipset up to 1. 5GHz (gigahertz). Therefore, when the CPU frequency is high, and the user experience and the CPU performance are guaranteed, the frequency is not increased to the maximum frequency at one time, but the frequency is adjusted in stages, so that the power consumption of the CPU can be further saved.
  • the eighth embodiment of the present invention further provides a device, as shown in FIG. 8B, the device is in the foregoing Based on the seventh embodiment, the method further includes:
  • the eleventh unit is configured to confirm that the operating frequency is the highest frequency when the operating frequency is greater than or equal to the first frequency.
  • the third unit is specifically configured to: when the operating frequency is less than the first frequency, and the loop hold count value is less than the loop hold count threshold, confirm that the operating frequency is the first frequency.
  • the apparatus may further include: a twelfth unit, configured to increase the cycle hold count value by one.
  • the apparatus may further include: a thirteenth unit, configured to confirm that the operating frequency is the highest frequency when the loop hold count value is greater than or equal to the loop hold count threshold.
  • the device may further include: a fourteenth unit, configured to acquire, when the occupancy rate is less than or equal to the occupancy threshold, a product of the occupancy rate and the working frequency, and confirm the working frequency Is the frequency value closest to the product, and clears the loop hold count value.
  • the method for controlling a central processing unit achieves frequency grading by setting a first frequency lower than a highest frequency, and the method of the embodiment can be applied to a medium working frequency (for example, a maximum frequency of up to 1 GHz).
  • a medium working frequency for example, a maximum frequency of up to 1 GHz.
  • CPU hardware chipset Therefore, when the CPU frequency is high, the user experience and the CPU performance are guaranteed, instead of raising the frequency to the maximum frequency at one time, but adjusting the frequency in stages (for example, adjusting to the first frequency first), the CPU power consumption can be further saved.
  • the eighth embodiment of the present invention further provides a device. As shown in FIG. 8C, the device further includes the foregoing embodiment of the present invention or the embodiment corresponding to FIG. 8A or the embodiment corresponding to FIG. 8B. :
  • the timer is configured to perform the functions of the seventh embodiment of the present invention or the apparatus corresponding to the embodiment corresponding to FIG. 8A or the embodiment corresponding to FIG. 8B when the timing of the timer corresponding to the CPU arrives.
  • the apparatus may further include: a fifteenth unit, configured to control when the system is idle The timer stops counting.
  • the apparatus may further include: a sixteenth unit, configured to control the timer to start timing when the system exits idle.
  • the device may further include: a seventeenth unit, configured to: when the timer arrives at a continuous timing, the operating frequency corresponding to the timer is a maximum frequency, and the working frequency is The timer is stopped when the frequency maximum is just greater than the highest frequency duration.
  • a seventeenth unit configured to: when the timer arrives at a continuous timing, the operating frequency corresponding to the timer is a maximum frequency, and the working frequency is The timer is stopped when the frequency maximum is just greater than the highest frequency duration.
  • the maximum frequency duration period threshold is: (turn on the CPU power sensitivity factor threshold X to open the kernel space) / (occupancy threshold X frequency weight), wherein the frequency weight is the first weight ;
  • the working frequency is the frequency maximum, the number of times is just greater than the highest frequency, and the number of times is the same.
  • the value of the working frequency is the maximum value of the frequency.
  • the first frequency is the frequency corresponding to the inflection point in the current-frequency curve.
  • the first slope is smaller than the second slope; the first slope is a slope of a straight line formed by a measurement point lower than a frequency corresponding to the inflection point; and the second slope is corresponding to the inflection point The slope of the line formed by the high frequency measurement points.
  • the second frequency is an average of the first frequency and the highest frequency.
  • a ninth embodiment of the present invention also provides a computer program for carrying a program code, the program code performing the method according to the first to fourth embodiments of the present invention when the computer program is run on a computer.
  • a tenth embodiment of the present invention further provides a computer readable storage medium storing computer program code, when the computer program code is executed by a computer, the computer program code can confirm that the computer executes the first to fourth embodiments of the present invention The steps of the method described.
  • An eleventh embodiment of the present invention further provides a computer program product, comprising: computer program code, when the computer program code is executed by a computer, the computer program code can confirm that the computer executes the first to fourth implementations of the present invention The steps of the method described in the examples.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Power Sources (AREA)
  • Mobile Radio Communication Systems (AREA)
  • Telephone Function (AREA)

Description

一种控制中央处理器的方法和装置
技术领域
本发明涉及通信领域, 尤其涉及一种控制中央处理器的方法和装置。
背景技术
随着计算需求特别是移动计算领域的不断增加,处理器正朝着高主频、 多核心方向发展, 单位时间内的并行处理能力大大增加, 同时也带来了较 大的功耗负担。 减小处理器的无效功率耗用问题对于计算系统, 尤其是移 动手持式计算设备而言具有重要意义。
现有技术提出一种技术方案, 一旦 CPU 占用率大于占用率阔值, 即将 CPU频率设置为最高频率。但这样的调频方式使得 CPU在 CPU占用率大于占 用率阔值后, 一直工作在最高频率, 会造成 CPU不必要的电量浪费。
发明内容
本发明实施例提供一种控制中央处理器的方法和装置, 可减少频率调 整中, 当 CPU占用率大于占用率阔值时的 CPU电量消耗。
根据本发明的第一方面, 一种控制中央处理器 CPU的方法, 包括: 获取工作的 CPU的占用率和工作频率;
当所述占用率大于占用率阔值,判断所述工作频率是否小于第一频率; 当所述工作频率小于第一频率时, 确认所述工作频率为第一频率; 其中, 所述第一频率小于所述 CPU的最高频率。
在第一方面的第一种可能的实现方式中, 所述方法还包括:
当所述工作频率大于或等于第一频率时, 判断所述工作频率是否小于 或等于第二频率, 所述第二频率大于所述第一频率且小于所述最高频率; 当所述工作频率小于或等于所述第二频率时, 确认所述工作频率为第 二频率。
结合第一方面的第一种可能的实现方式,在第二种可能的实现方式中, 所述当所述工作频率小于或等于所述第二频率时, 确认所述工作频率为第 二频率, 包括:
当所述工作频率小于或等于所述第二频率, 且循环保持计数值小于循 环保持计数阔值时, 确认所述工作频率为第二频率。
结合第一方面的第二种可能的实现方式,在第三种可能的实现方式中, 还包括:
所述循环保持计数值加一。
结合第一方面的第一种可能的实现方式, 或第一方面的第二种可能的 实现方式, 或第一方面的第三种可能的实现方式, 在第四种可能的实现方 式中, 还包括:
当所述工作频率大于所述第二频率时,确认所述工作频率为第三频率, 所述第三频率等于所述最高频率。
结合第一方面的第二种可能的实现方式, 或第一方面的第三种可能的 实现方式, 或第一方面的第四种可能的实现方式, 在第五种可能的实现方 式中, 还包括:
当所述循环保持计数值大于或等于所述循环保持计数阔值时, 确认所 述工作频率为所述最高频率。
结合第一方面的第二种可能的实现方式, 或第一方面的第三种可能的 实现方式, 或第一方面的第四种可能的实现方式, 或第一方面的第五种可 能的实现方式, 在第六种可能的实现方式中, 还包括:
当所述占用率大于所述占用率阔值, 且所述工作频率小于或等于所述 第一频率时, 清零所述循环保持计数值。
结合第一方面, 或第一方面的第一种可能的实现方式, 第一方面的第 二种可能的实现方式, 或第一方面的第三种可能的实现方式, 或第一方面 的第四种可能的实现方式, 或第一方面的第五种可能的实现方式, 或第一 方面的第六种可能的实现方式, 在第七种可能的实现方式中, 还包括: 当所述占用率小于或等于所述占用率阔值时, 获取所述占用率与所述 工作频率的乘积, 确认所述工作频率为与所述乘积最接近的频率值, 并清 零所述循环保持计数值。
在第一方面的第八种可能的实现方式中, 还包括:
当所述工作频率大于或等于第一频率时, 确认所述工作频率为最高频 率。
结合第一方面, 或第一方面的第八种可能的实现方式, 在第九种可能 的实现方式中, 所述当所述工作频率小于第一频率时, 确认所述工作频率 为第一频率, 具体为:
当所述工作频率小于第一频率, 且循环保持计数值小于循环保持计数 阔值时, 确认所述工作频率为第一频率。
结合第一方面的第九种可能的实现方式,在第十种可能的实现方式中, 还包括:
所述循环保持计数值加一。
结合第一方面的第九种可能的实现方式, 或第一方面的第十种可能的 实现方式, 在第十一种可能的实现方式中, 还包括:
当所述循环保持计数值大于或等于所述循环保持计数阔值时, 确认所 述工作频率为所述最高频率。
结合第一方面的第九种可能的实现方式, 或第一方面的第十种可能的 实现方式, 或第一方面的第十一种可能的实现方式, 在第十二种可能的实 现方式中, 还包括:
当所述占用率小于或等于所述占用率阔值时, 获取所述占用率与所述 工作频率的乘积, 确认所述工作频率为与所述乘积最接近的频率值, 并清 零所述循环保持计数值。 结合第一方面, 或第一方面的第一种可能的实现方式, 或第一方面的 第二种可能的实现方式, 或第一方面的第三种可能的实现方式, 或第一方 面的第四种可能的实现方式, 或第一方面的第五种可能的实现方式, 或第 一方面的第六种可能的实现方式, 或第一方面的第七种可能的实现方式, 或第一方面的第八种可能的实现方式, 或第一方面的第九种可能的实现方 式, 或第一方面的第十种可能的实现方式, 或第一方面的第十一种可能的 实现方式, 或第一方面的第十二种可能的实现方式, 在第十三种可能的实 现方式中, 在所述 CPU对应的定时器的计时时刻到达时, 执行所述方法的 步骤。
结合第一方面的第十三种可能的实现方式, 在第十四种可能的实现方 式中, 所述方法还包括: 当系统空闲时, 所述定时器停止计时。
结合第一方面的第十三种可能的实现方式, 或第一方面的第十四种可 能的实现方式, 在第十五种可能的实现方式中, 所述方法还包括: 当系统 退出空闲时, 所述定时器启动计时。
结合第一方面的第十三种可能的实现方式, 或第一方面的第十四种可 能的实现方式, 或第一方面的第十五种可能的实现方式, 在第十六种可能 的实现方式中, 所述方法还包括:
如果在所述定时器连续计时时刻到达时, 获取的所述定时器对应的工 作频率均为频率最大值, 且所述工作频率均为频率最大值的次数刚大于最 高频率持续周期次数阔值, 则所述定时器停止计时。
结合第一方面的第十六种可能的实现方式, 在第十七种可能的实现方 式中, 所述最高频率持续周期次数阔值为:
(开启 CPU功耗敏感因子阔值 X开核釆样空间) / (占用率阔值 X频率 权重), 其中, 所述频率权重为所述第一权重;
所述工作频率均为频率最大值的次数刚大于最高频率持续周期次数阔 值为: 所述工作频率均为频率最大值的次数为最高频率持续周期次数阔值加 结合第一方面, 或第一方面的第一种可能的实现方式, 或第一方面的 第二种可能的实现方式, 或第一方面的第三种可能的实现方式, 或第一方 面的第四种可能的实现方式, 或第一方面的第五种可能的实现方式, 或第 一方面的第六种可能的实现方式, 或第一方面的第七种可能的实现方式, 或第一方面的第八种可能的实现方式, 或第一方面的第九种可能的实现方 式, 或第一方面的第十种可能的实现方式, 或第一方面的第十一种可能的 实现方式, 或第一方面的第十二种可能的实现方式, 或第一方面的第十三 种可能的实现方式, 或第一方面的第十四种可能的实现方式, 或第一方面 的第十五种可能的实现方式, 或第一方面的第十六种可能的实现方式, 或 第一方面的第十七种可能的实现方式, 在第十八种可能的实现方式中, 所 述第一频率为电流-频率曲线中的拐点对应的频率。
结合第一方面的第十八种可能的实现方式, 在第十九种可能的实现方 式中, 所述电流-频率曲线中, 第一斜率小于第二斜率;
所述第一斜率为比所述拐点对应的频率低的测量点形成的直线的斜 率; 所述第二斜率为比所述拐点对应的频率高的测量点形成的直线的斜率。
结合第一方面的第一种可能的实现方式, 或第一方面的第二种可能的 实现方式, 或第一方面的第三种可能的实现方式, 或第一方面的第四种可 能的实现方式, 或第一方面的第五种可能的实现方式, 或第一方面的第六 种可能的实现方式, 或第一方面的第七种可能的实现方式, 或第一方面的 第八种可能的实现方式, 或第一方面的第九种可能的实现方式, 或第一方 面的第十种可能的实现方式, 或第一方面的第十一种可能的实现方式, 或 第一方面的第十二种可能的实现方式, 或第一方面的第十三种可能的实现 方式, 或第一方面的第十四种可能的实现方式, 或第一方面的第十五种可 能的实现方式, 或第一方面的第十六种可能的实现方式, 或第一方面的第 十七种可能的实现方式, 或第一方面的第十八种可能的实现方式, 或第一 方面的第十九种可能的实现方式, 在第二十种可能的实现方式中, 所述第 二频率为所述第一频率和所述最高频率的平均值。
根据本发明的第二方面, 一种终端, 包括处理器, 所述处理器用于: 获取工作的 CPU的占用率和工作频率;
当所述占用率大于占用率阔值,判断所述工作频率是否小于第一频率; 当所述工作频率小于第一频率时, 确认所述工作频率为第一频率; 其中, 所述第一频率小于所述 CPU的最高频率。
在第二方面的第一种可能的实现方式中, 所述处理器还用于: 当所述工作频率大于或等于第一频率时, 判断所述工作频率是否小于 或等于第二频率, 所述第二频率大于所述第一频率且小于所述最高频率; 当所述工作频率小于或等于所述第二频率时, 确认所述工作频率为第 二频率。
结合第二方面的第一种可能的实现方式,在第二种可能的实现方式中, 所述处理器当所述工作频率小于或等于所述第二频率时, 确认所述工作频 率为第二频率, 包括:
当所述工作频率小于或等于所述第二频率, 且循环保持计数值小于循 环保持计数阔值时, 确认所述工作频率为第二频率。
结合第二方面的第二种可能的实现方式,在第三种可能的实现方式中, 所述处理器还用于:
所述循环保持计数值加一。
结合第二方面的第一种可能的实现方式, 或第二方面的第二种可能的 实现方式, 或第二方面的第三种可能的实现方式, 在第四种可能的实现方 式中, 处理器还用于:
当所述工作频率大于所述第二频率时,确认所述工作频率为第三频率, 所述第三频率等于所述最高频率。 结合第二方面的第二种可能的实现方式, 或第二方面的第三种可能的 实现方式, 或第二方面的第四种可能的实现方式, 在第五种可能的实现方 式中, 所述处理器还用于:
当所述循环保持计数值大于或等于所述循环保持计数阔值时, 确认所 述工作频率为所述最高频率。
结合第二方面的第二种可能的实现方式, 或第二方面的第三种可能的 实现方式, 或第二方面的第四种可能的实现方式, 或第二方面的第五种可 能的实现方式, 在第六种可能的实现方式中, 所述处理器还用于:
当所述占用率大于所述占用率阔值, 且所述工作频率小于或等于所述 第一频率时, 清零所述循环保持计数值。
结合第二方面, 或第二方面的第一种可能的实现方式, 第二方面的第 二种可能的实现方式, 或第二方面的第三种可能的实现方式, 或第二方面 的第四种可能的实现方式, 或第二方面的第五种可能的实现方式, 或第二 方面的第六种可能的实现方式, 在第七种可能的实现方式中, 所述处理器 还用于:
当所述占用率小于或等于所述占用率阔值时, 获取所述占用率与所述 工作频率的乘积, 确认所述工作频率为与所述乘积最接近的频率值, 并清 零所述循环保持计数值。
在第二方面的第八种可能的实现方式中, 所述处理器还用于: 当所述工作频率大于或等于第一频率时, 确认所述工作频率为最高频 率。
结合第二方面, 或第二方面的第八种可能的实现方式, 在第九种可能 的实现方式中, 所述处理器当所述工作频率小于第一频率时, 确认所述工 作频率为第一频率, 具体为:
当所述工作频率小于第一频率, 且循环保持计数值小于循环保持计数 阔值时, 确认所述工作频率为第一频率。 结合第二方面的第九种可能的实现方式,在第十种可能的实现方式中, 所述处理器还用于:
所述循环保持计数值加一。
结合第二方面的第九种可能的实现方式, 或第二方面的第十种可能的 实现方式, 在第十一种可能的实现方式中, 所述处理器还用于:
当所述循环保持计数值大于或等于所述循环保持计数阔值时, 确认所 述工作频率为所述最高频率。
结合第二方面的第九种可能的实现方式, 或第二方面的第十种可能的 实现方式, 或第二方面的第十一种可能的实现方式, 在第十二种可能的实 现方式中, 所述处理器还用于:
当所述占用率小于或等于所述占用率阔值时, 获取所述占用率与所述 工作频率的乘积, 确认所述工作频率为与所述乘积最接近的频率值, 并清 零所述循环保持计数值。
结合第二方面, 或第二方面的第一种可能的实现方式, 或第二方面的 第二种可能的实现方式, 或第二方面的第三种可能的实现方式, 或第二方 面的第四种可能的实现方式, 或第二方面的第五种可能的实现方式, 或第 二方面的第六种可能的实现方式, 或第二方面的第七种可能的实现方式, 或第二方面的第八种可能的实现方式, 或第二方面的第九种可能的实现方 式, 或第二方面的第十种可能的实现方式, 或第二方面的第十一种可能的 实现方式, 或第二方面的第十二种可能的实现方式, 在第十三种可能的实 现方式中, 所述处理器还用于: 在所述 CPU对应的定时器的计时时刻到达 时, 执行所述方法的步骤。
结合第二方面的第十三种可能的实现方式, 在第十四种可能的实现方 式中, 所述处理器还用于: 当系统空闲时, 所述定时器停止计时。
结合第二方面的第十三种可能的实现方式, 或第二方面的第十四种可 能的实现方式, 在第十五种可能的实现方式中, 所述处理器还用于: 当系 统退出空闲时, 所述定时器启动计时。
结合第二方面的第十三种可能的实现方式, 或第二方面的第十四种可 能的实现方式, 或第二方面的第十五种可能的实现方式, 在第十六种可能 的实现方式中, 所述处理器还用于:
如果在所述定时器连续计时时刻到达时, 获取的所述定时器对应的工 作频率均为频率最大值, 且所述工作频率均为频率最大值的次数刚大于最 高频率持续周期次数阔值, 则所述定时器停止计时。
结合第二方面的第十六种可能的实现方式, 在第十七种可能的实现方 式中, 所述最高频率持续周期次数阔值为:
(开启 CPU功耗敏感因子阔值 X开核釆样空间) / (占用率阔值 X频率 权重), 其中, 所述频率权重为所述第一权重;
所述工作频率均为频率最大值的次数刚大于最高频率持续周期次数阔 值为:
所述工作频率均为频率最大值的次数为最高频率持续周期次数阔值加 结合第二方面, 或第二方面的第一种可能的实现方式, 或第二方面的 第二种可能的实现方式, 或第二方面的第三种可能的实现方式, 或第二方 面的第四种可能的实现方式, 或第二方面的第五种可能的实现方式, 或第 二方面的第六种可能的实现方式, 或第二方面的第七种可能的实现方式, 或第二方面的第八种可能的实现方式, 或第二方面的第九种可能的实现方 式, 或第二方面的第十种可能的实现方式, 或第二方面的第十一种可能的 实现方式, 或第二方面的第十二种可能的实现方式, 或第二方面的第十三 种可能的实现方式, 或第二方面的第十四种可能的实现方式, 或第二方面 的第十五种可能的实现方式, 或第二方面的第十六种可能的实现方式, 或 第二方面的第十七种可能的实现方式, 在第十八种可能的实现方式中, 所 述第一频率为电流-频率曲线中的拐点对应的频率。 结合第二方面的第十八种可能的实现方式, 在第十九种可能的实现方 式中, 所述电流-频率曲线中, 第一斜率小于第二斜率;
所述第一斜率为比所述拐点对应的频率低的测量点形成的直线的斜 率; 所述第二斜率为比所述拐点对应的频率高的测量点形成的直线的斜率。
结合第二方面的第一种可能的实现方式, 或第二方面的第二种可能的 实现方式, 或第二方面的第三种可能的实现方式, 或第二方面的第四种可 能的实现方式, 或第二方面的第五种可能的实现方式, 或第二方面的第六 种可能的实现方式, 或第二方面的第七种可能的实现方式, 或第二方面的 第八种可能的实现方式, 或第二方面的第九种可能的实现方式, 或第二方 面的第十种可能的实现方式, 或第二方面的第十一种可能的实现方式, 或 第二方面的第十二种可能的实现方式, 或第二方面的第十三种可能的实现 方式, 或第二方面的第十四种可能的实现方式, 或第二方面的第十五种可 能的实现方式, 或第二方面的第十六种可能的实现方式, 或第二方面的第 十七种可能的实现方式, 或第二方面的第十八种可能的实现方式, 或第二 方面的第十九种可能的实现方式, 在第二十种可能的实现方式中, 所述第 二频率为所述第一频率和所述最高频率的平均值。
根据本发明的第三方面, 一种装置, 包括:
第一单元, 获取工作的 CPU的占用率和工作频率;
第二单元, 当所述占用率大于占用率阔值, 判断所述工作频率是否小 于第一频率;
第三单元, 当所述工作频率小于第一频率时, 确认所述工作频率为第 一频率; 其中, 所述第一频率小于所述 CPU的最高频率。
在第三方面的第一种可能的实现方式中, 所述装置还包括:
第四单元, 用于当所述工作频率大于或等于第一频率时, 判断所述工 作频率是否小于或等于第二频率, 所述第二频率大于所述第一频率且小于 所述最高频率; 第五单元, 用于当所述工作频率小于或等于所述第二频率时, 确认所 述工作频率为第二频率。
结合第三方面的第一种可能的实现方式,在第二种可能的实现方式中, 所述第五单元具体用于: 当所述工作频率小于或等于所述第二频率, 且循 环保持计数值小于循环保持计数阔值时, 确认所述工作频率为第二频率。
结合第三方面的第二种可能的实现方式,在第三种可能的实现方式中, 还包括: 第六单元, 用于将所述循环保持计数值加一。
结合第三方面的第一种可能的实现方式, 或第三方面的第二种可能的 实现方式, 或第三方面的第三种可能的实现方式, 在第四种可能的实现方 式中, 还包括:
第七单元, 用于当所述工作频率大于所述第二频率时, 确认所述工作 频率为第三频率, 所述第三频率等于所述最高频率。
结合第三方面的第二种可能的实现方式, 或第三方面的第三种可能的 实现方式, 或第三方面的第四种可能的实现方式, 在第五种可能的实现方 式中, 还包括:
第八单元, 用于当所述循环保持计数值大于或等于所述循环保持计数 阔值时, 确认所述工作频率为所述最高频率。
结合第三方面的第二种可能的实现方式, 或第三方面的第三种可能的 实现方式, 或第三方面的第四种可能的实现方式, 或第三方面的第五种可 能的实现方式, 在第六种可能的实现方式中, 还包括:
第九单元, 用于当所述占用率大于所述占用率阔值, 且所述工作频率 小于或等于所述第一频率时, 清零所述循环保持计数值。
结合第三方面, 或第三方面的第一种可能的实现方式, 第三方面的第 二种可能的实现方式, 或第三方面的第三种可能的实现方式, 或第三方面 的第四种可能的实现方式, 或第三方面的第五种可能的实现方式, 或第三 方面的第六种可能的实现方式, 在第七种可能的实现方式中, 还包括: 第十单元, 用于当所述占用率小于或等于所述占用率阔值时, 获取所 述占用率与所述工作频率的乘积, 确认所述工作频率为与所述乘积最接近 的频率值, 并清零所述循环保持计数值。
在第三方面的第八种可能的实现方式中, 还包括:
第十一单元, 用于当所述工作频率大于或等于第一频率时, 确认所述 工作频率为最高频率。
结合第三方面, 或第三方面的第八种可能的实现方式, 在第九种可能 的实现方式中, 所述第三单元具体用于:
当所述工作频率小于第一频率, 且循环保持计数值小于循环保持计数 阔值时, 确认所述工作频率为第一频率。
结合第三方面的第九种可能的实现方式,在第十种可能的实现方式中, 还包括第十二单元, 用于将所述循环保持计数值加一。
结合第三方面的第九种可能的实现方式, 或第三方面的第十种可能的 实现方式, 在第十一种可能的实现方式中, 还包括:
第十三单元, 用于当所述循环保持计数值大于或等于所述循环保持计 数阔值时, 确认所述工作频率为所述最高频率。
结合第三方面的第九种可能的实现方式, 或第三方面的第十种可能的 实现方式, 或第三方面的第十一种可能的实现方式, 在第十二种可能的实 现方式中, 还包括:
第十四单元, 用于当所述占用率小于或等于所述占用率阔值时, 获取 所述占用率与所述工作频率的乘积, 确认所述工作频率为与所述乘积最接 近的频率值, 并清零所述循环保持计数值。
结合第三方面, 或第三方面的第一种可能的实现方式, 或第三方面的 第二种可能的实现方式, 或第三方面的第三种可能的实现方式, 或第三方 面的第四种可能的实现方式, 或第三方面的第五种可能的实现方式, 或第 三方面的第六种可能的实现方式, 或第三方面的第七种可能的实现方式, 或第三方面的第八种可能的实现方式, 或第三方面的第九种可能的实现方 式, 或第三方面的第十种可能的实现方式, 或第三方面的第十一种可能的 实现方式, 或第三方面的第十二种可能的实现方式, 在第十三种可能的实 现方式中, 还包括: 定时器, 用于在所述 CPU对应的定时器的计时时刻到 达时, 执行所述方法的步骤。
结合第三方面的第十三种可能的实现方式, 在第十四种可能的实现方 式中, 所述方法还包括第十五单元, 用于: 当系统空闲时, 所述定时器停 止计时。
结合第三方面的第十三种可能的实现方式, 或第三方面的第十四种可 能的实现方式, 在第十五种可能的实现方式中, 所述方法还包括第十六单 元, 用于: 当系统退出空闲时, 所述定时器启动计时。
结合第三方面的第十三种可能的实现方式, 或第三方面的第十四种可 能的实现方式, 或第三方面的第十五种可能的实现方式, 在第十六种可能 的实现方式中, 所述方法还包括:
第十七单元, 用于在所述定时器连续计时时刻到达时, 获取的所述定 时器对应的工作频率均为频率最大值, 且所述工作频率均为频率最大值的 次数刚大于最高频率持续周期次数阔值, 则所述定时器停止计时。
结合第三方面的第十六种可能的实现方式, 在第十七种可能的实现方 式中, 所述最高频率持续周期次数阔值为:
(开启 CPU功耗敏感因子阔值 X开核釆样空间) / (占用率阔值 X频率 权重), 其中, 所述频率权重为所述第一权重;
所述工作频率均为频率最大值的次数刚大于最高频率持续周期次数阔 值为:
所述工作频率均为频率最大值的次数为最高频率持续周期次数阔值加 结合第三方面, 或第三方面的第一种可能的实现方式, 或第三方面的 第二种可能的实现方式, 或第三方面的第三种可能的实现方式, 或第三方 面的第四种可能的实现方式, 或第三方面的第五种可能的实现方式, 或第 三方面的第六种可能的实现方式, 或第三方面的第七种可能的实现方式, 或第三方面的第八种可能的实现方式, 或第三方面的第九种可能的实现方 式, 或第三方面的第十种可能的实现方式, 或第三方面的第十一种可能的 实现方式, 或第三方面的第十二种可能的实现方式, 或第三方面的第十三 种可能的实现方式, 或第三方面的第十四种可能的实现方式, 或第三方面 的第十五种可能的实现方式, 或第三方面的第十六种可能的实现方式, 或 第三方面的第十七种可能的实现方式, 在第十八种可能的实现方式中, 所 述第一频率为电流-频率曲线中的拐点对应的频率。
结合第三方面的第十八种可能的实现方式, 在第十九种可能的实现方 式中, 所述电流-频率曲线中, 第一斜率小于第二斜率;
所述第一斜率为比所述拐点对应的频率低的测量点形成的直线的斜 率; 所述第二斜率为比所述拐点对应的频率高的测量点形成的直线的斜率。
结合第三方面的第一种可能的实现方式, 或第三方面的第二种可能的 实现方式, 或第三方面的第三种可能的实现方式, 或第三方面的第四种可 能的实现方式, 或第三方面的第五种可能的实现方式, 或第三方面的第六 种可能的实现方式, 或第三方面的第七种可能的实现方式, 或第三方面的 第八种可能的实现方式, 或第三方面的第九种可能的实现方式, 或第三方 面的第十种可能的实现方式, 或第三方面的第十一种可能的实现方式, 或 第三方面的第十二种可能的实现方式, 或第三方面的第十三种可能的实现 方式, 或第三方面的第十四种可能的实现方式, 或第三方面的第十五种可 能的实现方式, 或第三方面的第十六种可能的实现方式, 或第三方面的第 十七种可能的实现方式, 或第三方面的第十八种可能的实现方式, 或第三 方面的第十九种可能的实现方式, 在第二十种可能的实现方式中, 所述第 二频率为所述第一频率和所述最高频率的平均值。 根据本发明的第四方面, 一种携带程序代码的计算机程序, 当所述计 算机程序在计算机上运行时, 所述程序代码执行结合本发明的第一方面; 或第一方面的第一种可能的实现方式; 或第一方面的第二种可能的实现方 式; 或第一方面的第三种可能的实现方式; 或第一方面的第四种可能的实 现方式; 或第一方面的第五种可能的实现方式; 或第一方面的第六种可能 的实现方式; 或第一方面的第七种可能的实现方式; 或第一方面的第八种 可能的实现方式; 或第一方面的第九种可能的实现方式; 或第一方面的第 十种可能的实现方式; 或第一方面的第十一种可能的实现方式; 或第一方 面的第十二种可能的实现方式; 或第一方面的第十三种可能的实现方式; 或第一方面的第十四种可能的实现方式; 或第一方面的第十五种可能的实 现方式; 或第一方面的第十六种可能的实现方式; 或第一方面的第十七种 可能的实现方式; 或第一方面的第十八种可能的实现方式; 或第一方面的 第十九种可能的实现方式; 或第一方面的第二十种可能的实现方式; 或本 发明的第二方面; 或第二方面的第一种可能的实现方式; 或第二方面的第 二种可能的实现方式; 或第二方面的第三种可能的实现方式; 或第二方面 的第四种可能的实现方式; 或第二方面的第五种可能的实现方式; 或第二 方面的第六种可能的实现方式; 或第二方面的第七种可能的实现方式; 或 第二方面的第八种可能的实现方式; 或第二方面的第九种可能的实现方式; 或第二方面的第十种可能的实现方式; 或第二方面的第十一种可能的实现 方式; 或第二方面的第十二种可能的实现方式; 或第二方面的第十三种可 能的实现方式; 或第二方面的第十四种可能的实现方式; 或第二方面的第 十五种可能的实现方式; 或第二方面的第十六种可能的实现方式; 或第二 方面的第十七种可能的实现方式; 或第二方面的第十八种可能的实现方式; 或第二方面的第十九种可能的实现方式; 或第二方面的第二十种可能的实 现方式; 或本发明的第三方面; 或第三方面的第一种可能的实现方式; 或 第三方面的第二种可能的实现方式; 或第三方面的第三种可能的实现方式; 或第三方面的第四种可能的实现方式; 或第三方面的第五种可能的实现方 式; 或第三方面的第六种可能的实现方式; 或第三方面的第七种可能的实 现方式; 或第三方面的第八种可能的实现方式; 或第三方面的第九种可能 的实现方式; 或第三方面的第十种可能的实现方式; 或第三方面的第十一 种可能的实现方式; 或第三方面的第十二种可能的实现方式; 或第三方面 的第十三种可能的实现方式; 或第三方面的第十四种可能的实现方式; 或 第三方面的第十五种可能的实现方式; 或第三方面的第十六种可能的实现 方式; 或第三方面的第十七种可能的实现方式; 或第三方面的第十八种可 能的实现方式; 或第三方面的第十九种可能的实现方式; 或第三方面的第 二十种可能的实现方式所述的方法。
根据本发明的第五方面, 一种计算机可读存储介质, 所述计算机存储 计算机程序代码, 当所述计算机程序代码被一个计算机执行的时候, 所述 计算机程序代码可以使得所述计算机执行结合本发明的第一方面; 或第一 方面的第一种可能的实现方式; 或第一方面的第二种可能的实现方式; 或 第一方面的第三种可能的实现方式; 或第一方面的第四种可能的实现方式; 或第一方面的第五种可能的实现方式; 或第一方面的第六种可能的实现方 式; 或第一方面的第七种可能的实现方式; 或第一方面的第八种可能的实 现方式; 或第一方面的第九种可能的实现方式; 或第一方面的第十种可能 的实现方式; 或第一方面的第十一种可能的实现方式; 或第一方面的第十 二种可能的实现方式; 或第一方面的第十三种可能的实现方式; 或第一方 面的第十四种可能的实现方式; 或第一方面的第十五种可能的实现方式; 或第一方面的第十六种可能的实现方式; 或第一方面的第十七种可能的实 现方式; 或第一方面的第十八种可能的实现方式; 或第一方面的第十九种 可能的实现方式; 或第一方面的第二十种可能的实现方式; 或本发明的第 二方面; 或第二方面的第一种可能的实现方式; 或第二方面的第二种可能 的实现方式; 或第二方面的第三种可能的实现方式; 或第二方面的第四种 可能的实现方式; 或第二方面的第五种可能的实现方式; 或第二方面的第 六种可能的实现方式; 或第二方面的第七种可能的实现方式; 或第二方面 的第八种可能的实现方式; 或第二方面的第九种可能的实现方式; 或第二 方面的第十种可能的实现方式; 或第二方面的第十一种可能的实现方式; 或第二方面的第十二种可能的实现方式; 或第二方面的第十三种可能的实 现方式; 或第二方面的第十四种可能的实现方式; 或第二方面的第十五种 可能的实现方式; 或第二方面的第十六种可能的实现方式; 或第二方面的 第十七种可能的实现方式; 或第二方面的第十八种可能的实现方式; 或第 二方面的第十九种可能的实现方式; 或第二方面的第二十种可能的实现方 式; 或本发明的第三方面; 或第三方面的第一种可能的实现方式; 或第三 方面的第二种可能的实现方式; 或第三方面的第三种可能的实现方式; 或 第三方面的第四种可能的实现方式; 或第三方面的第五种可能的实现方式; 或第三方面的第六种可能的实现方式; 或第三方面的第七种可能的实现方 式; 或第三方面的第八种可能的实现方式; 或第三方面的第九种可能的实 现方式; 或第三方面的第十种可能的实现方式; 或第三方面的第十一种可 能的实现方式; 或第三方面的第十二种可能的实现方式; 或第三方面的第 十三种可能的实现方式; 或第三方面的第十四种可能的实现方式; 或第三 方面的第十五种可能的实现方式; 或第三方面的第十六种可能的实现方式; 或第三方面的第十七种可能的实现方式; 或第三方面的第十八种可能的实 现方式; 或第三方面的第十九种可能的实现方式; 或第三方面的第二十种 可能的实现方式所述的方法。
根据本发明的第六方面, 一种计算机程序产品, 所述计算机程序产品 包括计算机程序代码, 当所述计算机程序代码被一个计算机执行的时候, 所述计算机程序代码可以使得所述计算机执行结合本发明的第一方面; 或 第一方面的第一种可能的实现方式; 或第一方面的第二种可能的实现方式; 或第一方面的第三种可能的实现方式; 或第一方面的第四种可能的实现方 式; 或第一方面的第五种可能的实现方式; 或第一方面的第六种可能的实 现方式; 或第一方面的第七种可能的实现方式; 或第一方面的第八种可能 的实现方式; 或第一方面的第九种可能的实现方式; 或第一方面的第十种 可能的实现方式; 或第一方面的第十一种可能的实现方式; 或第一方面的 第十二种可能的实现方式; 或第一方面的第十三种可能的实现方式; 或第 一方面的第十四种可能的实现方式; 或第一方面的第十五种可能的实现方 式; 或第一方面的第十六种可能的实现方式; 或第一方面的第十七种可能 的实现方式; 或第一方面的第十八种可能的实现方式; 或第一方面的第十 九种可能的实现方式; 或第一方面的第二十种可能的实现方式; 或本发明 的第二方面; 或第二方面的第一种可能的实现方式; 或第二方面的第二种 可能的实现方式; 或第二方面的第三种可能的实现方式; 或第二方面的第 四种可能的实现方式; 或第二方面的第五种可能的实现方式; 或第二方面 的第六种可能的实现方式; 或第二方面的第七种可能的实现方式; 或第二 方面的第八种可能的实现方式; 或第二方面的第九种可能的实现方式; 或 第二方面的第十种可能的实现方式; 或第二方面的第十一种可能的实现方 式; 或第二方面的第十二种可能的实现方式; 或第二方面的第十三种可能 的实现方式; 或第二方面的第十四种可能的实现方式; 或第二方面的第十 五种可能的实现方式; 或第二方面的第十六种可能的实现方式; 或第二方 面的第十七种可能的实现方式; 或第二方面的第十八种可能的实现方式; 或第二方面的第十九种可能的实现方式; 或第二方面的第二十种可能的实 现方式; 或本发明的第三方面; 或第三方面的第一种可能的实现方式; 或 第三方面的第二种可能的实现方式; 或第三方面的第三种可能的实现方式; 或第三方面的第四种可能的实现方式; 或第三方面的第五种可能的实现方 式; 或第三方面的第六种可能的实现方式; 或第三方面的第七种可能的实 现方式; 或第三方面的第八种可能的实现方式; 或第三方面的第九种可能 的实现方式; 或第三方面的第十种可能的实现方式; 或第三方面的第十一 种可能的实现方式; 或第三方面的第十二种可能的实现方式; 或第三方面 的第十三种可能的实现方式; 或第三方面的第十四种可能的实现方式; 或 第三方面的第十五种可能的实现方式; 或第三方面的第十六种可能的实现 方式; 或第三方面的第十七种可能的实现方式; 或第三方面的第十八种可 能的实现方式; 或第三方面的第十九种可能的实现方式; 或第三方面的第 二十种可能的实现方式所述的方法。
从上述方案可以看出, 本发明实施例提供的控制中央处理器的方法和 装置, 当 CPU占用率大于占用率阔值后, 进一步判断工作频率是否小于第 一频率。 当工作频率小于第一频率时, 确认工作频率为小于所述 CPU的最 高频率的第一频率。 这种调节频率的方式不是一次性将 CPU频率调整为最 高频率,故而能减少在频率调整中,当 CPU占用率大于占用率阔值时的 CPU 电量消耗。 附图说明
为了更清楚地说明本发明实施例或现有技术中的技术方案, 下面将对 实施例或现有技术描述中所需要使用的附图作简单地介绍。
图 1是本发明第一实施例中控制 CPU的方法的概要流程图; 图 2是本发明第二实施例中控制 CPU的方法的详细流程图; 图 3是本发明第三实施例中控制 CPU的方法的另一详细流程图; 图 4是本发明第四实施例中电流 -频率曲线示意图;
图 5是本发明第五实施例中终端的结构示意图;
图 6是本发明第六实施例中手机的部分结构的框图;
图 7是本发明第七实施例中装置的概要结构示意图;
图 8A是本发明第八实施例中装置的第一详细结构示意图;
图 8B是本发明第八实施例中装置的第二详细结构示意图;
图 8C是本发明第八实施例中装置中定时器的结构示意图。 具体实施方式
为确认本发明的目的、 技术方案和优点更加清楚, 下面结合附图对本 发明实施例作进一步的详细描述。
本发明的第一实施例提供一种控制 CPU的方法, 如图 1的概要流程图 所示, 包括如下步骤:
步骤 1 01 , 获取工作的 CPU的占用率和工作频率。
步骤 1 02 , 当所述占用率大于占用率阔值时, 判断所述工作频率是否小 于第一频率。 占用率阔值根据不同的平台可取不同值, 该值的取值范围可 以在 90%到 95%之间。 这里的不同的平台是指不同的硬件芯片组。
步骤 1 03 , 当所述工作频率小于第一频率时, 确认所述工作频率为第一 频率。这里所说的 "确定…为第一频率",是指如果工作频率不是第一频率, 改变工作频率为第一频率。 如果工作频率为第一频率, 使工作频率保持为 第一频率。
其中, 所述第一频率小于所述 CPU的最高频率。
本发明实施例提供的控制中央处理器的方法, 当 CPU 占用率大于占用 率阔值后, 进一步判断工作频率是否小于第一频率。 当工作频率小于第一 频率时, 确认工作频率为小于所述 CPU 的最高频率的第一频率。 这种调节 频率的方式不是一次性将 CPU频率调整为最高频率, 故而能减少 CPU在频 率调整中的电量消耗。 本发明的第二实施例提供一种控制 CPU的方法, 由负责调度的 CPU执 行。 即执行该方法的 CPU可调度其他普通的执行指令和运算的 CPU。 该负责 调度的 CPU可以是除其他普通执行指令和运算的 CPU以外独立的 CPU ,也可 将调度功能集成在某个普通执行指令和运算的 CPU 中。 该负责调度的 CPU (后文简称为 "调度 CPU " ) 的硬件形式可以是高级精简指令集计算机 ( Advanced Reduced Ins truct ion Set Comput ing ( RISC ) Machines , ARM ) 芯片, 也可以是单片机等其他芯片。 如图 2的详细流程图所示, 包括 如下步骤:
步骤 201 , 获取当前工作的 CPU的占用率和工作频率。 CPU的占用率值 和工作频率值可以分别通过检测获得。
步骤 202 , 判断 CPU的占用率是否大于占用率阔值。 如果大于, 进入步 骤 204。 否则, 进入步骤 203。
步骤 203 , 如果 CPU的占用率小于或等于占用率阔值, 则获取占用率与 工作频率的乘积, 确认所述工作频率为与所述乘积最接近的频率值, 并清 零循环保持计数值。
由于工作频率是逐个离散的值, 有可能该乘积和逐个离散的值并不重 合, 因此有可能需要将工作频率设置为与乘积最接近的频率值。 当然, 如 果该乘积和逐个离散的值重合, 则可将工作频率设置为与乘积对应的频率 值。 此处的 "确定" 是指, 如果该乘积和逐个离散的值并不重合, 则将工 作频率设置为与乘积最接近的频率值; 如果该乘积和逐个离散的值重合, 则将工作频率设置为与乘积对应的频率值。 本文其他处 "确定" 含义参考 此处类推解释, 其他处不再另外解释。
另外, 该循环保持计数值的作用是和循环保持计数阈值比较, 如果小 于该循环保持计数阔值, 则在原计数基础上继续计数。 一旦循环保持计数 值大于或等于循环保持计数阔值, 则调整现有频率到比现有频率更高的频 率。
步骤 204 , 如果 CPU的占用率大于占用率阔值, 则继续判断 CPU工作频 率是否小于第一频率。如果工作频率小于第一频率,则进入步骤 205。否则, 进入步骤 206。
步骤 205 ,当工作频率小于第一频率时,确认所述工作频率为第一频率。 进一步的, 还可清零循环保持计数值。 步骤 206 , 当工作频率大于或等于第一频率时, 继续判断 CPU工作频率 是否小于或等于第二频率。 其中, 第二频率大于或等于第一频率, 且小于 最高频率。 如果工作频率小于或等于第二频率, 则进入步骤 207。 否则, 进 入步骤 209。
步骤 207 , 当工作频率小于或等于第二频率时, 继续判断循环保持计数 值是否小于循环保持计数阈值。 如果循环保持计数值小于循环保持计数阔 值, 进入步骤 208。 否则, 进入步骤 209。
步骤 208 , 当循环保持计数值小于循环保持计数阔值时, 确认所述工作 频率为第二频率。 进一步的, 循环保持计数值可加一。
步骤 209 , 当循环保持计数值大于或等于循环保持计数阔值, 或者 CPU 工作频率大于第二频率时, 确认所述工作频率为第三频率, 该第三频率大 于所述第二频率。 第三频率, 可以是 CPU 的最高频率, 或是大于第二频率 且小于最高频率的频率。
本发明实施例提供的控制中央处理器的方法, 通过设置比第一频率高 的第二频率, 和比第二频率高的第三频率, 实现频率级别的更细划分, 适 用于具备工作频率较高(如最高频率可达 1. 5GHz (千兆赫兹))的 CPU硬件 芯片组。 从而当 CPU频率较高, 保障用户体验和 CPU性能的同时, 不是一 次性调高频率到最大频率, 而是分段调节频率, 故可进一步节省 CPU 的功 率消耗。 本发明的第三实施例提供一种控制 CPU的方法, 由负责调度的 CPU执 行。 如图 3的详细流程图所示, 包括如下步骤:
步骤 301 , 获取当前工作的 CPU的占用率和工作频率。 CPU的占用率值 和工作频率值可以分别通过检测获得。
步骤 302 , 判断 CPU的占用率是否大于占用率阔值。 如果 CPU的占用率 大于占用率阔值, 则进入步骤 304。 否则, 进入步骤 303。 步骤 303 , 当 CPU的占用率小于或等于占用率阔值时, 获取占用率与工 作频率的乘积, 确认所述工作频率为与所述乘积最接近的频率值, 并清零 循环保持计数值。
由于工作频率是逐个离散的值, 有可能该乘积和逐个离散的值并不重 合, 因此有可能需要将工作频率设置为与乘积最接近的频率值。 当然, 如 果该乘积和逐个离散的值重合, 则可将工作频率设置为与乘积对应的频率 值。
另外, 该循环保持计数值的作用是和循环保持计数阈值比较, 如果小 于该循环保持计数阔值, 则在原计数基础上继续计数。 一旦循环保持计数 值大于或等于循环保持计数阔值, 则调整现有频率到比现有频率更高的频 率。
步骤 304 , 判断工作频率是否小于第一频率。 如果工作频率小于第一频 率, 则进入步骤 305。 否则, 进入步骤 307。 其中, 第一频率小于最高频率。
步骤 305 , 当工作频率小于第一频率时, 判断循环保持计数值是否小于 循环保持计数阈值。 如果循环保持计数值小于循环保持计数阈值, 进入步 骤 306。 否则, 进入步骤 307。
步骤 306 , 当循环保持计数值小于循环保持计数阔值时, 确认工作频率 为第一频率, 还可进一步将循环保持计数值加一。
步骤 307 , 当循环保持计数值大于或等于循环保持计数阔值, 或工作频 率大于或等于第一频率时, 确认 CPU的工作频率为最高频率。
本发明实施例提供的控制中央处理器的方法, 通过设置比最高频率低 的第一频率, 实现频率的分级, 该实施例的方法可适用于具备工作频率中 等(如最高频率可达 1GHz ) 的 CPU硬件芯片组。 从而当 CPU频率较高, 保 障用户体验和 CPU性能的同时, 不是一次性调高频率到最大频率, 而是分 段调节频率(例如先调节到第一频率), 故可进一步节省 CPU的功率消耗。
此外, 本发明实施例提供的控制中央处理器的方法, 还可应用在具备 更细的频率分级的 CPU硬件芯片组中。 如在该 CPU硬件芯片组中, 工作频 率可以到达 2GHz。 此时可设置小于最高频率的第一频率, 第二频率, 第三 频率, 甚至第四频率。 例如, 该第三频率可以设置在第二实施例中的第一 频率和第二频率的中值频率处, 该第四频率可以设置在第二实施例中的第 二频率和最高频率的中值频率处。 当然, 也可以在第一频率和最高频率之 间做频率间隔的三等分,五等分,甚至 N等分。 N为大于或等于二的正整数。 在上述本实施例在第一实施例, 第二实施例或第三实施例的基础上, 可新增定时功能。 即每当定时器的计时到达时, 执行上述实施例一, 第二 实施例或第三实施例的方法。
一种控制定时器的方式包括:
当系统空闲时, 所述定时器停止计时。
进一步的, 该方法还可以包括, 当系统退出空闲时, 所述定时器启动 计时。
其中, 系统空闲与否, 由执行该实施例方法的调度 CPU 所在设备的操 作系统通知该负责调度的 CPU。
在上述基础上, 另一种控制定时器的方式包括:
如果在所述定时器连续计时时刻到达时, 获取的所述定时器对应的工 作频率均为频率最大值, 且所述工作频率均为频率最大值的次数刚大于最 高频率持续周期次数阔值, 则所述定时器停止计时。
具体的, 最高频率持续周期次数阔值的定义可以为:
(开启 CPU功耗敏感因子阔值 X开核釆样空间) I (占用率阔值 X频率 权重), 其中, 所述频率权重为所述第一权重, 取值可为 4。 开启 CPU功耗 敏感因子阔值可以设为 200。 开核釆样空间为大于或等于一的整数, 如可以 取值为 1 0。
工作频率均为频率最大值的次数刚大于最高频率持续周期次数阔值可 以为: 所述工作频率均为频率最大值的次数为最高频率持续周期次数阔值 力口一。
例如, 如果连续 5 次计时时刻到达时, 获取的所述定时器对应的工作 频率均为频率最大值, 并且最高频率持续周期次数阔值为 4 , 则所述定时器 停止计时。 本发明的第四实施例提供一种控制 CPU 的方法, 该实施例在上述第一 实施例, 第二实施例, 或第三实施例的基础上, 说明各种小于最高频率的 频率是如何产生的。 如图 4 所示, 为实测的某个普通的执行指令和运算的 CPU的电流 -频率曲线示意图。 图 4中, 横坐标为频率, 单位是 MHz (兆赫 兹), 从左到右, 频率依次升高。 纵坐标是普通 CPU的电流消耗, 从下到上, 电流消耗依次升高。 其中, 横坐标的频率是离散的, 即普通 CPU工作在离 散的频率点上。 图 4 中间的各个菱形的黑点是实测的测量点, 在工作在特 定频率点时的电流消耗。 根据各个测量点, 可以大致画出一条体现电流和 频率的关系的曲线, 如图 4 的黑色实线所示。 该黑色实线并不是一条有固 定斜率的直线, 而是由有两条具备固定斜率的直线相连而形成。 可以看出, 该黑色实线中, 频率比功耗拐点频率小的测量点 (即曲线中, 功耗拐点频 率对应的测量点的左边的测量点)连接成的直线的斜率(可称为第一斜率 ), 比频率比功耗拐点频率大的测量点 (即曲线中, 功耗拐点频率对应的测量 点的右边的测量点)连接成的直线的斜率(可称为第二斜率),要小。 图中, 功耗拐点频率对应具体数值 918MHz , 该值大致位于最高频率 1512MHz和最 低频率 384MHz的中间, 处于该大致中间的频率可保证用户体验和系统的运 行性能。 当然, 该值在不同的平台也可以取其他值, 如 702MHz , 81 0MHz , 或 1 026MHz。 而此时功耗拐点频率对应消耗的电流又相对较低(对应 150mA 的电流消耗), 因此可以将功耗拐点频率设为普通 CPU工作时的最佳工作频 率点。 上述第一实施例, 第二实施例, 或第三实施例中, 可以将第一频率 设置为功耗拐点频率。
考虑到当普通 CPU频率高于功耗拐点频率后,可进一步节省该普通 CPU 的功耗, 因此可进一步在功耗拐点频率和最高频率之间设置其他频率, 使 得当普通 CPU频率高于功耗拐点频率后, 不是一次性将普通 CPU的工作频 率调节为最高频率。 如如图 4 所示, 可在功耗拐点频率和最高频率的中点 设置功耗中值频率。 当普通 CPU 的工作频率高于功耗拐点频率后, 可将该 普通 CPU的工作频率调整到功耗中值频率, 而不是一次性调整到最高频率, 从而节省普通 CPU的功率消耗。 该功耗中值频率可设置为第二频率。
当某普通 CPU的最高频率可到达更高频率(如 2GHz ) 时, 还可进一步 在功耗拐点频率和功耗中值频率之间设置一个第三频率, 和 /或, 在功耗中 值频率和最高频率之间设置一个第四频率。 这样, 通过更多的频率的分级, 可实现不同层级的频率调整, 从而在工作频率向更高频率调整的过程中, 根据情况依次调整到相应的适配频率, 而不是一次调整到最高频率或比适 配频率更高的频率, 从而节省该普通 CPU的功率消耗。 本发明第五实施例提供一种终端, 如图 5所示。 上述终端 501 包括处 理器 501 1。 处理器 501 1可以是负责调度的 CPU , 其作用是负责调度和控制 一个或多个普通 CPU。
该处理器 501 1用于: 获取工作的 CPU的占用率和工作频率; 当所述占 用率大于占用率阔值, 判断所述工作频率是否小于第一频率; 当所述工作 频率小于第一频率时, 确认所述工作频率为第一频率。
其中, 第一频率小于所述 CPU的最高频率。 占用率阔值根据不同的平台可取不同值, 该值的取值范围可以在 90% 到 95%之间。 这里的不同的平台是指不同的硬件芯片组。
在第一种实施方式中, 处理器可包括如下功能: 进一步, 处理器还可用于: 当工作频率大于或等于第一频率时, 判断 所述工作频率是否小于或等于第二频率, 第二频率大于所述第一频率且小 于所述最高频率; 当所述工作频率小于或等于所述第二频率时, 确认所述 工作频率为第二频率。
处理器当所述工作频率小于或等于所述第二频率时, 确认所述工作频 率为第二频率, 具体可包括:
当所述工作频率小于或等于所述第二频率, 且循环保持计数值小于循 环保持计数阔值时, 确认所述工作频率为第二频率。 该循环保持计数值的 作用是和循环保持计数阈值比较, 如果小于该循环保持计数阈值, 则在原 计数基础上继续计数。 一旦循环保持计数值大于或等于循环保持计数阔值, 则调整现有频率到比现有频率更高的频率。 进一步的, 处理器还可用于: 将所述循环保持计数值加一。
进一步的, 处理器还可用于: 当所述工作频率大于所述第二频率时, 确认所述工作频率为第三频率, 所述第三频率等于所述最高频率。
进一步的, 处理器还可用于: 当所述循环保持计数值大于或等于所述 循环保持计数阔值时, 确认所述工作频率为所述最高频率。
进一步的, 处理器还可用于: 当所述占用率大于所述占用率阔值, 且 所述工作频率小于或等于所述第一频率时, 清零所述循环保持计数值。
进一步的, 处理器还可用于: 当所述占用率小于或等于所述占用率阔 值时, 获取所述占用率与所述工作频率的乘积, 确认所述工作频率为与所 述乘积最接近的频率值, 并清零所述循环保持计数值。
在第二种实施方式中, 处理器可包括如下功能:
处理器还可用于: 当所述工作频率大于或等于第一频率时, 确认所述 工作频率为最高频率。
处理器当所述工作频率小于第一频率时, 确认所述工作频率为第一频 率, 具体可为: 当所述工作频率小于第一频率, 且循环保持计数值小于循 环保持计数阔值时, 确认所述工作频率为第一频率。 进一步, 处理器还可 用于: 将所述循环保持计数值加一。
处理器还可用于: 当所述循环保持计数值大于或等于所述循环保持计 数阔值时, 确认所述工作频率为所述最高频率。
处理器还可用于: 当所述占用率小于或等于所述占用率阔值时, 获取 所述占用率与所述工作频率的乘积, 确认所述工作频率为与所述乘积最接 近的频率值, 并清零所述循环保持计数值。
进一步的, 以下处理器的功能适用于上述第一种实施方式和第二种实 施方式:
处理器还用于, 在所述 CPU对应的定时器的计时时刻到达时, 执行上 述各实施方式中处理器的功能。
进一步的, 处理器还可用于: 当系统空闲时, 所述定时器停止计时。 进一步的, 处理器还可用于: 当系统退出空闲时, 所述定时器启动计 时。 其中, 系统空闲与否, 由执行该实施例方法的调度 CPU所在设备的操 作系统通知该负责调度的 CPU。
进一步的, 处理器还可用于: 如果在所述定时器连续计时时刻到达时, 获取的所述定时器对应的工作频率均为频率最大值, 且所述工作频率均为 频率最大值的次数刚大于最高频率持续周期次数阔值, 则所述定时器停止 计时。
具体的, 最高频率持续周期次数阔值的定义可以为: (开启 CPU功耗 敏感因子阔值 X开核釆样空间) / (占用率阔值 X频率权重), 其中, 所述 频率权重为所述第一权重,取值可为 4。 开启 CPU功耗敏感因子阔值可以设 为 200。 开核釆样空间为大于或等于一的整数, 如可以取值为 1 0。
工作频率均为频率最大值的次数刚大于最高频率持续周期次数阔值 为: 所述工作频率均为频率最大值的次数为最高频率持续周期次数阔值加 例如, 如果连续 5次计时时刻到达时, 获取的所述定时器对应的工作 频率均为频率最大值, 并且最高频率持续周期次数阔值为 4, 则所述定时器 停止计时。
其中, 第一频率可以为电流-频率曲线中的拐点对应的频率。
在图 4所示的电流-频率曲线中, 第一斜率小于第二斜率;
所述第一斜率为比所述拐点对应的频率低的测量点形成的直线的斜 率; 所述第二斜率为比所述拐点对应的频率高的测量点形成的直线的斜率。
所述第二频率为所述第一频率和所述最高频率的平均值。
具体各种小于最高频率的中间频率的确定, 可进一步参考图 4和本发 明的第四实施例的介绍, 此处不再赘述。
本发明第五实施例提供的终端,通过设置的比最高频率低的第一频率, 或进一步包括第二频率等, 实现频率的分级。 该实施例的终端可适用于具 备工作频率中等 (如最高频率可达 1GHz) 的 CPU硬件芯片组, 或具备工作 频率较高(如最高频率可达 1.5GHz (千兆赫兹))的 CPU硬件芯片组。 从而 当 CPU频率较高, 保障用户体验和 CPU性能的同时, 不是一次性调高频率 到最大频率, 而是分段调节频率(例如先调节到第一频率或第二频率), 故 可进一步节省 CPU的功率消耗。 本发明第六实施例还提供一种手机, 手机为本发明第五实施例提供的 终端的具体形式。进一步的 ,终端还可包括平板电脑、 PDA( Personal Digital Assistant, 个人数字助理)、 POS (Point of Sales, 销售终端)、 车载电 脑等。 本文对终端类型不作限定, 只要不属于局端设备均可认为是本文所 指的终端。图 6为手机的部分结构的框图。参考图 6,手机 100包括、 RF( Radio Frequency, 射频) 电路 110、 存储器 120、 输入单元 130、 显示单元 140、 传 感器 150、 音频电路 160、 WiFi (wireless fidelity, 无线保真)模块 170、 处理器 180、 以及电源 190等部件。 本领域技术人员可以理解, 图 6中示出的 手机结构并不构成对手机的限定, 可以包括比图示更多或更少的部件, 或 者组合某些部件, 或者不同的部件布置。
下面结合图 6对手机 100的各个构成部件进行具体的介绍:
RF电路 110可用于收发信息或通话过程中, 信号的接收和发送, 特别 地, 将基站的下行信息接收后, 给处理器 180处理; 另外, 将设计上行的数 据发送给基站。 通常, RF电路包括但不限于天线、 至少一个放大器、 收发 信机、 耦合器、 LNA (Low Noise Amplifier, 低噪声放大器)、 双工器等。 此外, RF电路 110还可以通过无线通信与网络和其他设备通信。 所述无线通 信可以使用任一通信标准或协议, 包括但不限于 GSM (Global System of Mobile communication, 全球移动通讯系统)、 GPRS (General Packet Radio Service, 通用分组无线月良务)、 CDMA (Code Division Multiple Access, 码分多址)、 WCDMA (Wideband Code Division Multiple Access, 宽带码分 多址)、 LTE (Long Term Evolut ion,长期演进)、 电子邮件、 SMS (Short Messaging Service, 短消息服务)等。
存储器 120可用于存储软件程序以及模块, 处理器 180通过运行存储在 存储器 120的软件程序以及模块, 从而执行手机 100的各种功能应用以及数 据处理。 存储器 120可主要包括存储程序区和存储数据区, 其中, 存储程序 区可存储操作系统、 至少一个功能所需的应用程序 (比如声音播放功能、 图象播放功能等)等; 存储数据区可存储根据手机 100的使用所创建的数据 (比如音频数据、 电话本等)等。 此外, 存储器 120可以包括高速随机存取 存储器, 还可以包括非易失性存储器, 例如至少一个磁盘存储器件、 闪存 器件、 或其他易失性固态存储器件。
输入单元 130可用于接收输入的数字或字符信息, 以及产生与手机 100 的用户设置以及功能控制有关的键信号输入。 具体地, 输入单元 130可包括 触控面板 131以及其他输入设备 132。 触控面板 131, 也称为触摸屏, 可收集 用户在其上或附近的触摸操作 (比如用户使用手指、 触笔等任何适合的物 体或附件在触控面板 131上或在触控面板 131附近的操作 ), 并根据预先设定 的程式驱动相应的连接装置。 可选的, 触控面板 131可包括触摸检测装置和 触摸控制器两个部分。 其中, 触摸检测装置检测用户的触摸方位, 并检测 触摸操作带来的信号, 将信号传送给触摸控制器; 触摸控制器从触摸检测 装置上接收触摸信息, 并将它转换成触点坐标, 再送给处理器 180, 并能接 收处理器 180发来的命令并加以执行。 此外, 可以釆用电阻式、 电容式、 红 外线以及表面声波等多种类型实现触控面板 131。 除了触控面板 131 , 输入 单元 130还可以包括其他输入设备 132。 具体地, 其他输入设备 132可以包括 但不限于物理键盘、 功能键(比如音量控制按键、 开关按键等)、 轨迹球、 鼠标、 操作杆等中的一种或多种。
显示单元 140可用于显示由用户输入的信息或提供给用户的信息以及 手机 100的各种菜单。 显示单元 140可包括显示面板 141 , 可选的, 可以釆用 LCD (Liquid Crys ta l Di s play,液晶显示器)、 OLED (Organic Light-Emi t t ing Diode,有机发光二极管)等形式来配置显示面板 141。 进一步的, 触控面板 131可覆盖显示面板 141 , 当触控面板 131检测到在其上或附近的触摸操作 后, 传送给处理器 180以确定触摸事件的类型, 随后处理器 180根据触摸事 件的类型在显示面板 141上提供相应的视觉输出。 虽然在图 6中, 触控面板 131与显示面板 141是作为两个独立的部件来实现手机 100的输入和输入功 能, 但是在某些实施例中, 可以将触控面板 131与显示面板 141集成而实现 手机 100的输入和输出功能。
手机 100还可包括至少一种传感器 150 , 比如光传感器、 运动传感器以 及其他传感器。 具体地, 光传感器可包括环境光传感器及接近传感器, 其 中, 环境光传感器可根据环境光线的明暗来调节显示面板 141的亮度, 接近 传感器可在手机 100移动到耳边时, 关闭显示面板 141和 /或背光。 作为运动 传感器的一种, 加速计传感器可检测各个方向上 (一般为三轴)加速度的 大小,静止时可检测出重力的大小及方向,可用于识别手机姿态的应用(比 如横竖屏切换、 相关游戏、 磁力计姿态校准)、 振动识别相关功能(比如计 步器、 敲击)等; 至于手机 100还可配置的陀螺仪、 气压计、 湿度计、 温度 计、 红外线传感器等其他传感器, 在此不再赘述。
音频电路 160、 扬声器 161 , 麦克风 162可提供用户与手机 100之间的音 频接口。 音频电路 160可将接收到的音频数据转换后的电信号, 传输到扬声 器 161 , 由扬声器 161转换为声音信号输出; 另一方面, 麦克风 162将收集的 声音信号转换为电信号, 由音频电路 160接收后转换为音频数据, 再将音频 数据输出至 RF电路 108以发送给比如另一手机, 或者将音频数据输出至存储 器 120以便进一步处理。
WiF i属于短距离无线传输技术, 手机 100通过 WiF i模块 170可以帮助用 户收发电子邮件、 浏览网页和访问流式媒体等, 它为用户提供了无线的宽 带互联网访问。 虽然图 1示出了 WiFi模块 170, 但是可以理解的是, 其并不 属于手机 100的必须构成, 完全可以根据需要在不改变发明的本质的范围内 而省略。
处理器 180是手机 100的控制中心, 利用各种接口和线路连接整个手机 的各个部分, 通过运行或执行存储在存储器 120内的软件程序和 /或模块, 以及调用存储在存储器 120内的数据, 执行手机 100的各种功能和处理数据, 从而对手机进行整体监控。 优选的, 处理器 180可集成应用处理器和调制解 调处理器, 其中, 应用处理器主要处理操作系统、 用户界面和应用程序等, 调制解调处理器主要处理无线通信。 可以理解的是, 上述调制解调处理器 也可以不集成到处理器 180中。
可选的, 处理器 180可包括一个或多个处理单元。 一个或多个处理单元 中可包括一个独立的调度 CPU和一个或多个普通 CPU。 所述调度 CPU可调度普 通 CPU。 该调度 CPU的硬件形式可以是高级精简指令集计算机 ( Advanced Reduced Ins truc t ion Set Comput ing ( RISC ) Machines , ARM ) 芯片, 也可以是单片机等其他芯片。 普通 CPU即普通执行指令和运算的 CPU。 可以 理解的, 该调度 CPU的功能也可集成在某个或某几个普通 CPU中, 本实施例 不做限制。 该调度 CPU的功能具体可参考前述的第一至第五实施例, 此处不 再赘述。
手机 1 00还包括给各个部件供电的电源 190 (比如电池 ), 优选的, 电源 可以通过电源管理系统与处理器 180逻辑相连, 从而通过电源管理系统实现 管理充电、 放电、 以及功耗等功能。
尽管未示出, 手机 1 00 还可以包括摄像头、 蓝牙模块等, 在此不再赘 述。 本发明第七实施例还提供一种装置, 如图 7所示, 该装置 701 包括: 第一单元 701 1 , 获取工作的 CPU的占用率和工作频率; 第二单元 7012 , 当 所述占用率大于占用率阔值, 判断所述工作频率是否小于第一频率; 第三 单元 701 3 , 当所述工作频率小于第一频率时, 确认所述工作频率为第一频 率。
其中, 所述第一频率小于所述 CPU的最高频率。 占用率阔值根据不同 的平台可取不同值, 该值的取值范围可以在 90%到 95%之间。 这里的不同的 平台是指不同的硬件芯片组。
本发明实施例提供的装置, 当 CPU 占用率大于占用率阔值后, 进一步 判断工作频率是否小于第一频率。 当工作频率小于第一频率时, 确认工作 频率为小于所述 CPU 的最高频率的第一频率。 这种调节频率的方式不是一 次性将 CPU频率调整为最高频率, 故而能减少 CPU在频率调整中的电量消 耗。 本发明第八实施例还提供一种装置, 如图 8A所示, 该装置在上述本发 明第七实施例的基础上, 还包括:
第四单元, 用于当所述工作频率大于或等于第一频率时, 判断所述工 作频率是否小于或等于第二频率, 所述第二频率大于所述第一频率且小于 所述最高频率。
第五单元, 用于当所述工作频率小于或等于所述第二频率时, 确认所 述工作频率为第二频率。 第五单元具体还可用于: 当所述工作频率小于或 等于所述第二频率, 且循环保持计数值小于循环保持计数阈值时, 确认所 述工作频率为第二频率。
进一步的, 该装置还可包括: 第六单元, 用于将所述循环保持计数值 力口一。
进一步的, 该装置还可包括: 第七单元, 用于当所述工作频率大于所 述第二频率时, 确认所述工作频率为第三频率, 所述第三频率等于所述最 高频率。
进一步的, 该装置还可包括: 第八单元, 用于当所述循环保持计数值 大于或等于所述循环保持计数阔值时, 确认所述工作频率为所述最高频率。
进一步的, 该装置还可包括: 第九单元, 用于当所述占用率大于所述 占用率阔值, 且所述工作频率小于或等于所述第一频率时, 清零所述循环 保持计数值。
进一步的, 该装置还可包括: 第十单元, 用于当所述占用率小于或等 于所述占用率阔值时, 获取所述占用率与所述工作频率的乘积, 确认所述 工作频率为与所述乘积最接近的频率值, 并清零所述循环保持计数值。
本发明实施例提供的装置, 通过设置比第一频率高的第二频率, 和比 第二频率高的第三频率, 实现频率级别的更细划分, 适用于具备工作频率 较高 (如最高频率可达 1. 5GHz (千兆赫兹)) 的 CPU硬件芯片组。 从而当 CPU频率较高, 保障用户体验和 CPU性能的同时, 不是一次性调高频率到最 大频率, 而是分段调节频率, 故可进一步节省 CPU的功率消耗。 本发明第八实施例还提供一种装置, 如图 8B所示, 该装置在上述本发 明第七实施例的基础上, 还包括:
第十一单元, 用于当所述工作频率大于或等于第一频率时, 确认所述 工作频率为最高频率。
进一步的, 第三单元具体可用于: 当所述工作频率小于第一频率, 且 循环保持计数值小于循环保持计数阔值时, 确认所述工作频率为第一频率。
进一步的, 该装置还可包括: 第十二单元, 用于将所述循环保持计数 值加一。
进一步的, 该装置还可包括: 第十三单元, 用于当所述循环保持计数 值大于或等于所述循环保持计数阔值时, 确认所述工作频率为所述最高频 率。
进一步的, 该装置还可包括: 第十四单元, 用于当所述占用率小于或 等于所述占用率阔值时, 获取所述占用率与所述工作频率的乘积, 确认所 述工作频率为与所述乘积最接近的频率值, 并清零所述循环保持计数值。
本发明实施例提供的控制中央处理器的方法, 通过设置比最高频率低 的第一频率, 实现频率的分级, 该实施例的方法可适用于具备工作频率中 等(如最高频率可达 1 GHz ) 的 CPU硬件芯片组。 从而当 CPU频率较高, 保 障用户体验和 CPU性能的同时, 不是一次性调高频率到最大频率, 而是分 段调节频率(例如先调节到第一频率), 故可进一步节省 CPU的功率消耗。 本发明第八实施例还提供一种装置, 如图 8C所示, 该装置在上述本发 明第七实施例或与图 8A对应的实施例或与图 8B对应的实施例的基础上, 还包括:
定时器, 用于在所述 CPU对应的定时器的计时时刻到达时, 执行本发 明第七实施例或与图 8A对应的实施例或与图 8B对应的实施例所述的装置 的功能。
进一步的, 该装置还可包括: 第十五单元, 用于当系统空闲时, 控制 所述定时器停止计时。
进一步的, 该装置还可包括: 第十六单元, 用于当系统退出空闲时, 控制所述定时器启动计时。
进一步的, 该装置还可包括: 第十七单元, 用于在所述定时器连续计 时时刻到达时, 获取的所述定时器对应的工作频率均为频率最大值, 且所 述工作频率均为频率最大值的次数刚大于最高频率持续周期次数阔值, 则 所述定时器停止计时。
其中,最高频率持续周期次数阔值为: (开启 CPU功耗敏感因子阔值 X 开核釆样空间) / (占用率阔值 X频率权重), 其中, 所述频率权重为所述 第一权重;
所述工作频率均为频率最大值的次数刚大于最高频率持续周期次数阔 值为: 所述工作频率均为频率最大值的次数为最高频率持续周期次数阔值 力口一。
关于上述第七实施例,或第八实施例中的第一频率和第二频率的确定, 可参考如下方式进行:
第一频率为电流 -频率曲线中的拐点对应的频率。
图 4的电流-频率曲线中, 第一斜率小于第二斜率; 第一斜率为比所述 拐点对应的频率低的测量点形成的直线的斜率; 所述第二斜率为比所述拐 点对应的频率高的测量点形成的直线的斜率。
第二频率为所述第一频率和所述最高频率的平均值。
进一步的, 第一频率和第二频率的确定, 也可以参考图 4和本发明第 四实施例的相关描述, 此处不再赘述。 本发明第九实施例还提供一种携带程序代码的计算机程序, 当所述计 算机程序在计算机上运行时, 所述程序代码执行如本发明第一至四实施例 所述的方法。 本发明第十实施例还提供一种计算机可读存储介质, 该计算机存储计 算机程序代码, 当计算机程序代码被一个计算机执行的时候, 计算机程序 代码可以确认得计算机执行本发明第一至四实施例所述的方法的步骤。 本发明第十一实施例还提供一种计算机程序产品, 该计算机程序产品 包括计算机程序代码, 当计算机程序代码被一个计算机执行的时候, 计算 机程序代码可以确认得计算机执行本发明第一至四实施例所述的方法的步 骤。
本发明的精神和范围。 这样, 倘若本发明的这些修改和变型属于本发明权 利要求及其等同技术的范围之内, 则本发明也意图包含这些改动和变型在 内。

Claims

权利要求
1、 一种控制中央处理器 CPU的方法, 其特征在于, 包括:
获取工作的 CPU的占用率和工作频率;
当所述占用率大于占用率阔值,判断所述工作频率是否小于第一频率; 当所述工作频率小于第一频率时, 确认所述工作频率为第一频率; 其中, 所述第一频率小于所述 CPU的最高频率。
2、 如权利要求 1所述的方法, 其特征在于, 还包括:
当所述工作频率大于或等于第一频率时, 判断所述工作频率是否小于 或等于第二频率, 所述第二频率大于所述第一频率且小于所述最高频率; 当所述工作频率小于或等于所述第二频率时, 确认所述工作频率为第 二频率。
3、 如权利要求 2所述的方法, 其特征在于, 所述当所述工作频率小于 或等于所述第二频率时, 确认所述工作频率为第二频率, 包括:
当所述工作频率小于或等于所述第二频率, 且循环保持计数值小于循 环保持计数阔值时, 确认所述工作频率为第二频率。
4、 如权利要求 3所述的方法, 其特征在于, 还包括:
所述循环保持计数值加一。
5、 如权利要求 2至 4任一项所述的方法, 其特征在于, 还包括: 当所述工作频率大于所述第二频率时,确认所述工作频率为第三频率, 所述第三频率等于所述最高频率。
6、 如权利要求 3至 5任一项所述的方法, 其特征在于, 还包括: 当所述循环保持计数值大于或等于所述循环保持计数阔值时, 确认所 述工作频率为所述最高频率。
7、 如权利要求 3至 6任一项所述的方法, 其特征在于, 还包括: 当所述占用率大于所述占用率阔值, 且所述工作频率小于或等于所述 第一频率时, 清零所述循环保持计数值。
8、 如权利要求 1至 7任一项所述的方法, 其特征在于, 还包括: 当所述占用率小于或等于所述占用率阔值时, 获取所述占用率与所述 工作频率的乘积, 确认所述工作频率为与所述乘积最接近的频率值, 并清 零所述循环保持计数值。
9、 如权利要求 1所述的方法, 其特征在于, 还包括:
当所述工作频率大于或等于第一频率时, 确认所述工作频率为最高频 率。
10、 如权利要求 1或 9所述的方法, 其特征在于, 所述当所述工作频 率小于第一频率时, 确认所述工作频率为第一频率, 具体为:
当所述工作频率小于第一频率, 且循环保持计数值小于循环保持计数 阔值时, 确认所述工作频率为第一频率。
11、 如权利要求 10所述的方法, 其特征在于, 还包括:
所述循环保持计数值加一。
12、 如权利要求 10至 11任一项所述的方法, 其特征在于, 还包括: 当所述循环保持计数值大于或等于所述循环保持计数阔值时, 确认所 述工作频率为所述最高频率。
1 3、 如权利要求 10或 11或 12所述的方法, 其特征在于, 还包括: 当所述占用率小于或等于所述占用率阔值时, 获取所述占用率与所述 工作频率的乘积, 确认所述工作频率为与所述乘积最接近的频率值, 并清 零所述循环保持计数值。
14、 如权利要求 1至 1 3任一项所述的方法, 其特征在于, 在所述 CPU 对应的定时器的计时时刻到达时, 执行所述方法的步骤。
15、 如权利要求 14所述的方法, 其特征在于, 所述方法还包括: 当系统空闲时, 所述定时器停止计时。
16、 如权利要求 14或 15所述的方法, 其特征在于, 所述方法还包括: 当系统退出空闲时, 所述定时器启动计时。
17、 如权利要求 14至 16任一项所述的方法, 其特征在于, 所述方法 还包括:
如果在所述定时器连续计时时刻到达时, 获取的所述定时器对应的工 作频率均为频率最大值, 且所述工作频率均为频率最大值的次数刚大于最 高频率持续周期次数阔值, 则所述定时器停止计时。
18、 如权利要求 17所述的方法, 其特征在于, 所述最高频率持续周期 次数阔值为:
(开启 CPU功耗敏感因子阔值 X开核釆样空间) I (占用率阔值 X频率 权重), 其中, 所述频率权重为所述第一权重; 所述工作频率均为频率最大值的次数刚大于最高频率持续周期次数阔 值为:
所述工作频率均为频率最大值的次数为最高频率持续周期次数阔值加
19、 如权利要求 1至 18任一项所述的方法, 其特征在于, 所述第一频 率为电流 -频率曲线中的拐点对应的频率。
20、 如权利要求 19所述的方法, 其特征在于,
所述电流-频率曲线中, 第一斜率小于第二斜率;
所述第一斜率为比所述拐点对应的频率低的测量点形成的直线的斜 率; 所述第二斜率为比所述拐点对应的频率高的测量点形成的直线的斜率。
21、 如权利要求 2至 20任一项所述的方法, 其特征在于,
所述第二频率为所述第一频率和所述最高频率的平均值。
22、 一种终端, 其特征在于, 所述终端包括处理器, 所述处理器用于: 获取工作的 CPU的占用率和工作频率;
当所述占用率大于占用率阔值,判断所述工作频率是否小于第一频率; 当所述工作频率小于第一频率时, 确认所述工作频率为第一频率; 其中, 所述第一频率小于所述 CPU的最高频率。
23、 如权利要求 22所述的终端, 其特征在于, 所述处理器还用于: 当所述工作频率大于或等于第一频率时, 判断所述工作频率是否小于 或等于第二频率, 所述第二频率大于所述第一频率且小于所述最高频率; 当所述工作频率小于或等于所述第二频率时, 确认所述工作频率为第 二频率。
24、 如权利要求 23所述的终端, 其特征在于, 所述处理器当所述工作 频率小于或等于所述第二频率时, 确认所述工作频率为第二频率, 具体包 括:
当所述工作频率小于或等于所述第二频率, 且循环保持计数值小于循 环保持计数阔值时, 确认所述工作频率为第二频率。
25、 如权利要求 24所述的终端, 其特征在于, 所述处理器还用于: 将 所述循环保持计数值加一。
26、 如权利要求 23至 25任一项所述的终端, 其特征在于, 所述处理 器还用于:
当所述工作频率大于所述第二频率时,确认所述工作频率为第三频率, 所述第三频率等于所述最高频率。
27、 如权利要求 24至 26任一项所述的终端, 其特征在于, 所述处理 器还用于:
当所述循环保持计数值大于或等于所述循环保持计数阔值时, 确认所 述工作频率为所述最高频率。
28、 如权利要求 24至 27任一项所述的终端, 其特征在于, 所述处理 器还用于:
当所述占用率大于所述占用率阔值, 且所述工作频率小于或等于所述 第一频率时, 清零所述循环保持计数值。
29、 如权利要求 22至 28任一项所述的终端, 其特征在于, 所述处理 器还用于:
当所述占用率小于或等于所述占用率阔值时, 获取所述占用率与所述 工作频率的乘积, 确认所述工作频率为与所述乘积最接近的频率值, 并清 零所述循环保持计数值。
30、 如权利要求 22所述的终端, 其特征在于, 所述处理器还用于: 当所述工作频率大于或等于第一频率时, 确认所述工作频率为最高频 率。
31、 如权利要求 22或 30所述的终端, 其特征在于, 所述处理器当所 述工作频率小于第一频率时, 确认所述工作频率为第一频率, 具体为: 当所述工作频率小于第一频率, 且循环保持计数值小于循环保持计数 阔值时, 确认所述工作频率为第一频率。
32、 如权利要求 31所述的终端, 其特征在于, 所述处理器还用于: 将 所述循环保持计数值加一。
33、 如权利要求 31至 32任一项所述的终端, 其特征在于, 所述处理 器还用于:
当所述循环保持计数值大于或等于所述循环保持计数阔值时, 确认所 述工作频率为所述最高频率。
34、 如权利要求 31或 32或 33所述的终端, 其特征在于, 所述处理器 还用于:
当所述占用率小于或等于所述占用率阔值时, 获取所述占用率与所述 工作频率的乘积, 确认所述工作频率为与所述乘积最接近的频率值, 并清 零所述循环保持计数值。
35、 如权利要求 22至 34任一项所述的终端, 其特征在于, 所述处理 器还用于, 在所述 CPU对应的定时器的计时时刻到达时, 执行所述功能。
36、 如权利要求 35所述的终端, 其特征在于, 所述处理器还用于: 当系统空闲时, 所述定时器停止计时。
37、 如权利要求 35或 36所述的终端, 其特征在于, 所述处理器还用 于:
当系统退出空闲时, 所述定时器启动计时。
38、 如权利要求 35至 37任一项所述的终端, 其特征在于, 所述处理 器还用于:
如果在所述定时器连续计时时刻到达时, 获取的所述定时器对应的工 作频率均为频率最大值, 且所述工作频率均为频率最大值的次数刚大于最 高频率持续周期次数阔值, 则所述定时器停止计时。
39、 如权利要求 38所述的终端, 其特征在于, 所述最高频率持续周期 次数阔值为:
(开启 CPU功耗敏感因子阔值 X开核釆样空间) I (占用率阔值 X频率 权重), 其中, 所述频率权重为所述第一权重;
所述工作频率均为频率最大值的次数刚大于最高频率持续周期次数阔 值为:
所述工作频率均为频率最大值的次数为最高频率持续周期次数阔值加
40、 如权利要求 22至 39任一项所述的终端, 其特征在于, 所述第一 频率为电流 -频率曲线中的拐点对应的频率。
41、 如权利要求 40所述的终端, 其特征在于,
所述电流-频率曲线中, 第一斜率小于第二斜率;
所述第一斜率为比所述拐点对应的频率低的测量点形成的直线的斜 率; 所述第二斜率为比所述拐点对应的频率高的测量点形成的直线的斜率。
42、 如权利要求 23至 41任一项所述的终端, 其特征在于,
所述第二频率为所述第一频率和所述最高频率的平均值。
43、 一种装置, 其特征在于, 包括:
第一单元, 获取工作的 CPU的占用率和工作频率;
第二单元, 当所述占用率大于占用率阔值, 判断所述工作频率是否小 于第一频率;
第三单元, 当所述工作频率小于第一频率时, 确认所述工作频率为第 一频率; 其中, 所述第一频率小于所述 CPU的最高频率。
44、 如权利要求 43所述的装置, 其特征在于, 还包括:
第四单元, 用于当所述工作频率大于或等于第一频率时, 判断所述工 作频率是否小于或等于第二频率, 所述第二频率大于所述第一频率且小于 所述最高频率;
第五单元, 用于当所述工作频率小于或等于所述第二频率时, 确认所 述工作频率为第二频率。
45、如权利要求 44所述的装置,其特征在于,所述第五单元具体用于: 当所述工作频率小于或等于所述第二频率, 且循环保持计数值小于循 环保持计数阔值时, 确认所述工作频率为第二频率。
46、 如权利要求 45所述的装置, 其特征在于, 还包括:
第六单元, 用于将所述循环保持计数值加一。
47、 如权利要求 44至 46任一项所述的装置, 其特征在于, 还包括: 第七单元, 用于当所述工作频率大于所述第二频率时, 确认所述工作 频率为第三频率, 所述第三频率等于所述最高频率。
48、 如权利要求 45至 47任一项所述的装置, 其特征在于, 还包括: 第八单元, 用于当所述循环保持计数值大于或等于所述循环保持计数 阔值时, 确认所述工作频率为所述最高频率。
49、 如权利要求 45至 48任一项所述的装置, 其特征在于, 还包括: 第九单元, 用于当所述占用率大于所述占用率阔值, 且所述工作频率 小于或等于所述第一频率时, 清零所述循环保持计数值。
50、 如权利要求 43至 49任一项所述的装置, 其特征在于, 还包括: 第十单元, 用于当所述占用率小于或等于所述占用率阔值时, 获取所 述占用率与所述工作频率的乘积, 确认所述工作频率为与所述乘积最接近 的频率值, 并清零所述循环保持计数值。
51、 如权利要求 43所述的装置, 其特征在于, 还包括: 第十一单元, 用于当所述工作频率大于或等于第一频率时, 确认所述 工作频率为最高频率。
52、 如权利要求 43或 51所述的装置, 其特征在于, 所述第三单元具 体用于: 当所述工作频率小于第一频率, 且循环保持计数值小于循环保持 计数阔值时, 确认所述工作频率为第一频率。
53、 如权利要求 52所述的装置, 其特征在于, 还包括:
第十二单元, 用于将所述循环保持计数值加一。
54、 如权利要求 52至 53任一项所述的装置, 其特征在于, 还包括: 第十三单元, 用于当所述循环保持计数值大于或等于所述循环保持计 数阔值时, 确认所述工作频率为所述最高频率。
55、 如权利要求 52或 53或 54所述的装置, 其特征在于, 还包括: 第十四单元, 用于当所述占用率小于或等于所述占用率阔值时, 获取 所述占用率与所述工作频率的乘积, 确认所述工作频率为与所述乘积最接 近的频率值, 并清零所述循环保持计数值。
56、 如权利要求 43至 55任一项所述的装置, 其特征在于, 还包括: 定时器, 用于在所述 CPU对应的定时器的计时时刻到达时, 执行所述 方法的步骤。
57、 如权利要求 56所述的装置, 其特征在于, 还包括:
第十五单元, 用于当系统空闲时, 控制所述定时器停止计时。
58、 如权利要求 56或 57所述的装置, 其特征在于, 还包括: 第十六单元, 用于当系统退出空闲时, 控制所述定时器启动计时。
59、 如权利要求 56至 58任一项所述的装置, 其特征在于, 还包括: 第十七单元, 用于在所述定时器连续计时时刻到达时, 获取的所述定 时器对应的工作频率均为频率最大值, 且所述工作频率均为频率最大值的 次数刚大于最高频率持续周期次数阔值, 则所述定时器停止计时。
60、 如权利要求 59所述的装置, 其特征在于, 所述最高频率持续周期 次数阔值为:
(开启 CPU功耗敏感因子阔值 X开核釆样空间) I (占用率阔值 X频率 权重), 其中, 所述频率权重为所述第一权重;
所述工作频率均为频率最大值的次数刚大于最高频率持续周期次数阔 值为:
所述工作频率均为频率最大值的次数为最高频率持续周期次数阔值加
61、 如权利要求 43至 60任一项所述的装置, 其特征在于, 所述第一 频率为电流 -频率曲线中的拐点对应的频率。
62、 如权利要求 61所述的装置, 其特征在于,
所述电流-频率曲线中, 第一斜率小于第二斜率;
所述第一斜率为比所述拐点对应的频率低的测量点形成的直线的斜 率; 所述第二斜率为比所述拐点对应的频率高的测量点形成的直线的斜率。
63、 如权利要求 44至 62任一项所述的装置, 其特征在于, 所述第二频率为所述第一频率和所述最高频率的平均值。
64、 一种携带程序代码的计算机程序, 当所述计算机程序在计算机上 运行时, 所述程序代码执行如权利要求 1至 21中任一项所述的方法。
65、 一种计算机可读存储介质, 其特征在于, 所述计算机存储计算机 程序代码, 当所述计算机程序代码被一个计算机执行的时候, 所述计算机 程序代码可以使得所述计算机执行权利要求 1至 21中任意一项的步骤。
66、 一种计算机程序产品, 其特征在于, 所述计算机程序产品包括计 算机程序代码, 当所述计算机程序代码被一个计算机执行的时候, 所述计 算机程序代码可以使得所述计算机执行权利要求 1 至 21 中任意一项的步
PCT/CN2012/080765 2012-08-30 2012-08-30 一种控制中央处理器的方法和装置 Ceased WO2014032250A1 (zh)

Priority Applications (5)

Application Number Priority Date Filing Date Title
EP12878637.3A EP2725450A4 (en) 2012-08-30 2012-08-30 METHOD AND DEVICE FOR CONTROLLING A CENTRAL UNIT
JP2014532227A JP5871075B2 (ja) 2012-08-30 2012-08-30 中央演算装置を制御するための方法および装置
CN201280002858.0A CN103415823B (zh) 2012-08-30 2012-08-30 一种控制中央处理器的方法和装置
PCT/CN2012/080765 WO2014032250A1 (zh) 2012-08-30 2012-08-30 一种控制中央处理器的方法和装置
US14/138,029 US9405353B2 (en) 2012-08-30 2013-12-21 Method and apparatus for controlling central processing unit

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2012/080765 WO2014032250A1 (zh) 2012-08-30 2012-08-30 一种控制中央处理器的方法和装置

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US14/138,029 Continuation US9405353B2 (en) 2012-08-30 2013-12-21 Method and apparatus for controlling central processing unit

Publications (1)

Publication Number Publication Date
WO2014032250A1 true WO2014032250A1 (zh) 2014-03-06

Family

ID=49608186

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2012/080765 Ceased WO2014032250A1 (zh) 2012-08-30 2012-08-30 一种控制中央处理器的方法和装置

Country Status (5)

Country Link
US (1) US9405353B2 (zh)
EP (1) EP2725450A4 (zh)
JP (1) JP5871075B2 (zh)
CN (1) CN103415823B (zh)
WO (1) WO2014032250A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2021128084A1 (zh) * 2019-12-25 2021-07-01 阿里巴巴集团控股有限公司 数据处理、获取、模型训练及功耗控制方法、系统及设备

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105528203B (zh) * 2014-10-23 2019-04-12 深圳富泰宏精密工业有限公司 Cpu使用控制系统及方法
CN105813172B (zh) * 2014-12-31 2019-05-10 展讯通信(上海)有限公司 一种lte从模式搜网的方法和系统
CN106066769B (zh) * 2016-05-31 2019-05-21 Oppo广东移动通信有限公司 一种移动终端的处理方法及移动终端
CN106527654A (zh) * 2016-10-13 2017-03-22 乐视控股(北京)有限公司 终端设备的运行频率的控制方法和控制系统
CN108681501B (zh) * 2018-05-07 2022-05-24 网易(杭州)网络有限公司 用户设备的分层方法和装置
CN111666140A (zh) * 2020-05-28 2020-09-15 北京百度网讯科技有限公司 资源调度方法、装置、设备和存储介质
US20230418350A1 (en) * 2022-06-27 2023-12-28 Dell Products L.P. Programmable biasing of operating frequencies for optimal power scaling

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1567180A (zh) * 2003-06-18 2005-01-19 微星科技股份有限公司 调整中央处理器工作频率方法
CN101853066A (zh) * 2009-02-11 2010-10-06 上海芯豪微电子有限公司 一种自动实时调整系统时钟频率的方法和装置

Family Cites Families (29)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH10268963A (ja) * 1997-03-28 1998-10-09 Mitsubishi Electric Corp 情報処理装置
KR100361340B1 (ko) * 2000-05-15 2002-12-05 엘지전자 주식회사 씨피유 클럭 제어 방법
US7596709B2 (en) * 2000-12-30 2009-09-29 Intel Corporation CPU power management based on utilization with lowest performance mode at the mid-utilization range
US7017060B2 (en) * 2001-03-19 2006-03-21 Intel Corporation Power management system that changes processor level if processor utilization crosses threshold over a period that is different for switching up or down
US7111179B1 (en) * 2001-10-11 2006-09-19 In-Hand Electronics, Inc. Method and apparatus for optimizing performance and battery life of electronic devices based on system and application parameters
US7318164B2 (en) 2001-12-13 2008-01-08 International Business Machines Corporation Conserving energy in a data processing system by selectively powering down processors
JP3742364B2 (ja) 2002-06-28 2006-02-01 株式会社東芝 クロック周波数の制御方法および電子機器
US7814350B2 (en) * 2002-10-03 2010-10-12 Via Technologies, Inc. Microprocessor with improved thermal monitoring and protection mechanism
TW200519573A (en) 2003-12-04 2005-06-16 Compal Electronics Inc Method for dynamically adjusting frequency of CPU
JP2005182473A (ja) 2003-12-19 2005-07-07 Toshiba Corp 周波数制御方法および情報処理装置
US7506189B1 (en) * 2004-12-15 2009-03-17 Silego Technology, Inc. Adjusting input power in response to a clock frequency change
WO2007056705A2 (en) * 2005-11-03 2007-05-18 Los Alamos National Security Adaptive real-time methodology for optimizing energy-efficient computing
US7739548B2 (en) * 2006-06-27 2010-06-15 Hewlett-Packard Development Company, L.P. Determining actual power consumption for system power performance states
JP2008077563A (ja) * 2006-09-25 2008-04-03 Nec Corp 電子機器およびcpu動作環境制御プログラム
JP2008217628A (ja) * 2007-03-07 2008-09-18 Nec Corp Cpuの省電力システム及び省電力方法
US20080307240A1 (en) * 2007-06-08 2008-12-11 Texas Instruments Incorporated Power management electronic circuits, systems, and methods and processes of manufacture
CN101414268A (zh) 2007-10-15 2009-04-22 南京大学 一种在ARM MPCore处理器上管理处理器热插拔的方法
JP2009230670A (ja) * 2008-03-25 2009-10-08 Fuji Xerox Co Ltd プロセッサシステム
JP2010039791A (ja) 2008-08-05 2010-02-18 Toshiba Corp 携帯端末装置
US20100182135A1 (en) * 2009-01-16 2010-07-22 Research In Motion Limited Portable electronic device including tactile touch-sensitive display
KR101533572B1 (ko) * 2009-05-20 2015-07-03 삼성전자주식회사 전력 관리 방법
CN101576768A (zh) * 2009-06-15 2009-11-11 北京中星微电子有限公司 切换设备频率的方法以及设备
EP2372962B1 (en) 2010-03-31 2017-08-16 Alcatel Lucent Method and system for reducing energy consumption in packet processing linecards
US8504854B2 (en) * 2010-06-21 2013-08-06 Advanced Micro Devices, Inc. Managing multiple operating points for stable virtual frequencies
CN102004543B (zh) * 2010-11-29 2013-08-07 华为技术有限公司 一种实现cpu节能的方法及装置
JP5621613B2 (ja) * 2011-01-19 2014-11-12 富士通株式会社 情報処理装置、制御方法及びプログラム
US8650423B2 (en) * 2011-10-12 2014-02-11 Qualcomm Incorporated Dynamic voltage and clock scaling control based on running average, variant and trend
CN102566739B (zh) 2012-01-06 2014-11-26 威盛电子股份有限公司 多核处理器系统及其动态电源管理方法与控制装置
US9348401B2 (en) * 2013-06-25 2016-05-24 Intel Corporation Mapping a performance request to an operating frequency in a processor

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1567180A (zh) * 2003-06-18 2005-01-19 微星科技股份有限公司 调整中央处理器工作频率方法
CN101853066A (zh) * 2009-02-11 2010-10-06 上海芯豪微电子有限公司 一种自动实时调整系统时钟频率的方法和装置

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2021128084A1 (zh) * 2019-12-25 2021-07-01 阿里巴巴集团控股有限公司 数据处理、获取、模型训练及功耗控制方法、系统及设备

Also Published As

Publication number Publication date
US9405353B2 (en) 2016-08-02
US20140108838A1 (en) 2014-04-17
JP2014529146A (ja) 2014-10-30
CN103415823B (zh) 2016-05-25
CN103415823A (zh) 2013-11-27
EP2725450A4 (en) 2015-07-08
JP5871075B2 (ja) 2016-03-01
EP2725450A1 (en) 2014-04-30

Similar Documents

Publication Publication Date Title
WO2014032250A1 (zh) 一种控制中央处理器的方法和装置
CN103415824B (zh) 一种控制中央处理器的方法和装置
JP6487044B2 (ja) ユーザ機器のための電力管理方法および電力管理装置
WO2018219104A1 (zh) 省电控制方法及相关产品
WO2015081664A1 (zh) 控制无线网络开关方法、装置、设备及系统
WO2014090202A1 (zh) 一种功率控制的方法、装置及终端
WO2015035870A1 (zh) 多cpu调度方法及装置
CN106055237B (zh) 一种滑动加速响应方法、及设备
CN111954286B (zh) 一种功率调节方法、装置、存储介质及终端
WO2019034104A1 (zh) 终端自动释放后台进程占用资源的方法、存储介质及终端
CN106055079A (zh) 一种中央处理器的管理方法、及装置
WO2019011335A1 (zh) 一种移动终端及其控制方法和可读存储介质
WO2018126408A1 (zh) 一种参数配置方法及设备
CN107220344B (zh) 文件处理方法及相关产品
CN106066769B (zh) 一种移动终端的处理方法及移动终端
WO2016023201A1 (zh) 一种并发业务的处理方法及终端
CN106851737A (zh) 一种发送上行数据的方法,及终端设备
WO2018152673A1 (zh) 一种小区切换方法及终端
CN110461031A (zh) 终端设备的控制方法及终端设备
CN106911873B (zh) 优化马达的方法、装置及移动终端
CN110995324B (zh) 蓝牙通信方法、装置、存储介质及终端设备
CN110045811A (zh) 应用程序处理方法和装置、电子设备、计算机可读存储介质
CN106896896B (zh) 省电方法、装置及电子设备
CN105549917B (zh) 全球定位系统内存自适应倍频方法、装置及终端
WO2020088650A1 (zh) 一种应用于移动终端的应用处理器唤醒方法及装置

Legal Events

Date Code Title Description
ENP Entry into the national phase

Ref document number: 2014532227

Country of ref document: JP

Kind code of ref document: A

121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 12878637

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE