[go: up one dir, main page]

TWI387866B - Method for adjusting frequency and electronic apparatus and computer program product using the method - Google Patents

Method for adjusting frequency and electronic apparatus and computer program product using the method Download PDF

Info

Publication number
TWI387866B
TWI387866B TW97141229A TW97141229A TWI387866B TW I387866 B TWI387866 B TW I387866B TW 97141229 A TW97141229 A TW 97141229A TW 97141229 A TW97141229 A TW 97141229A TW I387866 B TWI387866 B TW I387866B
Authority
TW
Taiwan
Prior art keywords
work
frequency
processor
time
ideal
Prior art date
Application number
TW97141229A
Other languages
Chinese (zh)
Other versions
TW201017361A (en
Inventor
Cheng Wei Huang
I Hsiang Huang
Jian Yi Chen
Original Assignee
Tatung Co
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 Tatung Co filed Critical Tatung Co
Priority to TW97141229A priority Critical patent/TWI387866B/en
Publication of TW201017361A publication Critical patent/TW201017361A/en
Application granted granted Critical
Publication of TWI387866B publication Critical patent/TWI387866B/en

Links

Landscapes

  • Power Sources (AREA)

Description

頻率調整方法及使用此方法的電子裝置與電腦程式產 品Frequency adjustment method and electronic device and computer program using the same Product

本發明是有關於一種省電技術,且特別是有關於一種可以省電之頻率調整方法及使用此方法的電子裝置與電腦程式產品。The present invention relates to a power saving technology, and in particular to a frequency adjustment method capable of saving power and an electronic device and a computer program product using the same.

一般來說,ZigBee為一通訊協定,主要使用在家庭、建築物或是工業上的自動化和控制、消費電子、監視器、電腦週邊、玩具等。由於ZigBee裝置是由電池供應電源,所以極需要省電。因此,ZigBee裝置會於硬體上提供休眠模式,也就是說,當ZigBee裝置處於休眠模式下,會完全停止或部份停止對ZigBee裝置中的硬體進行供電,以便於達到節省電能消耗的作用。In general, ZigBee is a communication protocol that is used primarily in homes, buildings, or industrial automation and control, consumer electronics, monitors, computer peripherals, and toys. Since the ZigBee device is powered by a battery, power saving is extremely required. Therefore, the ZigBee device will provide a sleep mode on the hardware, that is, when the ZigBee device is in the sleep mode, the hardware in the ZigBee device will be completely stopped or partially stopped, so as to save power consumption. .

由上述可知,ZigBee裝置雖可以於休眠模式下達到省電的作用。但是,當ZigBee裝置被喚醒時,亦即離開休眠模式之後,必須恢復供電至ZigBee裝置中的硬體,來處理ZigBee裝置中所需要被執行的工作,以便於讓ZigBee裝置正常運作。如此一來,ZigBee裝置在離開休眠模式之後,將無法節省電能消耗,故如何在ZigBee裝置處於非休眠模式下還能適時的節省電能消耗,將是一個重要的課題。As can be seen from the above, the ZigBee device can achieve power saving in the sleep mode. However, when the ZigBee device is woken up, that is, after leaving the sleep mode, the hardware supplied to the ZigBee device must be restored to handle the work that needs to be performed in the ZigBee device in order to allow the ZigBee device to operate normally. As a result, the ZigBee device will not save power consumption after leaving the sleep mode, so how to save power consumption in a timely manner when the ZigBee device is in the non-sleep mode will be an important issue.

本發明提供一種頻率調整方法及使用此方法的電子裝置與電腦程式產品,藉此可以有效地降低電子裝置的耗電量。The present invention provides a frequency adjustment method and an electronic device and a computer program product using the same, whereby the power consumption of the electronic device can be effectively reduced.

本發明提出一種頻率調整方法,適用於即時系統之工作排程。此頻率調整方法包括下列步驟。首先,取得多個工作,並於預設時間內,執行上述工作,其中上述工作於預設時間內至少被執行一次。接著,統計每一工作的執行次數、執行時間以及等待時間。之後依據預設時間與上述工作的執行次數、執行時間以及等待時間,計算上述工作的週期與時限。接著,依據上述工作的執行時間、週期與時限,利用演算法計算每一工作的理想頻率,並將這些工作的理想頻率各自對應至即時系統之處理器的實際頻率及時脈分割值。最後,當執行每一個工作時,依據此工作對應的實際頻率來執行此工作。The invention provides a frequency adjustment method suitable for the work scheduling of an immediate system. This frequency adjustment method includes the following steps. First, a plurality of jobs are acquired, and the above work is performed within a preset time, wherein the above work is performed at least once within a preset time. Next, count the number of executions, execution time, and wait time for each job. Then, according to the preset time and the number of executions of the above work, the execution time, and the waiting time, the period and time limit of the above work are calculated. Then, according to the execution time, the period and the time limit of the above work, the algorithm is used to calculate the ideal frequency of each work, and the ideal frequencies of the work are respectively corresponding to the actual frequency and the time pulse segmentation value of the processor of the real-time system. Finally, when performing each job, this is done according to the actual frequency corresponding to this work.

在本發明一實施例中,上述利用演算法計算每一工作的理想頻率的步驟包括下列步驟。首先,計算上述工作的最小時脈頻率。接著,依據上述工作的最小時脈頻率,計算上述工作的理想頻率。之後依據上述工作的優先權先後,判斷優先權較後的第二筆工作的理想頻率是否小於優先權較先的第一筆工作的理想頻率。接著,若第二筆工作的理想頻率小於第一筆工作的理想頻率,依據第二筆工作的最大執行時間,調整第二筆工作的理想頻率。In an embodiment of the invention, the step of calculating an ideal frequency for each job using an algorithm includes the following steps. First, calculate the minimum clock frequency for the above work. Next, the ideal frequency of the above operation is calculated based on the minimum clock frequency of the above operation. Then, according to the priority of the above work, it is judged whether the ideal frequency of the second work with lower priority is less than the ideal frequency of the first work with priority first. Then, if the ideal frequency of the second work is less than the ideal frequency of the first work, the ideal frequency of the second work is adjusted according to the maximum execution time of the second work.

在本發明一實施例中,上述計算工作的理想頻率的步驟包括依據上述工作的優先權順序,依序由優先權順序最優先的工作進行計算,且每一工作的理想頻率是取優先權順序後於或等於其優先權順序之該些工作的最小時脈頻率的最大值。In an embodiment of the present invention, the step of calculating the ideal frequency of the work includes calculating, according to the priority order of the above work, the highest priority work in the priority order, and the ideal frequency of each work is the priority order. The maximum value of the minimum clock frequency of the operations after or equal to their priority order.

在本發明一實施例中,上述將工作的理想頻率各自對應至處理器的實際頻率的步驟之後更包括將每一時脈分割值儲存到對應的工作的時脈分割值屬性欄位;在執行該工作時,依照工作的該時脈分割值屬性欄位變動處理器的執行頻率。In an embodiment of the invention, the step of respectively corresponding to the actual frequency of the operation corresponding to the actual frequency of the processor further comprises: storing each clock segmentation value into a corresponding working clock segmentation value attribute field; When working, the value field of the clock segmentation value field according to the work changes the execution frequency of the processor.

在本發明一實施例中,上述每一工作的週期與工作的時限相同。In an embodiment of the invention, the period of each of the above operations is the same as the working time.

在本發明一實施例中,上述工作的週期與時限的計算方式為,其中T為預設時間,f i 為工作的執行次數,C i 為工作的執行時間,W i 為工作的等待時間,i為大於等於1的正整數,n為工作的數量。In an embodiment of the invention, the period of the above work and the time limit are calculated. Where T is the preset time, f i is the number of executions of the work, C i is the execution time of the work, W i is the waiting time of the work, i is a positive integer greater than or equal to 1, and n is the number of jobs.

在本發明一實施例中,上述在依據工作對應的實際頻率來執行工作的步驟包括下列步驟。當調降即時系統之處理器的工作電壓與即時系統之處理器的實際頻率時,先調降即時系統之處理器的實際頻率後,再調降即時系統之處理器的工作電壓。當調升即時系統的工作電壓與即時系統之處理器的實際頻率時,先調升即時系統之處理器的工作電壓後,再調升即時系統之處理器的實際頻率。In an embodiment of the invention, the step of performing the work at the actual frequency corresponding to the work comprises the following steps. When the operating voltage of the processor of the real-time system and the actual frequency of the processor of the real-time system are adjusted, the actual frequency of the processor of the real-time system is first adjusted, and then the operating voltage of the processor of the real-time system is adjusted. When the operating voltage of the real-time system and the actual frequency of the processor of the real-time system are increased, the operating voltage of the processor of the real-time system is first adjusted, and then the actual frequency of the processor of the real-time system is adjusted.

本發明提出一種電子裝置,包括處理器、記憶體與供電單元。處理器取得多個工作後,並於預設時間內執行上述工作,以統計出每一工作的執行次數、執行時間以及等待時間,再依據預設時間與工作的執行次數、執行時間以及等待時間,計算出工作的週期與時限,之後再依據工作的執行時間、週期與時限計算工作的理想頻率,並將這些 工作的理想頻率各自對應至處理器的實際頻率,以利用這些實際頻率執行這些工作。記憶體耦接於處理器,儲存工作的執行次數、執行時間以及等待時間與工作的週期與時限。供電單元提供電子裝置的工作電源。The invention provides an electronic device comprising a processor, a memory and a power supply unit. After the processor obtains multiple jobs, the above work is performed within a preset time to count the number of executions, execution time, and waiting time of each job, and then according to the preset time, the number of executions of the work, the execution time, and the waiting time. Calculate the period and time limit of the work, and then calculate the ideal frequency of the work based on the execution time, period and time limit of the work, and The ideal frequencies of operation each correspond to the actual frequency of the processor to perform these tasks using these actual frequencies. The memory is coupled to the processor, and stores the number of executions of the work, the execution time, and the waiting period and the working period and time limit. The power supply unit provides an operating power source for the electronic device.

在本發明一實施例中,上述處理器更計算工作的最小時脈頻率,並依據工作的最小時脈頻率,計算工作的理想頻率,再依據工作的優先權先後,判斷優先權較後的第二筆工作的理想頻率是否小於優先權較先的第一筆工作的理想頻率,之後若第二筆工作的理想頻率小於第一筆工作的理想頻率,依據第二筆工作的最大執行時間,調整第二筆工作的理想頻率。In an embodiment of the invention, the processor further calculates the minimum clock frequency of the operation, and calculates the ideal frequency of the work according to the minimum clock frequency of the work, and then determines the priority after the priority according to the priority of the work. Whether the ideal frequency of the two jobs is less than the ideal frequency of the first work with priority first, and then if the ideal frequency of the second work is less than the ideal frequency of the first work, adjust according to the maximum execution time of the second work The ideal frequency for the second job.

在本發明一實施例中,上述處理器更依據工作的優先權順序,依序由優先權順序最優先的工作進行計算,且每一工作的理想頻率是取優先權順序後於或等於其優先權順序之工作的最小時脈頻率的最大值。In an embodiment of the present invention, the processor is further calculated according to the priority order of the work, and is sequentially calculated by the highest priority work in the priority order, and the ideal frequency of each work is equal to or equal to the priority order. The maximum value of the minimum clock frequency for the operation of the weight sequence.

在本發明一實施例中,上述處理器將每一時脈分割值儲存到對應的記憶體之工作的時脈分割值屬性欄位,並且處理器在執行工作時,依照記憶體所儲存之工作的時脈分割值屬性欄位變動處理器的執行頻率。In an embodiment of the invention, the processor stores each clock segmentation value into a clock segmentation value attribute field of the corresponding memory, and the processor stores the work according to the memory when performing the work. The clock split value attribute field changes the execution frequency of the processor.

在本發明一實施例中,上述每一工作的週期與工作的時限相同。In an embodiment of the invention, the period of each of the above operations is the same as the working time.

在本發明一實施例中,上述工作的週期與時限的計算方式為,其中T為預設時間,f i 為工作 的執行次數,C i 為工作的執行時間,W i 為工作的等待時間,i為大於等於1的正整數,n為工作的數量。In an embodiment of the invention, the period of the above work and the time limit are calculated. Where T is the preset time, f i is the number of executions of the work, C i is the execution time of the work, W i is the waiting time of the work, i is a positive integer greater than or equal to 1, and n is the number of jobs.

在本發明一實施例中,上述當處理器無工作處理時,則電子裝置進入休眠模式。In an embodiment of the invention, when the processor has no working process, the electronic device enters a sleep mode.

在本發明一實施例中,上述處理器利用實際頻率執行工作時,若要調降處理器的實際頻率與處理器的工作電壓,則先調降處理器的實際頻率後,再調降處理器的工作電壓,而若要調升處理器的實際頻率與處理器的工作電壓,則先調升處理器的工作電壓後,再調升處理器的實際頻率。In an embodiment of the present invention, when the processor performs the operation using the actual frequency, if the actual frequency of the processor and the operating voltage of the processor are to be lowered, the actual frequency of the processor is first adjusted, and then the processor is lowered. The operating voltage, and to increase the actual frequency of the processor and the operating voltage of the processor, first increase the operating voltage of the processor, and then increase the actual frequency of the processor.

本發明提出一種電腦程式產品,經由電腦載入程式執行下列步驟:首先,取得多個工作,並於預設時間內,執行上述工作,其中每一工作於預設時間內至少被執行一次。接著,統計每一工作的執行次數、執行時間以及等待時間。之後,依據預設時間與工作的執行次數、執行時間以及等待時間,計算工作的週期與時限。接著,依據工作的執行時間、週期與時限,利用演算法計算每一工作的理想頻率,並將工作的理想頻率各自對應至即時系統之處理器的實際頻率。最後,當執行每一工作時,依據此工作對應的實際頻率來執行此工作。The present invention provides a computer program product that performs the following steps via a computer loading program: First, multiple jobs are acquired, and the above work is performed within a preset time, wherein each job is executed at least once within a preset time. Next, count the number of executions, execution time, and wait time for each job. After that, the working period and time limit are calculated according to the preset time and the number of executions of the work, the execution time, and the waiting time. Then, according to the execution time, period and time limit of the work, the algorithm is used to calculate the ideal frequency of each work, and the ideal frequency of the work is respectively corresponding to the actual frequency of the processor of the real-time system. Finally, when performing each job, this is done according to the actual frequency corresponding to this work.

本發明藉由在預設時間內,先執行所取得的所有工作,並且統計這些工作的執行次數、執行時間與等待時間。再藉由上述參數計算出每一工作的週期與時限。接著,將上述的參數代入一演算法中,以便計算每一工作的理想頻 率,並判斷是否需要調整這些工作的理想頻率。接著,將這些工作的理想頻率各自對應至即時系統之處理器的實際頻率。最後,當執行每一個工作時,依據此工作對應的實際頻率來執行此工作。藉此,本發明可以有效地降低電子裝置的處理器頻率,進而達到節省電能消耗的作用。The present invention performs all the work obtained by executing the preset time, and counts the number of executions, the execution time, and the waiting time of these jobs. Then calculate the period and time limit of each work by the above parameters. Next, the above parameters are substituted into an algorithm to calculate the ideal frequency for each job. Rate and determine if you need to adjust the ideal frequency for these jobs. The ideal frequencies for these jobs are then each mapped to the actual frequency of the processor of the instant system. Finally, when performing each job, this is done according to the actual frequency corresponding to this work. Thereby, the invention can effectively reduce the processor frequency of the electronic device, thereby achieving the effect of saving power consumption.

為讓本發明之上述特徵和優點能更明顯易懂,下文特舉實施例,並配合所附圖式,作詳細說明如下。The above described features and advantages of the present invention will be more apparent from the following description.

圖1繪示為本發明一實施例之電子裝置的方塊圖。圖2繪示為本發明一實施例之頻率調整方法的流程圖。請先參照圖1,電子裝置100包括處理器110、記憶體120以及供電單元130。在本實施例中,電子裝置100可以為即時系統(Real-time System),而處理器110可以用來處理即時系統之工作排程(Scheduling),並且例如ZigBee裝置這一類使用電池為供電單元的電子裝置。記憶體120耦接於處理器110,用來儲存工作(Task)的執行時間(Execution time)、執行次數(Execution number)、等待時間(Waiting time)與工作的週期(Period)以及時限(Deadline)。供電單元130用來提供電子裝置100的工作電源,以便於電子裝置100可以正常運作。FIG. 1 is a block diagram of an electronic device according to an embodiment of the invention. 2 is a flow chart of a frequency adjustment method according to an embodiment of the present invention. Referring first to FIG. 1 , the electronic device 100 includes a processor 110 , a memory 120 , and a power supply unit 130 . In this embodiment, the electronic device 100 can be a real-time system, and the processor 110 can be used to process the scheduling of the real-time system, and the battery-powered unit is used, for example, as a ZigBee device. Electronic device. The memory 120 is coupled to the processor 110 for storing an Execution time, an Execution number, a Waiting time, a Period, and a Deadline. . The power supply unit 130 is configured to provide an operating power of the electronic device 100 so that the electronic device 100 can operate normally.

請合併參照圖1與圖2,首先,在步驟S201中,處理器110取得多個工作(亦即電子裝置100處於非睡眠模式),並於預設時間內,執行工作,其中每一工作於該預設時間內至少被執行一次。為了方便說明,在本實施例中, 以取得3個工作作為說明,且這3個工作分別以T1、T2、T3表示之。也就是說,處理器110在取得工作T1、T2、T3後,會於預設時間T內,執行工作T1、T2、T3。Referring to FIG. 1 and FIG. 2 together, first, in step S201, the processor 110 obtains a plurality of jobs (that is, the electronic device 100 is in a non-sleep mode), and performs work within a preset time, each of which works. This preset time is executed at least once. For convenience of explanation, in this embodiment, The three jobs are taken as an explanation, and the three jobs are represented by T1, T2, and T3, respectively. That is to say, after obtaining the operations T1, T2, and T3, the processor 110 executes the operations T1, T2, and T3 within the preset time T.

在步驟S203中,處理器110進行統計每一工作的執行次數、執行時間以及等待時間。在本實施例中,執行次數、執行時間以及等待時間分別以fi、Ci、Wi表示之,其中i為大於等於1的正整數。在本實施例中,執行時間Ci為每一工作於預設時間內的實際執行時間,而等待時間Wi為每一工作等待被執行的時間,例如為等待使用者按壓某鍵以執行對應之工作的時間。舉例來說,假設預設時間T為30毫秒(ms),並且在此預設時間T中執行工作T1、T2、T3後,會得到工作T1、T2、T3的執行次數f1 、f2 、f3 分別為3次、2次、1次;工作T1、T2、T3的執行時間C1 、C2 、C3 分別為5毫秒、2毫秒、1毫秒;工作T1、T2、T3的等待時間W1 、W2 、W3 都為0秒。In step S203, the processor 110 performs statistics on the number of executions of each job, the execution time, and the waiting time. In this embodiment, the number of executions, the execution time, and the waiting time are represented by fi, Ci, and Wi, respectively, where i is a positive integer greater than or equal to 1. In this embodiment, the execution time Ci is the actual execution time for each operation within the preset time, and the waiting time Wi is the time for each work waiting to be executed, for example, waiting for the user to press a key to perform the corresponding work. time. For example, assuming that the preset time T is 30 milliseconds (ms), and after the operations T1, T2, and T3 are performed in the preset time T, the execution times f 1 and f 2 of the jobs T1, T2, and T3 are obtained. f 3 is 3 times, 2 times, 1 time respectively; the execution times C 1 , C 2 , and C 3 of the work T1, T2, and T3 are 5 milliseconds, 2 milliseconds, and 1 millisecond, respectively; waiting times of working T1, T2, and T3 W 1 , W 2 , and W 3 are all 0 seconds.

在步驟S205,處理器110依據預設時間與工作的執行次數fi、執行時間Ci以及等待時間Wi,計算工作的週期Pi與時限Di。在本實施例中,每一工作的週期與時限相同,並且工作的週期與時限的計算方式為,其中T為預設時間,fi 為工作的執行次數,Ci 為工作的執行時間,W i 為工作的等待時間,其中i為大於等於1的正整數,n為工作的數量。因此,將預設時間與工作的執行次數、執行時間以及等待時間代入 計算式,可以計算出工作T1、T2、T3的週期P1、P2、P3與時限D1、D2、D3分別為10毫秒、15毫秒、30毫秒。In step S205, the processor 110 calculates the working period Pi and the time limit Di according to the preset time and the execution number fi of the work, the execution time Ci, and the waiting time Wi. In this embodiment, the period of each work is the same as the time limit, and the period and time limit of the work are calculated. Where T is the preset time, fi is the number of executions of the work, Ci is the execution time of the work, and W i is the waiting time of the work, where i is a positive integer greater than or equal to 1, and n is the number of jobs. Therefore, the preset time and the number of executions of the work, the execution time, and the waiting time are substituted into the calculation formula. It can be calculated that the periods P1, P2, and P3 of the operations T1, T2, and T3 and the time limits D1, D2, and D3 are 10 milliseconds, 15 milliseconds, and 30 milliseconds, respectively.

之後,在步驟S207中,處理器110依據工作的執行時間、週期與時限,利用預設的演算法計算每一工作的理想頻率,並將工作的理想頻率各自對應至電子裝置100(即時系統)之處理器110的實際頻率及時脈分割值。Then, in step S207, the processor 110 calculates the ideal frequency of each work by using a preset algorithm according to the execution time, the period and the time limit of the work, and respectively corresponds the ideal frequency of the work to the electronic device 100 (instant system). The actual frequency of the processor 110 is divided into time and pulse values.

為了使本領域有通常知識者可以得知如何計算出每一工作的理想頻率,以下將舉一例來說明。圖3繪示為圖2之步驟S207的詳細步驟流程圖。圖4A繪示為一種在各工作的頻率未調整之前的工作排程示意圖。圖4B繪示為本發明一實施例之各工作的頻率調整之後的工作排程示意圖。在本實施例中,每一個工作會各自對應多個參數值,並且分別為執行時間、週期以及時限。因此,藉由步驟S203與S205所計算出來的參數值可以推得,工作T1對應的參數值C1、P1、D1為{5*fmax ,10,10};工作T2對應的參數值C2、P2、D2為{2*fmax ,15,15};工作T3對應的參數值C3、P3、D3為{1*fmax ,30,30}。另外,上述fmax 為頻率最大值(亦即該工作利用處理器110的最大使用頻率),而上述對應參數Ci 項的表示式Ci *fmax 係指以fmax 為頻率所需的執行時間為Ci ,並非指Ci 乘以fmaxIn order to enable those skilled in the art to know how to calculate the ideal frequency for each job, an example will be described below. FIG. 3 is a flow chart showing the detailed steps of step S207 of FIG. 2. FIG. 4A is a schematic diagram of a work schedule before the frequency of each work is not adjusted. FIG. 4B is a schematic diagram of the work schedule after the frequency adjustment of each operation according to an embodiment of the present invention. In this embodiment, each job corresponds to a plurality of parameter values, and is an execution time, a period, and a time limit, respectively. Therefore, the parameter values calculated by steps S203 and S205 can be derived, and the parameter values C1, P1, and D1 corresponding to the work T1 are {5*f max , 10, 10}; and the parameter values C2 and P2 corresponding to the work T2. D2 is {2*f max , 15, 15}; the parameter values C3, P3, and D3 corresponding to the work T3 are {1*f max , 30, 30}. In addition, the above f max is the maximum value of the frequency (that is, the maximum use frequency of the work utilizing processor 110), and the expression C i *f max of the corresponding parameter C i is the execution required by f max The time is C i and does not mean that C i is multiplied by f max .

請合併參照圖1、圖3、圖4A與圖4B,在步驟S301中,處理器110會依據上述參數值,計算上述工作各自的最小時脈頻率εi,例如為最小能量時脈頻率 (Energy-Minimizing Clock Frequency)。在本實施例中,上述工作各自的最小時脈頻率是取圖4A之中每一工作的時限結束之前,每一次閒置(Idle)的末端時間與工作的總執行時間比的最小值作為每一工作的最小時脈頻率。舉例來說,工作T1的時限為10,而在此段時間內閒置的末端時間為10,並且工作T1所執行的時間為5,因此,工作T1的最小時脈頻率ε1=min{5/10}=0.5;工作T2的時限為15,而在此段時間內閒置的末端時間為10,且工作T2所執行的時間總共為7(工作T1+工作T2),因此,工作T2的最小時脈頻率ε2=min{7/10}=0.7;工作T3的時限為30,而在此段時間內閒置的末端時間分別為10、20以及30,且工作T3所執行的時間總共分別為8(工作T1+工作T2+工作T3)、15(工作T1*2+工作T2*2+工作T3)以及20(工作T1*3+工作T2*2+工作T3),因此,工作T3的最小時脈頻率ε3=min{8/10,15/20,20/30}=0.67。Referring to FIG. 1 , FIG. 3 , FIG. 4A and FIG. 4B , in step S301 , the processor 110 calculates the minimum clock frequency εi of the above operation according to the parameter values, for example, the minimum energy clock frequency. (Energy-Minimizing Clock Frequency). In this embodiment, the minimum clock frequency of each of the above operations is the minimum value of the ratio of the end time of each idle (Idle) to the total execution time of the work before the end of the time limit of each operation in FIG. 4A. The minimum clock frequency of the work. For example, the time limit of the work T1 is 10, and the end time of the idle time is 10, and the time of the operation T1 is 5, therefore, the minimum clock frequency of the work T1 is ε1=min{5/10 }=0.5; the working time of T2 is 15, and the end time of idle time is 10, and the time of operation T2 is 7 (working T1+working T2), therefore, the minimum clock frequency of working T2 Ε2=min{7/10}=0.7; the time limit of the working T3 is 30, and the end time of the idle time is 10, 20, and 30, respectively, and the time of the work T3 is 8 respectively (working T1+) Working T2+ work T3), 15 (working T1*2+ working T2*2+ working T3) and 20 (working T1*3+ working T2*2+ working T3), therefore, the minimum clock frequency of working T3 is ε3=min{8/10 , 15/20, 20/30} = 0.67.

接著,在步驟S303中,處理器110會依據上述工作各自的最小時脈頻率以及上述工作的優先權順序,計算出上述工作的理想頻率Vi。在本實施例中,處理器110會依據工作的優先權順序,依序由優先權順序最優先的工作進行計算,且每一工作的理想頻率是取優先權順序後於或等於其優先權順序之工作的最小時脈頻率的最大值。Next, in step S303, the processor 110 calculates the ideal frequency Vi of the above operation according to the respective minimum clock frequencies of the above operations and the priority order of the above operations. In this embodiment, the processor 110 calculates, according to the priority order of the work, the highest priority work in the priority order, and the ideal frequency of each work is in the priority order or equal to its priority order. The maximum value of the minimum clock frequency for the operation.

舉例來說,上述工作的優先權順序依序為工作T1、工作T2以及工作T3。因此,處理器110先進行計算工作T1的理想頻率。當計算工作T1的理想頻率V1時,則是取優 先權順序後於或等於工作T1的最小時脈頻率的最大值,也就是V1=max{ε1,ε2,ε3}=max{0.5,0.7,0.67}=0.7;當計算工作T2的理想頻率V2時,則是取優先權順序後於或等於工作T2的最小時脈頻率的最大值,也就是V2=max{ε2,ε3}=max{0.7,0.67}=0.7;當計算工作T3的理想頻率V3時,則是取優先權順序後於或等於工作T3的最小時脈頻率的最大值,也就是V3=max{ε3}=max{0.67}=0.67。For example, the priority order of the above work is in order of work T1, work T2, and work T3. Therefore, the processor 110 first performs the calculation of the ideal frequency of the operation T1. When calculating the ideal frequency V1 of the working T1, it is superior. The first power sequence is equal to or equal to the maximum value of the minimum clock frequency of the working T1, that is, V1=max{ε1, ε2, ε3}=max{0.5, 0.7, 0.67}=0.7; when calculating the ideal frequency V2 of the working T2 Time is the maximum value of the minimum clock frequency at or equal to the working T2 after taking the priority order, that is, V2=max{ε2, ε3}=max{0.7, 0.67}=0.7; when calculating the ideal frequency of the working T3 In V3, it is the maximum value of the minimum clock frequency at or equal to the working T3 after taking the priority order, that is, V3=max{ε3}=max{0.67}=0.67.

之後,進入步驟S305,亦即依據上述工作的優先權順序先後,比較優先權順序較後的第二筆工作的理想頻率是否小於優先權順序較先的第一筆工作的理想頻率。舉例來說,將第一筆工作設為工作T1,而將第二筆工作設為工作T2。接著,比較第一筆工作的理想頻率(工作T1的理想頻率V1)與第二筆工作理想頻率(工作T2的理想頻率V2)。由於工作T1的理想頻率V1與工作T2的理想頻率V2都為0.7,亦即第一筆工作的理想頻率等於第二筆工作的理想頻率,則進行步驟S307,將第一筆工作的理想頻率置換為第二筆工作的理想頻率,並將第二筆工作的理想頻率置換為第三筆工作的理想頻率,其中第三筆工作的優先權順序在第二筆工作之後。亦即,將第一筆工作的理想頻率置換為工作T2的理想頻率V2,而將第二筆工作的理想頻率置換為工作T3的理想頻率V3。Then, proceeding to step S305, that is, according to the priority order of the above work, whether the ideal frequency of the second work after the priority order is compared is less than the ideal frequency of the first work of the priority order. For example, the first job is set to work T1 and the second job is set to work T2. Next, the ideal frequency of the first stroke (the ideal frequency V1 of the operation T1) and the second ideal duty frequency (the ideal frequency V2 of the operation T2) are compared. Since the ideal frequency V1 of the working T1 and the ideal frequency V2 of the working T2 are both 0.7, that is, the ideal frequency of the first working is equal to the ideal frequency of the second working, step S307 is performed to replace the ideal frequency of the first working. For the ideal frequency of the second work, and replace the ideal frequency of the second work with the ideal frequency of the third work, wherein the priority order of the third work is after the second work. That is, the ideal frequency of the first job is replaced by the ideal frequency V2 of the operation T2, and the ideal frequency of the second operation is replaced by the ideal frequency V3 of the operation T3.

接著,再回到步驟S305,判斷第二筆工作的理想頻率是否小於第一筆工作的理想頻率,也就是判斷工作T3的理想頻率V3是否小於工作T2的理想頻率V2。由於T2的 理想頻率V2為0.7,而工作T3的理想頻率V3為0.67,因此,在比較工作T2的理想頻率V2與工作T3的理想頻率V3之後,發現第二筆工作的理想頻率小於第一筆工作的理想頻率,亦即工作T3的理想頻率V3小於工作T2的理想頻率V2,則進入步驟S309,依據第二筆工作的最大執行時間,調整第二筆工作的理想頻率。Next, returning to step S305, it is determined whether the ideal frequency of the second pen operation is less than the ideal frequency of the first pen operation, that is, whether the ideal frequency V3 of the work T3 is less than the ideal frequency V2 of the work T2. Due to T2 The ideal frequency V2 is 0.7, and the ideal frequency V3 of the working T3 is 0.67. Therefore, after comparing the ideal frequency V2 of the working T2 with the ideal frequency V3 of the working T3, it is found that the ideal frequency of the second working is smaller than the ideal of the first working. The frequency, that is, the ideal frequency V3 of the operation T3 is less than the ideal frequency V2 of the operation T2, then proceeds to step S309 to adjust the ideal frequency of the second stroke operation according to the maximum execution time of the second stroke operation.

舉例來說,在工作T1與T2的理想頻率V1與V2都是0.7的情況下,工作T3的最大執行時間為工作T3的時限減去(優先權先於工作T3之工作的總執行時間除以優先權先於工作T3之工作的理想頻率),亦即30-(5*3+2*2)/0.7=2.857。接著,求出工作T3以最大頻率執行所需時間與經調整頻率後最大執行時間的比值,亦即1/2.857=0.35,此數值0.35即為工作T3調整後的理想頻率V3’。For example, in the case where the ideal frequencies V1 and V2 of the operations T1 and T2 are both 0.7, the maximum execution time of the operation T3 is the time limit of the operation T3 minus (the total execution time of the work prior to the priority of the work T3 is divided by The priority precedes the ideal frequency of the work of work T3), that is, 30-(5*3+2*2)/0.7=2.857. Next, the ratio of the required time of the operation T3 to the maximum frequency and the maximum execution time after the adjusted frequency is obtained, that is, 1/2.857=0.35, and the value 0.35 is the ideal frequency V3' after the adjustment of the operation T3.

之後,當調整完第二筆工作的理想頻率,亦即工作T3的理想頻率後,進入步驟S311,也就是判斷所有工作的理想頻率是否已比較完畢。在本實施例中,由於工作T3已是最後一筆工作,因此在步驟S311中,會判斷出所有工作已經比較完畢。After that, after adjusting the ideal frequency of the second work, that is, the ideal frequency of the work T3, the process proceeds to step S311, that is, whether the ideal frequency of all the work has been compared. In the present embodiment, since the job T3 is already the last job, in step S311, it is judged that all the work has been compared.

最後,在步驟S313,將T1、T2以及T3的理想頻率各自對應至電子裝置100之處理器110的實際頻率。在本實施例中,電子裝置100之處理器110的實際頻率是由處理器110的時脈控制暫存器CLKCON所控制,並且此時脈控制暫存器中之位元(bit)0至位元15,即CLKCON[15:0],關係著時脈分割值。因此,電子裝置100 之處理器110的實際頻率為原處理器之實際頻率的1/(CLKCON+1),故電子裝置100之處理器110的實際頻率可能為處理器之最大使用頻率的1/(0+1)、1/(20 +1)、1/(21 +1)、1/(22 +1)、…、1/(215 +1)。Finally, in step S313, the ideal frequencies of T1, T2, and T3 are each corresponding to the actual frequency of the processor 110 of the electronic device 100. In this embodiment, the actual frequency of the processor 110 of the electronic device 100 is controlled by the clock control register CLKCON of the processor 110, and the bit in the pulse control register is 0 to the bit. Element 15, CLKCON[15:0], is related to the clock split value. Therefore, the actual frequency of the processor 110 of the electronic device 100 is 1/(CLKCON+1) of the actual frequency of the original processor, so the actual frequency of the processor 110 of the electronic device 100 may be 1/(0+1) of the maximum used frequency of the processor. ), 1/(2 0 +1), 1/(2 1 +1), 1/(2 2 +1), ..., 1/(2 15 +1).

因此,將上述所計算出來之工作T1、T2以及T3的理想頻率V1、V2以及V3’對應至電子裝置100之處理器110的實際頻率。舉例來說,工作T1的理想頻率V1=0.7是介於電子裝置100之處理器110的實際頻率1/(0+1)至1/(20 +1)之間,故工作T1對應至電子裝置100之處理器110的實際頻率則為1/(0+1)=1,也就是將理想頻率對應至大於或等於此理想頻率的實際頻率中的最小者;工作T2的理想頻率V2=0.7是介於電子裝置100之處理器110的實際頻率1/(0+1)至1/(20 +1)之間,故工作T2對應至電子裝置100之處理器110的實際頻率則為1/(0+1)=1;工作T3的理想頻率V3’=0.35是介於電子裝置100之處理器110的實際頻率1/(20 +1)至1/(21 +1)之間,故工作T3對應至電子裝置100之處理器110的實際頻率則為1/(20 +1)=0.5。Therefore, the ideal frequencies V1, V2, and V3' of the above-described calculated operations T1, T2, and T3 are corresponding to the actual frequencies of the processor 110 of the electronic device 100. For example, the ideal frequency V1=0.7 of the work T1 is between 1/(0+1) and 1/(2 0 +1) of the actual frequency of the processor 110 of the electronic device 100, so the work T1 corresponds to the electronic device 100. The actual frequency of the processor 110 is 1/(0+1)=1, that is, the ideal frequency is corresponding to the smallest of the actual frequencies greater than or equal to the ideal frequency; the ideal frequency of the operation T2 V2=0.7 is between the electronic devices. The actual frequency of the processor 110 of 100 is between 1/(0+1) and 1/(2 0 +1), so the actual frequency of the processor T corresponding to the processor 110 of the electronic device 100 is 1/(0+1)=1; The ideal frequency V3'=0.35 of T3 is between the actual frequency 1/(2 0 +1) to 1/(2 1 +1) of the processor 110 of the electronic device 100, so the work T3 corresponds to the processor of the electronic device 100. The actual frequency of 110 is 1/(2 0 +1)=0.5.

承接上述步驟S311,若是工作T3並不為最後一筆工作時,則會在步驟S311中判斷所有工作的理想頻率並未比較完畢。接著,進入步驟S307中,也就是進行比較優先權順序再次之的工作的理想頻率,例如工作T3與T4的理想頻率、工作T4與T5的理想頻率…等,直到所有工作的理想頻率都比較完畢,進入到步驟S313後則結束此頻 率調整方法的流程。而再回到步驟S307以及之後的運作方式,則可以參照前述之說明,故在此不再贅述。In the above step S311, if the work T3 is not the last work, it is determined in step S311 that the ideal frequencies of all the work are not compared. Then, proceeding to step S307, that is, performing an ideal frequency for comparing the work of the priority order again, for example, the ideal frequency of the work T3 and T4, the ideal frequency of the work T4 and T5, etc. until the ideal frequency of all the work is compared. , after going to step S313, the frequency ends. The process of the rate adjustment method. Returning to the operation mode of step S307 and subsequent steps, reference may be made to the above description, and thus no further description is provided herein.

接著,處理器110可以將工作T1、T2、T3的時脈分割值0、0、1(即20 )儲存到記憶體120之中對應每一工作的時脈分割值屬性欄位clkDiv1、clkDiv2、clkDiv3中,以便於後續執行工作T1、T2、T3時,可以對應調整處理器110的執行頻率。之後,在步驟S209中,當執行每一工作時,依據工作對應的實際頻率來執行此工作。也就是說,在執行工作T1、T2、T3時,處理器110會依照記憶體120之各工作的時脈分割值屬性欄位,來變動處理器110的執行頻率。舉例來說,當處理器110執行工作T1時,處理器110會依照記憶體120之工作T1的時脈分割值屬性欄位clkDiv1所記錄的時脈分割值0,來變動處理器110的執行頻率以執行工作T1;當處理器110執行工作T2時,處理器110會依照記憶體120之工作T2的時脈分割值屬性欄位clkDiv2所記錄的時脈分割值0,來變動處理器110的執行頻率以執行工作T2;當處理器110執行工作T3時,處理器110會依照記憶體120之工作T3的時脈分割值屬性欄位clkDiv3所記錄的時脈分割值1(即20 ),來變動處理器110的執行頻率以執行工作T3。如此一來,由於處理器110在執行工作T3時所使用的頻率為原始頻率的0.5(即1/(20 +1)),故可有效地減少電子裝置100處於非休眠模式下的耗電量。Then, the processor 110 may store the clock split values 0, 0 , 1 (ie, 2 0 ) of the operations T1, T2, and T3 into the clock split value attribute fields clkDiv1 and clkDiv2 corresponding to each work in the memory 120. In clkDiv3, when the subsequent operations T1, T2, and T3 are performed, the execution frequency of the processor 110 can be adjusted correspondingly. Thereafter, in step S209, when each job is performed, this operation is performed in accordance with the actual frequency corresponding to the job. That is to say, when the operations T1, T2, and T3 are executed, the processor 110 changes the execution frequency of the processor 110 according to the clock segmentation value attribute field of each working of the memory 120. For example, when the processor 110 performs the operation T1, the processor 110 changes the execution frequency of the processor 110 according to the clock division value 0 recorded by the clock segmentation value attribute field clkDiv1 of the work T1 of the memory 120. To perform the work T1; when the processor 110 performs the work T2, the processor 110 changes the execution of the processor 110 according to the clock split value 0 recorded by the clock split value attribute field clkDiv2 of the work T2 of the memory 120. The frequency is to perform the work T2; when the processor 110 performs the work T3, the processor 110 according to the clock segmentation value 1 (ie, 2 0 ) recorded by the clock segmentation value attribute field clkDiv3 of the work T3 of the memory 120. The execution frequency of the processor 110 is varied to perform the work T3. In this way, since the frequency used by the processor 110 when performing the operation T3 is 0.5 (ie, 1/(2 0 +1)) of the original frequency, the power consumption of the electronic device 100 in the non-sleep mode can be effectively reduced. .

最後,當處理器110處理完上述工作T1、T2、T3之後,若是沒有其他工作要處理時,電子裝置100可以進入休眠模式,以便於節省電量消耗。Finally, after the processor 110 finishes the above operations T1, T2, and T3, if there is no other work to be processed, the electronic device 100 can enter the sleep mode to save power consumption.

此外,若硬體可以支援調整即時系統(電子裝置)之處理器的工作電壓時,可以在調變即時系統之處理器的實際頻率的同時,據以調整即時系統之處理器的工作電壓,並且實際頻率與工作電壓的調變方式為:(1)調降實際頻率與工作電壓時,先調降實際頻率後,再調降工作電壓。(2)調升實際頻率與工作電壓時,先調升工作電壓後,再調升實際頻率。In addition, if the hardware can support the adjustment of the operating voltage of the processor of the real-time system (electronic device), the operating voltage of the processor of the real-time system can be adjusted while the actual frequency of the processor of the real-time system is modulated, and The modulation mode of the actual frequency and the working voltage is: (1) When the actual frequency and the working voltage are lowered, the actual frequency is first adjusted, and then the operating voltage is adjusted. (2) When the actual frequency and working voltage are raised, first increase the operating voltage and then increase the actual frequency.

本發明另提供一種電腦程式產品,其係用以執行上述的頻率調整方法,此電腦程式產品基本上是由多數個程式碼片段所組成的,並且這些程式碼片段在載入電腦中(例如記憶體120)並執行之後,即可完成上述頻率調整方法的步驟。The invention further provides a computer program product for performing the above frequency adjustment method. The computer program product is basically composed of a plurality of code segments, and the code segments are loaded into a computer (for example, memory After the body 120) is executed, the steps of the above frequency adjustment method can be completed.

綜上所述,本發明藉由在預設時間內,先執行所取得的所有工作,並且統計這些工作的執行次數、執行時間與等待時間。再藉由上述參數計算出每一工作的週期與時限。接著,將上述的參數代入一演算法中,以便計算每一工作的理想頻率,並判斷是否需要調整這些工作的理想頻率。接著,將這些工作的理想頻率各自對應至即時系統之處理器的實際頻率。最後,當執行每一個工作時,依據此工作對應的實際頻率來執行此工作。藉此,本發明可以有 效地降低電子裝置處於非休眠模式下的處理器頻率,進而達到節省電能消耗的作用。In summary, the present invention performs all the work obtained by executing the preset time, and counts the number of executions, the execution time, and the waiting time of the jobs. Then calculate the period and time limit of each work by the above parameters. Next, the above parameters are substituted into an algorithm to calculate the ideal frequency for each job, and to determine whether it is necessary to adjust the ideal frequency of these operations. The ideal frequencies for these jobs are then each mapped to the actual frequency of the processor of the instant system. Finally, when performing each job, this is done according to the actual frequency corresponding to this work. Thereby, the invention can have Effectively reduce the processor frequency of the electronic device in the non-sleep mode, thereby saving power consumption.

雖然本發明已以實施例揭露如上,然其並非用以限定本發明,任何所屬技術領域中具有通常知識者,在不脫離本發明之精神和範圍內,當可作些許之更動與潤飾,因此本發明之保護範圍當視後附之申請專利範圍所界定者為準。Although the present invention has been disclosed in the above embodiments, it is not intended to limit the invention, and any one of ordinary skill in the art can make some modifications and refinements without departing from the spirit and scope of the invention. The scope of the invention is defined by the scope of the appended claims.

100‧‧‧電子裝置100‧‧‧Electronic devices

110‧‧‧處理器110‧‧‧ processor

120‧‧‧記憶體120‧‧‧ memory

130‧‧‧供電單元130‧‧‧Power supply unit

S201~S211‧‧‧本發明一實施例之頻率調整方法的各步驟S201~S211‧‧‧ steps of the frequency adjustment method according to an embodiment of the present invention

S301~S313‧‧‧步驟S207中的各步驟S301~S313‧‧‧Steps in step S207

T1、T2、T3‧‧‧工作T1, T2, T3‧‧ work

圖1繪示為本發明一實施例之電子裝置的方塊圖。FIG. 1 is a block diagram of an electronic device according to an embodiment of the invention.

圖2繪示為本發明一實施例之頻率調整方法的流程圖。2 is a flow chart of a frequency adjustment method according to an embodiment of the present invention.

圖3繪示為圖2之步驟S207的詳細步驟流程圖。FIG. 3 is a flow chart showing the detailed steps of step S207 of FIG. 2.

圖4A繪示為一種在各工作的頻率未調整之前的工作排程示意圖。FIG. 4A is a schematic diagram of a work schedule before the frequency of each work is not adjusted.

圖4B繪示為本發明一實施例之各工作的頻率調整之後的工作排程示意圖。FIG. 4B is a schematic diagram of the work schedule after the frequency adjustment of each operation according to an embodiment of the present invention.

S201~S209‧‧‧本發明一實施例之頻率調整方法的各步驟S201~S209‧‧‧ steps of the frequency adjustment method according to an embodiment of the present invention

Claims (19)

一種頻率調整方法,適用於一即時系統之一工作排程,該頻率調整方法包括:取得多個工作,並於一預設時間內,執行該些工作,其中每一該些工作於該預設時間內至少被執行一次;統計每一該些工作的執行次數、執行時間以及等待時間;依據該預設時間與該些工作的執行次數、執行時間以及等待時間,計算該些工作的週期與時限;依據該些工作的執行時間、週期與時限,利用一演算法計算每一該些工作的理想頻率,並將該些工作的理想頻率各自對應至該即時系統之處理器的一實際頻率及一時脈分割值;以及當執行每一該些工作時,依據該工作對應的該實際頻率來執行該工作,其中該些工作的週期與時限的計算方式為,其中T為該預設時間,fi 為該些工作的執行次數,Ci 為該些工作的執行時間,Wi 為該些工作的等待時間,i為大於等於1的正整數,n為該些工作的數量。A frequency adjustment method is applicable to a work schedule of an instant system, the frequency adjustment method includes: obtaining a plurality of jobs, and performing the work within a preset time, wherein each of the work is performed on the preset The time is executed at least once; the number of executions, the execution time, and the waiting time of each of the jobs are counted; and the period and time limit of the work are calculated according to the preset time, the number of executions of the jobs, the execution time, and the waiting time. According to the execution time, the period and the time limit of the work, an algorithm is used to calculate the ideal frequency of each of the work, and the ideal frequencies of the work are respectively corresponding to an actual frequency of the processor of the instant system and a time a pulse split value; and when performing each of the jobs, performing the work according to the actual frequency corresponding to the work, wherein the period and time limit of the work are calculated Where T is the preset time, fi is the number of executions of the jobs, Ci is the execution time of the jobs, Wi is the waiting time for the jobs, i is a positive integer greater than or equal to 1, and n is the work quantity. 如申請專利範圍第1項所述之頻率調整方法,其中利用該演算法計算每一該些工作的理想頻率的步驟包括:計算該些工作的最小時脈頻率; 依據該些工作的最小時脈頻率,計算該些工作的理頻頻率;依據該些工作的優先權先後,判斷優先權較後的一第二筆工作的理想頻率是否小於優先權較先的一第一筆工作的理想頻率;以及若該第二筆工作的理想頻率小於該第一筆工作的理想頻率,依據該第二筆工作的一最大執行時間,調整該第二筆工作的理想頻率。 The frequency adjustment method of claim 1, wherein the calculating the ideal frequency of each of the operations by using the algorithm comprises: calculating a minimum clock frequency of the operations; Calculating the frequency of the work according to the minimum clock frequency of the work; according to the priority of the work, determining whether the ideal frequency of the second work after the priority is less than the priority first The ideal frequency of the first work; and if the ideal frequency of the second work is less than the ideal frequency of the first work, the ideal frequency of the second work is adjusted according to a maximum execution time of the second work. 如申請專利範圍第2項所述之頻率調整方法,其中計算該些工作的理想頻率的步驟包括:依據該些工作的多個優先權順序,依序由優先權順序最優先的該工作進行計算,且每一該些工作的理想頻率是取優先權順序後於或等於其優先權順序之該些工作的最小時脈頻率的最大值。 The frequency adjustment method of claim 2, wherein the calculating the ideal frequency of the work comprises: calculating, according to the plurality of priority orders of the work, the work with the highest priority in the priority order And the ideal frequency of each of the jobs is the maximum value of the minimum clock frequency of the operations after taking the priority order at or equal to its priority order. 如申請專利範圍第1項所述之頻率調整方法,其中將該些工作的理想頻率各自對應至該處理器的該些實際頻率的步驟之後更包括:將每一該些時脈分割值儲存到對應的該工作的時脈分割值屬性欄位;以及在執行該工作時,依照該工作的該時脈分割值屬性欄位變動該處理器的執行頻率。 The frequency adjustment method of claim 1, wherein the step of respectively matching the ideal frequencies of the operations to the actual frequencies of the processor further comprises: storing each of the clock segmentation values to Corresponding clock segmentation value attribute field of the work; and when performing the work, the execution frequency of the processor is changed according to the clock segmentation value attribute field of the work. 如申請專利範圍第1項所述之頻率調整方法,其中每一該些工作的週期與該工作的時限相同。 The frequency adjustment method of claim 1, wherein the period of each of the operations is the same as the time limit of the work. 如申請專利範圍第1項所述之頻率調整方法,其中在依據該工作對應的該實際頻率來執行該工作的步驟包括:當調降該即時系統之處理器的一工作電壓與該即時系統之處理器的該實際頻率時,先調降該實際頻率後,再調降該工作電壓;以及當調升該即時系統之處理器的該工作電壓與該即時系統之處理器的該實際頻率時,先調升該工作電壓後,再調升該實際頻率。 The frequency adjustment method of claim 1, wherein the step of performing the work according to the actual frequency corresponding to the work comprises: when lowering an operating voltage of the processor of the instant system and the real-time system At the actual frequency of the processor, after the actual frequency is first lowered, the operating voltage is further reduced; and when the operating voltage of the processor of the instant system is increased and the actual frequency of the processor of the instant system is After the operating voltage is first raised, the actual frequency is increased. 一種電子裝置,包括:一處理器,取得多個工作後,並於一預設時間內執行該些工作,以統計出每一該些工作的執行次數、執行時間以及等待時間,再依據該預設時間與該些工作的執行次數、執行時間以及等待時間,計算出該些工作的週期與時限,之後再依據該些工作的執行時間、週期與時限計算該些工作的理想頻率,並將該些工作的理想頻率各自對應至該處理器的一實際頻率及一時脈分割值,以利用該些實際頻率執行該些工作;一記憶體,耦接於該處理器,儲存該些工作的執行次數、執行時間以及等待時間與該些工作的週期與時限;以及一供電單元,提供該電子裝置的一工作電源,其中該些工作的週期與時限的計算方式為,其中T為該預設時間,fi 為該些工 作的執行次數,Ci 為該些工作的執行時間,Wi 為該些工作的等待時間,i為大於等於1的正整數,n為該些工作的數量。An electronic device includes: a processor, after obtaining a plurality of jobs, and performing the work within a preset time, to count the execution times, execution times, and waiting times of each of the jobs, and then according to the pre- Setting the time, execution time, and waiting time of the work, calculating the period and time limit of the work, and then calculating the ideal frequency of the work according to the execution time, the period and the time limit of the work, and The ideal frequencies of the operations respectively correspond to an actual frequency of the processor and a clock split value to perform the work by using the actual frequencies; a memory coupled to the processor to store the number of executions of the jobs And an execution time and a waiting time and a period and a time limit of the work; and a power supply unit providing a working power source of the electronic device, wherein the period and the time limit of the working are calculated Where T is the preset time, fi is the number of executions of the jobs, Ci is the execution time of the jobs, Wi is the waiting time for the jobs, i is a positive integer greater than or equal to 1, and n is the work quantity. 如申請專利範圍第7項所述之電子裝置,其中該處理器更計算該些工作的最小時脈頻率,並依據該些工作的最小時脈頻率,計算該些工作的理頻頻率,再依據該些工作的優先權先後,判斷優先權較後的一第二筆工作的理想頻率是否小於優先權較先的一第一筆工作的理想頻率,之後若該第二筆工作的理想頻率小於該第一筆工作的理想頻率,依據該第二筆工作的一最大執行時間,調整該第二筆工作的理想頻率。 The electronic device of claim 7, wherein the processor further calculates a minimum clock frequency of the operations, and calculates a frequency of the working frequency according to the minimum clock frequency of the operations, and then according to The priorities of the work are successively determined whether the ideal frequency of the second work after the priority is less than the ideal frequency of the first work of the first priority, and then the ideal frequency of the second work is less than the ideal frequency. The ideal frequency of the first work, according to a maximum execution time of the second work, adjust the ideal frequency of the second work. 如申請專利範圍第8項所述之電子裝置,其中該處理器更依據該些工作的多個優先權順序,依序由優先權順序最優先的該工作進行計算,且每一該些工作的理想頻率是取優先權順序後於或等於其優先權順序之該些工作的最小時脈頻率的最大值。 The electronic device of claim 8, wherein the processor further calculates, according to the plurality of priority orders of the work, the work with the highest priority in the priority order, and each of the work The ideal frequency is the maximum value of the minimum clock frequency of the operations after taking the priority order at or equal to its priority order. 如申請專利範圍第7項所述之電子裝置,其中該處理器將每一時脈分割值儲存到該記憶體中對應每一該些工作的時脈分割值屬性欄位,並且該處理器在執行該工作時,依照該記憶體所儲存之該工作的該時脈分割值屬性欄位變動該處理器的執行頻率。 The electronic device of claim 7, wherein the processor stores each clock segmentation value into a clock segmentation value attribute field corresponding to each of the jobs in the memory, and the processor is executing In this operation, the execution frequency of the processor is changed according to the clock segmentation value attribute field of the job stored in the memory. 如申請專利範圍第7項所述之電子裝置,其中每一該些工作的週期與該工作的時限相同。 The electronic device of claim 7, wherein each of the working cycles is the same as the working time. 如申請專利範圍第7項所述之電子裝置,其中當該處理器無工作處理時,則該電子裝置進入休眠模式。 The electronic device of claim 7, wherein when the processor is not in operation, the electronic device enters a sleep mode. 如申請專利範圍第7項所述之電子裝置,其中在該處理器利用該些實際頻率執行該些工作時,若要調降該處理器的實際頻率與該處理器的工作電壓,則先調降該處理器的實際頻率後,再調降該處理器的工作電壓,而若要調升該處理器的實際頻率與該處理器的工作電壓,先調升該處理器的工作電壓後,再調升該處理器的實際頻率。 The electronic device of claim 7, wherein when the processor performs the operations by using the actual frequencies, if the actual frequency of the processor and the operating voltage of the processor are to be lowered, the first adjustment is performed. After lowering the actual frequency of the processor, the operating voltage of the processor is further lowered, and if the actual frequency of the processor and the operating voltage of the processor are to be increased, the operating voltage of the processor is first increased, and then Increase the actual frequency of the processor. 一種電腦程式產品,經由一電腦載入該程式執行下列步驟:取得多個工作,並於一預設時間內,執行該些工作,其中每一該些工作於該預設時間內至少被執行一次;統計每一該些工作的執行次數、執行時間以及等待時間;依據該預設時間與該些工作的執行次數、執行時間以及等待時間,計算該些工作的週期與時限;依據該些工作的執行時間、週期與時限,利用一演算法計算每一該些工作的理想頻率,並將該些工作的理想頻率各自對應至該即時系統之處理器的一實際頻率及一時脈分割值;以及當執行每一該些工作時,依據該工作對應的該實際頻率來執行該工作,其中該些工作的週期與時限計算方式為,其中T為該預設時間,fi 為該些工 作的執行次數,Ci 為該些工作的執行時間,Wi 為該些工作的等待時間,i為大於等於1的正整數,n為該些工作的數量。A computer program product, the program is loaded via a computer to perform the following steps: obtaining a plurality of jobs, and performing the work within a preset time, wherein each of the jobs is executed at least once within the preset time Calculating the number of executions, execution time, and waiting time of each of the jobs; calculating the period and time limit of the work according to the preset time, the number of executions of the jobs, the execution time, and the waiting time; Execution time, period and time limit, using an algorithm to calculate the ideal frequency of each of the tasks, and correspondingly corresponding frequencies of the operations to an actual frequency and a clock segmentation value of the processor of the instant system; When performing each of the tasks, the work is performed according to the actual frequency corresponding to the work, wherein the period and time limit of the work are calculated as Where T is the preset time, fi is the number of executions of the jobs, Ci is the execution time of the jobs, Wi is the waiting time for the jobs, i is a positive integer greater than or equal to 1, and n is the work quantity. 如申請專利範圍第14項所述之電腦程式產品,其中利用該演算法計算每一該些工作的理想頻率的步驟包括:計算該些工作的最小時脈頻率;依據該些工作的最小時脈頻率,計算該些工作的理頻頻率;依據該些工作的優先權先後,判斷優先權較後的一第二筆工作的理想頻率是否小於優先權較先的一第一筆工作的理想頻率;以及若該第二筆工作的理想頻率小於該第一筆工作的理想頻率,依據該第二筆工作的一最大執行時間,調整該第二筆工作的理想頻率。 The computer program product of claim 14, wherein the calculating the ideal frequency of each of the operations by using the algorithm comprises: calculating a minimum clock frequency of the operations; and determining a minimum clock according to the operations Frequency, calculating the frequency of the work of the work; according to the priority of the work, determining whether the ideal frequency of the second work after the priority is less than the ideal frequency of the first work of the priority; And if the ideal frequency of the second work is less than the ideal frequency of the first work, the ideal frequency of the second work is adjusted according to a maximum execution time of the second work. 如申請專利範圍第15項所述之電腦程式產品,其中計算該些工作的理想頻率的步驟包括:依據該些工作的多個優先權順序,依序由優先權順序最優先的該工作進行計算,且每一該些工作的理想頻率是取優先權順序後於或等於其優先權順序之該些工作的最小時脈頻率的最大值。 The computer program product of claim 15, wherein the calculating the ideal frequency of the work comprises: calculating, according to the plurality of priority orders of the work, the work with the highest priority in the priority order And the ideal frequency of each of the jobs is the maximum value of the minimum clock frequency of the operations after taking the priority order at or equal to its priority order. 如申請專利範圍第14項所述之電腦程式產品,其中將該些工作的理想頻率各自對應至該處理器的該些實際頻率及該些時脈分割值的步驟之後更包括: 將每一該些時脈分割值儲存到對應的該工作的時脈分割值屬性欄位;以及在執行該工作時,依照該工作的該時脈分割值屬性欄位變動該處理器的執行頻率。 The computer program product of claim 14, wherein the steps of the actual frequencies of the operations corresponding to the actual frequencies of the processor and the clock splitting values further comprise: And storing each of the clock segmentation values into a corresponding clock segmentation value attribute field of the work; and when performing the work, changing the execution frequency of the processor according to the clock segmentation value attribute field of the work . 如申請專利範圍第14項所述之電腦程式產品,其中每一該些工作的週期與該工作的時限相同。 For example, in the computer program product described in claim 14, wherein the period of each of the jobs is the same as the time limit of the work. 如申請專利範圍第14項所述之電腦程式產品,其中在依據該工作對應的該實際頻率來執行該工作的步驟包括:當調降該即時系統之處理器的一工作電壓與該即時系統之處理器的該實際頻率時,先調降該實際頻率後,再調降該工作電壓;以及當調升該即時系統之處理器的該工作電壓與該即時系統之處理器的該實際頻率時,先調升該工作電壓後,再調升該實際頻率。 The computer program product of claim 14, wherein the step of performing the work according to the actual frequency corresponding to the work comprises: when adjusting a working voltage of the processor of the instant system and the instant system At the actual frequency of the processor, after the actual frequency is first lowered, the operating voltage is further reduced; and when the operating voltage of the processor of the instant system is increased and the actual frequency of the processor of the instant system is After the operating voltage is first raised, the actual frequency is increased.
TW97141229A 2008-10-27 2008-10-27 Method for adjusting frequency and electronic apparatus and computer program product using the method TWI387866B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
TW97141229A TWI387866B (en) 2008-10-27 2008-10-27 Method for adjusting frequency and electronic apparatus and computer program product using the method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW97141229A TWI387866B (en) 2008-10-27 2008-10-27 Method for adjusting frequency and electronic apparatus and computer program product using the method

Publications (2)

Publication Number Publication Date
TW201017361A TW201017361A (en) 2010-05-01
TWI387866B true TWI387866B (en) 2013-03-01

Family

ID=44830804

Family Applications (1)

Application Number Title Priority Date Filing Date
TW97141229A TWI387866B (en) 2008-10-27 2008-10-27 Method for adjusting frequency and electronic apparatus and computer program product using the method

Country Status (1)

Country Link
TW (1) TWI387866B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI766514B (en) * 2020-12-30 2022-06-01 新唐科技股份有限公司 Electronic device and powering method thereof

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI766514B (en) * 2020-12-30 2022-06-01 新唐科技股份有限公司 Electronic device and powering method thereof

Also Published As

Publication number Publication date
TW201017361A (en) 2010-05-01

Similar Documents

Publication Publication Date Title
Ghor et al. A real-time scheduling framework for embedded systems with environmental energy harvesting
US8190939B2 (en) Reducing power consumption of computing devices by forecasting computing performance needs
Gu et al. Energy efficient scheduling of servers with multi-sleep modes for cloud data center
TWI477957B (en) Apparatus including a processor core, method of operating a processor and non-transitory computer readable medium
CN101379453A (en) Method and apparatus for using dynamic workload characteristics to control CPU frequency and voltage scaling
JP6104144B2 (en) Multi-mode optimization of device power saving
KR100661851B1 (en) Power management method for platform and that platform
CN104049716B (en) Computer energy-saving method and system combined with temperature sensing
CN102759984A (en) Power supply and performance management system for virtualization server cluster
CN110832434A (en) Core frequency management using efficient utilization for energy saving performance
CN113377619B (en) A server motherboard monitoring management system and method based on FPGA
JPWO2005106623A1 (en) CPU clock control device, CPU clock control method, CPU clock control program, recording medium, and transmission medium
CN104756043B (en) System and method for controlling central processing unit power with guaranteed transient deadlines
KR102060431B1 (en) Apparatus and method for managing power in multi-core system
TWI387866B (en) Method for adjusting frequency and electronic apparatus and computer program product using the method
CN104111876A (en) Dynamic resource management device and method based on Oracle resource plan
ul Islam et al. A framework for learning based DVFS technique selection and frequency scaling for multi-core real-time systems
WO2022041251A1 (en) Power budget allocation method and related device
TWI394027B (en) Method for adjusting frequency and computer program product using the method
CN105706022A (en) Method for predicting utilization rate of processor, processing apparatus and terminal device
Abbas et al. A real-time feedback scheduler for environmental energy with discrete voltage/frequency modes
Shih et al. An adaptive hybrid dynamic power management algorithm for mobile devices
CN116028193A (en) A method and system for dynamic and energy-efficient scheduling of big data tasks in mixed clusters
Chen et al. A dynamic adjustment mechanism with heuristic for thread pool in middleware
Digalwar et al. Dynamicvoltage and frequency scaling scheduling algorithm for mixed task set

Legal Events

Date Code Title Description
MM4A Annulment or lapse of patent due to non-payment of fees