JP5406549B2 - Program conversion method and apparatus - Google Patents
Program conversion method and apparatus Download PDFInfo
- Publication number
- JP5406549B2 JP5406549B2 JP2009029750A JP2009029750A JP5406549B2 JP 5406549 B2 JP5406549 B2 JP 5406549B2 JP 2009029750 A JP2009029750 A JP 2009029750A JP 2009029750 A JP2009029750 A JP 2009029750A JP 5406549 B2 JP5406549 B2 JP 5406549B2
- Authority
- JP
- Japan
- Prior art keywords
- program
- section
- execution
- unit
- code
- 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.)
- Expired - Fee Related
Links
Images
Description
本発明は、与えられたプログラムのソースコードを変換するプログラム変換方法、及び装置に関する。 The present invention relates to a program conversion method and apparatus for converting a source code of a given program.
従来、プログラム変換の技術において、プログラムの指定区間に対して性能指標を与えることにより、該当区間を自動的にタスク(即ち、OS(オペレーティングシステムのこと。以下同じ)のスケジューリングの単位になっている)に分割して性能指標を付加する、プログラム変換方法、及び装置を提供することを目的とした提案が知られている。該提案の概要は、区間及び指標取得手段が、プログラムに埋め込まれた区間を表す区間コードと、該区間コードに関連付けて該プログラムに埋め込まれた性能指標情報とを取得し、タスクコード変換手段が、上記区間及び指標取得手段が取得した区間コードを、タスクコードとして分離し、タスク先頭を示すコードと、タスク終端を示すコードとを追加する。そして、タスク指標付加手段が、スケジューラに入力するための性能指標をタスクに付加するようになっている(例えば特許文献1参照)。また、OSのスケジューラに対する付加機能として、タスクに割り当てるべきCPU資源の利用率を指定すると、その性能を確保することを可能にする機構に係る技術についても知られている(例えば非特許文献1参照)。 Conventionally, in the program conversion technique, by giving a performance index to a specified section of a program, the section is automatically set as a unit for scheduling a task (that is, OS (operating system; the same applies hereinafter)). The proposal for the purpose of providing a program conversion method and apparatus that add a performance index by dividing the data into (1) is known. The outline of the proposal is that a section and index acquisition means acquires a section code representing a section embedded in the program and performance index information embedded in the program in association with the section code, and the task code conversion means The section code acquired by the section and the index acquisition means is separated as a task code, and a code indicating the task head and a code indicating the task end are added. The task index adding means adds a performance index to be input to the scheduler to the task (see, for example, Patent Document 1). Further, as an additional function to the scheduler of the OS, a technique related to a mechanism that makes it possible to ensure the performance of a CPU resource to be allocated to a task is also known (see, for example, Non-Patent Document 1). ).
マルチタスク環境下においては、複数のタスクが同一のCPUを共有した状態で、各々のタスクに係わる処理が実行される。即ち、CPUの処理能力を時分割し、各々のタスクに対しCPU資源を割り当てることにより、それら複数のタスクを同時に実行することが可能になる。一般的には、各々のタスクにCPU資源を割り当てるスケジューラ機能が、OSの機能として提供されている。同一のCPUを複数のタスクで共有しているマルチタスク環境下では、プログラムの全体、若しくは該プログラムの或る区間に対し、実行を開始してから該実行を終了するまでの実時間である実行時間は、該区間における実行開始から実行終了までに該プログラムがCPUを使用した時間である計算時間よりも長くなる。スケジューラにより各々のタスクに割り当てられるCPU資源量は、該プログラムの実行時の環境により左右されるため(他のタスクの処理が割り込んでくるため)、同一の計算時間、若しくは同一の計算量であっても、該プログラムの実行時間は状況に応じて変動することになる。 Under a multitasking environment, processing related to each task is executed in a state where a plurality of tasks share the same CPU. That is, by dividing the CPU processing capacity in time and allocating CPU resources to each task, it becomes possible to execute the plurality of tasks simultaneously. Generally, a scheduler function for allocating CPU resources to each task is provided as an OS function. In a multitasking environment where the same CPU is shared by multiple tasks, execution is the real time from the start of execution to the end of execution for the entire program or a certain section of the program The time is longer than the calculation time, which is the time that the program used the CPU from the start of execution to the end of execution in the section. The amount of CPU resources allocated to each task by the scheduler depends on the environment at the time of execution of the program (because processing of other tasks is interrupted), so it has the same calculation time or the same calculation amount. Even so, the execution time of the program varies depending on the situation.
特に、ディジタル放送受信機のような組込みシステムの場合には、プログラムのリアルタイム性が要求される。プログラムのリアルタイム性とは、該プログラムの実行時間に関わる性質であり、例えば、該プログラム中の特定の区間における実行時間が、予め定められた時間内に収まるような性質のことを指す。上述したディジタル放送受信機のような映像表示処理機器においては、映像表示のためのプログラムの実行を一定時間内に終了させることができない場合には、該映像表示処理機器からの出力映像に乱れが発生することになるので、プログラムのリアルタイム性を維持することが重要である。 In particular, in the case of an embedded system such as a digital broadcast receiver, real-time performance of the program is required. The real-time property of a program is a property related to the execution time of the program, for example, a property that the execution time in a specific section in the program falls within a predetermined time. In a video display processing device such as the digital broadcast receiver described above, if the execution of a program for video display cannot be completed within a certain time, the output video from the video display processing device is disturbed. It is important to maintain the real-time nature of the program.
しかし、上述したような複数のタスクが同一CPUを共有した状態で各々が動作しているような状況下においては、上記のように、スケジューラにより割り当てられるCPU資源は、プログラムの実行時の環境により左右されるため、プログラムのリアルタイム性を維持するのは困難である。そこで、プログラムに対し、CPU資源利用率という態様で性能指標を与えることにより、各々のタスクに対して割り当てられるCPU資源を確保するための技術が提案されている。上述した特許文献1として開示されている技術や、非特許文献1として開示されている技術がそれである。
However, in a situation where a plurality of tasks as described above are operating with the same CPU being shared, as described above, the CPU resource allocated by the scheduler depends on the environment when the program is executed. Because of this, it is difficult to maintain the real-time nature of the program. Therefore, a technique has been proposed for ensuring the CPU resources allocated to each task by giving a performance index to the program in the form of CPU resource utilization. This is the technique disclosed as
ところで、上述した特許文献1や、非特許文献1に開示されているような技術を採用した場合に、プログラムの実行のために割り当てられるCPU資源の利用率という態様で、プログラムが具備している性能を確保することはできるが、プログラム、若しくは該プログラム中の特定の区間に対する実行時間という態様で性能指標が与えられた場合においては、該プログラムが具備する性能を維持することができないという問題が生じる。また、従来の技術に含まれるCPU資源利用率の確保に係わる手法を採用して、上述した実行時間に関するプログラムの性能の維持を実現しようとした場合、確保したCPU資源の量が、適切なCPU資源利用率に満たなければ、該プログラムについての指定された実行時間に係わる性能指標を維持できないという状況が発生する虞もある。一方、確保したCPU資源の量が、適切なCPU資源利用率よりも過剰であれば、該タスク以外のタスクに割り当てるCPU資源量が減少し、その結果として、他のタスクに関して応答性の低下を惹き起こす可能性が生じる。
By the way, when the technology disclosed in
プログラムの計算量は、プログラムの内部状態や、外部から組み込みシステムへ入力される各種のデータ等により、同一のプログラムであっても、実行する時期に応じて変動することが知られている。上記のようにプログラムの計算量が変動すると、性能指標として与えられた実行時間内に該プログラム中の特定の区間を実行しなければならないために、該特定の区間を実行するのに適切なCPU資源量も変動するから、上述したように適切なCPU資源利用率を事前に求めることも困難になる。 It is known that the amount of calculation of a program varies depending on the execution time of the same program, depending on the internal state of the program, various data input to the embedded system from the outside, and the like. When the calculation amount of the program fluctuates as described above, a specific section in the program must be executed within the execution time given as a performance index. Therefore, a CPU suitable for executing the specific section Since the resource amount also fluctuates, it becomes difficult to obtain an appropriate CPU resource utilization rate in advance as described above.
従って本発明の目的は、マルチタスク環境下において、プログラムに対し、指定された実行時間に係わる性能指標を維持することができ、且つ、特定のタスクがCPU資源を過剰に占有するのを防止できるような性能確保プログラムを自動的に生成できるようにすることにある。 Accordingly, an object of the present invention is to maintain a performance index related to a specified execution time for a program in a multitasking environment, and to prevent a specific task from occupying excessive CPU resources. The purpose is to automatically generate such a performance ensuring program.
本発明の第1の観点に従うプログラム変換装置は、与えられたプログラムのソースコードを変換するもので、上記プログラムの性能指標が与えられる、上記プログラムの或る区間内の1箇所、若しくは複数箇所からその区間の終端までの間の実行に要する時間の最大値を算出する実行時間算出部と、上記実行時間算出部により算出された実行時間の最大値と、上記性能指標とから、上記プログラムが起動するCPUにおいて上記1箇所、若しくは複数箇所からその区間の終端までの間の実行のために確保すべきCPU資源割合を求める機能を、上記プログラムのソースコードに付与する機能付与部と、上記機能付与部により上記CPU資源割合を求める機能が付与されたプログラムのソースコードを、上記求めたCPU資源割合を確保するプログラムに変換するプログラム変換部と、を備える。 The program conversion apparatus according to the first aspect of the present invention converts a source code of a given program, and is provided with a performance index of the program from one place or a plurality of places in a certain section of the program. The program is started from the execution time calculation unit that calculates the maximum time required for execution until the end of the section, the maximum execution time calculated by the execution time calculation unit, and the performance index. A function adding unit that gives a function for obtaining a CPU resource ratio to be secured for execution from the one or more places to the end of the section in the CPU to be executed, and the function addition The source code of the program to which the function for determining the CPU resource ratio is given by the section is allocated to the program that secures the calculated CPU resource ratio. Comprising a program conversion unit that converts the grams, the.
本発明の第1の観点に係る好適な実施形態では、上記プログラムの性能指標が与えられる上記プログラムの或る区間内において、上記プログラムの計算量に変動を及ぼす原因が生じたかどうかを検知する変動原因検知部、を更に備え、上記プログラムの或る区間内の1箇所、若しくは複数箇所が、上記変動原因検知部により検知された上記変動を及ぼす原因が存在する位置である。 In a preferred embodiment according to the first aspect of the present invention, in certain the section of the program performance index of the program is given, for detecting whether the cause on the variation in the calculated amount of the program has occurred A variation cause detection unit is further provided, and one or a plurality of locations in a certain section of the program is a position where the cause of the variation detected by the variation cause detection unit exists.
上記とは別の実施形態では、上記変動を及ぼす原因が、上記区間内に存在する条件分岐の分岐先である。 In an embodiment different from the above, the cause of the fluctuation is a branch destination of a conditional branch existing in the section.
また、上記とは別の実施形態では、上記変動を及ぼす原因が、上記区間内に存在するループであり、上記1箇所、若しくは複数箇所が、上記区間内における上記ループのループ回数の確定箇所以降の箇所を含む。 In another embodiment different from the above, the cause of the fluctuation is a loop existing in the section, and the one place or a plurality of places are after the determined number of loops of the loop in the section. This part is included.
また、上記とは別の実施形態では、上記実行時間算出部が、上記変動原因検知部により検知された上記区間内に存在する上記確定したループ回数に応じた実行時間の最大値を求める。 In another embodiment different from the above, the execution time calculation unit obtains the maximum value of the execution time according to the determined number of loops existing in the section detected by the variation cause detection unit.
また、上記とは別の実施形態では、上記実行時間算出部が、上記プログラムの上記区間の実行に要する時間を求めるためのプロファイル取得用コードを生成する生成部と、上記生成部により生成されたプロファイル取得用コードを実行する実行部と、上記実行部による上記プロファイル取得用コードの実行により取得したプロファイルデータから、上記実行時間の最大値を算出する算出部と、
を備える。
In another embodiment different from the above, the execution time calculation unit is generated by the generation unit that generates a profile acquisition code for obtaining the time required to execute the section of the program, and generated by the generation unit. An execution unit that executes a profile acquisition code; a calculation unit that calculates a maximum value of the execution time from profile data acquired by executing the profile acquisition code by the execution unit;
Is provided.
更に、上記とは別の実施形態では、上記性能指標が、上記プログラムの上記区間の実行に要する時間である。 Further, in another embodiment different from the above, the performance index is a time required for executing the section of the program.
本発明の第2の観点に従うプログラム変換方法は、与えられたプログラムのソースコードを変換するもので、上記プログラムの性能指標が与えられる、上記プログラムの或る区間内の1箇所、若しくは複数箇所からその区間の終端までの間の実行に要する時間の最大値を算出する第1のステップと、上記第1のステップにおいて算出された実行時間の最大値と、上記性能指標とから、上記プログラムが起動するCPUにおいて上記1箇所、若しくは複数箇所からその区間の終端までの間の実行のために確保すべきCPU資源割合を求める機能を、上記プログラムのソースコードに付与する第2のステップと、上記第2のステップにおいて上記CPU資源割合を求める機能が付与されたプログラムのソースコードを、上記求めたCPU資源割合を確保するプログラムに変換する第3のステップと、を備える。
The program conversion method according to the second aspect of the present invention converts the source code of a given program, from one place or a plurality of places in a certain section of the program to which the performance index of the program is given. The program is started from the first step of calculating the maximum time required for execution until the end of the section, the maximum value of the execution time calculated in the first step, and the performance index. A second step of adding to the source code of the program a function for obtaining a CPU resource ratio to be secured for execution from the one or more locations to the end of the section in the CPU The source code of the program to which the function for obtaining the CPU resource ratio in
本発明によれば、マルチタスク環境下において、プログラムに対し、指定された実行時間に係わる性能指標を維持することができ、且つ、特定のタスクがCPU資源を過剰に占有するのを防止できるような性能確保プログラムを自動的に生成することが可能になる。 According to the present invention, it is possible to maintain a performance index related to a specified execution time for a program in a multitasking environment, and to prevent a specific task from occupying excessive CPU resources. It is possible to automatically generate a performance guarantee program.
以下、本発明の実施の形態を、図面により詳細に説明する。 Hereinafter, embodiments of the present invention will be described in detail with reference to the drawings.
図1は、本発明の一実施形態に係るプログラム変換装置が組み込まれるシステム(以下の説明では、「組込みシステム」と表記する。)の全体構成の一例を示す機能ブロック図である。以下の説明では、組込みシステムとして、ディジタル放送受信システムを例に挙げる。 FIG. 1 is a functional block diagram illustrating an example of the overall configuration of a system in which a program conversion apparatus according to an embodiment of the present invention is incorporated (hereinafter, referred to as “embedded system”). In the following description, a digital broadcast receiving system is taken as an example of an embedded system.
図1に示すように、上記ディジタル放送受信システム100は、ディジタル放送受信機本体(以下、「受信機本体」と表記する。)1と、リモートコントローラ(以下、「リモコン」と表記する。)3と、アンテナ5と、表示装置7と、プログラム変換装置9と、を含む。受信機本体1は、記憶装置11と、プロセッサ13と、信号受信部15と、ディジタル放送チューナ17と、を備える。
As shown in FIG. 1, the digital
リモコン3には、受信機本体1に対し、種々の動作指令信号を送出するための複数のキー(図示しない)が配置された操作部(図示しない)が備えられている。ユーザが上記複数のキー(図示しない)の何れかを操作することにより、リモコン3において動作指令信号が生成されると、リモコン3は、例えば、該動作指令信号が重畳された赤外光を受信機本体1に向かって放射することで、該動作指令信号を、受信機本体1に送信する。
The
アンテナ5は、放送局(図示しない)から送出されるディジタル放送信号波を受信したことに起因して生成される電気信号を、受信機本体1へ出力する。表示装置7は、受信機本体1側からの表示出力に応じて画像情報を可視画像として表示する。
The
受信機本体1において、記憶装置11は、プロセッサ13の制御下で、ディジタル放送受信機ソフトウェア19に含まれる各種のプログラムのうちの、プログラム変換装置9において性能確保プログラムに変換される処理が施された後のプログラム(以下、「変換プログラム」と表記する)と、上記変換処理が施されていないプログラムと、を共に格納する。なお、ディジタル放送受信機ソフトウェア19には、リモートコントローラタスク(以下、「リモコンタスク」と表記する。)21と、チューナタスク23と、映像デコードタスク25と、音声デコードタスク27と、データ放送ブラウザタスク29と、が含まれる。
In the receiver
ディジタル放送受信機ソフトウェア19において、リモコンタスク21は、ユーザによるリモコン3の操作に基づく動作指令(信号)に対応した該動作指令(信号)の受信処理を実行する機能を有する。この受信処理に対する適切な応答処理を個別に実行するためのプログラムとして、チューナタスク23、映像デコードタスク25、音声デコードタスク27、及びデータ放送ブラウザタスク29が夫々存在している。
In the digital
即ち、チューナタスク23は、ユーザによる(リモコン3の操作を介した)選局指令に基づく(受信機本体1の)ディジタル放送チューナ17における選局動作に伴って起動し、受信番組の切り替え処理を実行する機能を有する。映像デコードタスク25は、起動することにより、ディジタル放送チューナ17を介してチューナタスク23が受信したディジタル放送信号波に含まれる映像情報のデコード処理を実行する機能を有する。音声デコードタスク27は、起動することにより、ディジタル放送チューナ17を介してチューナタスク23が受信したディジタル放送信号波に含まれる音声情報のデコード処理を実行する機能を有する。データ放送ブラウザタスク29は、起動することにより、(ディジタル放送チューナ17から)データ放送コンテンツを取得する機能と、該取得したデータ放送コンテンツに復号化処理を施す機能と、を有する。上記プログラムのうちの、チューナタスク23と、映像デコードタスク25と、音声デコードタスク27とが、上記変換プログラムに該当し、残りのリモコンタスク21、及びデータ放送ブラウザタスク29が、上記性能確保プログラムへの変換処理が施されていないプログラムである。
That is, the
上記性能確保プログラムとして記憶装置11に記憶されるプログラムのうちの、映像デコードタスク25、及び音声デコードタスク27については、画像情報や、音声情報を途切れないようにして出力することが要求されるため、(画像情報の)フレームレートにより決まる時間内に、夫々のデコード処理を完了させなければならないという時間的な制約がある。また、上記性能確保プログラムとして記憶装置11に記憶されるプログラムのうちの、チューナタスク23についても、受信機本体1が、アンテナ5を介して受信したディジタル放送信号波から画像情報や、音声情報を取り出す処理を実行する時間に対して制約が課せられる。そこで、本実施形態においては、ディジタル放送受信機ソフトウェア19に含まれる各種のプログラムのうちの、リアルタイム性を有するタスクである、チューナタスク23、映像デコードタスク25、及び音声デコードタスク27については、プログラム変換装置9において性能確保プログラムに変換された上で、記憶装置11に記憶されるようにしている。
Of the programs stored in the
一方、リモコンタスク21、及びデータ放送ブラウザタスク29については、決められた時間内に夫々が実行すべき処理動作を完了しなければならないという明確な制約は存在しないので、上述したチューナタスク23、映像デコードタスク25、及び音声デコードタスク27とは異なり、そのままの状態で記憶装置11に記憶されることになる。なお、上述したように、明確な制約がなくても処理動作の実行に長い時間を必要とする場合には、受信機本体1における応答性の低下や、操作性の低下を惹き起こすという不具合が生じる虞もある。
On the other hand, for the
上述したディジタル放送受信機ソフトウェア19に含まれる各種のプログラム(21、23、25、27、及び29)が夫々有する機能は、プロセッサ13において実行される。
The functions of the various programs (21, 23, 25, 27, and 29) included in the digital
記憶装置11には、上記以外にも受信機本体1等の各種(ハードウェア)資源の管理や、アプリケーション(プログラム)が該各種(ハードウェア)資源を利用することができるようにするためのOSやアプリケーション(プログラム)等が格納されている。
In addition to the above, the
信号受信部15は、プロセッサ13の制御下で、リモコン3から送信される、上記動作指令信号が重畳された赤外光を受光し、上記動作指令信号に対し所定の信号処理を施した後、プロセッサ13へ出力する。ディジタル放送チューナ17は、プロセッサ13の制御下で、リモコン3を介してユーザから与えられる選局指令に従い、アンテナ5が受信した複数の放送局からのディジタル放送信号波(映像情報、及び音声情報を含む。)よりユーザの所望する放送局からのディジタル放送信号波を抽出するための選局処理動作を実行する。ディジタル放送チューナ17において選局処理が施されることにより抽出されたユーザ所望のディジタル放送信号波は、プロセッサ13の制御下で、復調等の信号処理を実行する信号処理系統(図示しない)に出力される。
The
プロセッサ13は、記憶装置11、信号受信部15、及びディジタル放送チューナ17等の受信機本体1を構成する各部を制御下に置き、各部の処理動作を管理する。即ち、プロセッサ13は、リモコン3を介してユーザから与えられる各種の動作指令信号に基づく処理を実行すべく、記憶装置11に記憶されている上記リモコンタスク21、チューナタスク23、映像デコードタスク25、音声デコードタスク27、及びデータ放送ブラウザタスク29等の中から対応するプログラムを起動させる。上記リモコンタスク21、チューナタスク23、映像デコードタスク25、音声デコードタスク27、及びデータ放送ブラウザタスク29等のディジタル放送受信機ソフトウェア19が、プロセッサ13のハードウェア資源を利用して夫々実行する処理動作の詳細については、既に説明済みであるので、ここでの重ねての説明は省略する。
The
プログラム変換装置9は、既述のように、記憶装置11に記憶されるべきディジタル放送受信機ソフトウェア19のうちの、チューナタスク23、映像デコードタスク25、及び音声デコードタスク27については、性能確保プログラムに変換する処理を施し、変換プログラムとする。プログラム変換装置9は、上記性能確保プログラムに変換された後のチューナタスク23、映像デコードタスク25、及び音声デコードタスク27を、ディジタル放送受信機ソフトウェア19として、プロセッサ13を通じて記憶装置11に記憶させる。プログラム変換装置9については、以下に詳述する。
As described above, the
図2は、図1に示したプログラム変換装置9の内部構成の一例を示す機能ブロックと、プログラムソースと、区間及び実行時間要求指定コード(以下、「コード」と表記する。)とから、上記各々の機能ブロックを通じて性能確保プログラムが生成されるまでのプロセスとを示した説明図である。
FIG. 2 shows the above-described function block, an example of the internal configuration of the
上記プログラム変換装置9は、図2に示すように、プログラムソース39と、コード41とを入力し、上記プログラムソース39に所定の変換処理を施すことにより、性能確保プログラム43を出力する。上記プログラム変換装置9は、計算量変動要因抽出部(以下、「抽出部」と表記する。)31と、変動要因と計算量との関係導出部(以下、「導出部」と表記する。)33と、必要CPU資源量計算機能付加部(以下、「計算機能付加部」と表記する。)35と、CPU資源割当て機能付加部(以下、「割当て機能付加部」と表記する。)37と、を備える。
As shown in FIG. 2, the
抽出部31は、種々の態様の条件分岐を含むプログラムソース、及び種々の態様のループを含むプログラムソースを、プログラムソース39として入力すると共に、複数種類の区間及び実行時間要求を、コード(即ち、区間及び実行時間要求指定コード)41として入力する。抽出部31は、上記入力したプログラムソース39のうちの、上記コード41により実行時間要求が指定された区間に対し、条件分岐抽出処理、及びループ抽出処理を実行する。上記条件分岐抽出処理、及び上記ループ抽出処理の実行結果が反映されたプログラムソース39は、抽出部31から導出部33へ出力される。
The
導出部33は、上記条件分岐抽出処理、及び上記ループ抽出処理の実行結果が反映されたプログラムソース39を抽出部31から入力すると、該プログラムソース39に対し、プロファイル取得用コード生成処理、計算量プロファイル取得処理、及び実行時間の関数近似処理を施す。上記プロファイル取得用コード生成処理、上記計算量プロファイル取得処理、及び上記実行時間の関数近似処理の実行結果が反映されたプログラムソース39は、導出部35から計算機能付加部35へ出力される。
When the
計算機能付加部35は、上記プロファイル取得用コード生成処理、上記計算量プロファイル取得処理、及び上記実行時間の関数近似処理の実行結果が反映されたプログラムソース39を導出部35から入力すると、該プログラムソース39に対し、所定の手法により必要CPU資源量見積りコードや、必要CPU資源量再見積りコードを挿入する処理を実行する。該処理の実行結果が反映されたプログラムソース39は、計算機能付加部35から割当て機能付加部37へ出力される。
The calculation
割当て機能付加部37は、上記必要CPU資源量見積りコードや、上記必要CPU資源量再見積りコードを挿入する処理の実行結果が反映されたプログラムソース39を計算機能付加部35から入力すると、上記必要CPU資源量見積りコードや、上記必要CPU資源量再見積りコードに基づき、所定の演算処理を実行する。これにより、上記プログラムソース39がプログラム変換されることになり、該プログラム変換処理の操作を経たプログラムソース(39)が、性能確保プログラム43としてプログラム変換装置9から図1で示した受信機本体1へ出力されることになる。
The allocation
図3は、図2で示したプログラムソース39の一種である条件分岐を含むプログラムソースの一例を示した説明図である。
FIG. 3 is an explanatory diagram showing an example of a program source including a conditional branch which is a kind of the
図3に記載のプログラムソース45において、符号45aは、該プログラムソース45における行番号“5”に対応する項目であって、上述したコード41により指定された実行時間要求指定区間内の条件分岐を示す。また、符号45bは、該プログラムソース45における行番号“6”に対応する項目であって、該条件分岐45aに係わる所定の条件が成立する場合の分岐先を示す。更に、符号45cは、該プログラムソース45における行番号“9”に対応する項目であって、該条件分岐45aに係わる所定の条件が成立しない場合の分岐先を示す。なお、図3の左上の箇所に記載されている“src_a.c”は、図3で示したプログラムソース45のファイル名を示す。
In the
図4は、図2で示したプログラムソース39の一種であるループを含むプログラムソースの一例を示した説明図である。
FIG. 4 is an explanatory diagram showing an example of a program source including a loop which is a kind of the
図4に記載のプログラムソース47において、符号47bは、該プログラムソース47における行番号“7”乃至行番号“10”に対応する項目であって、上述したコード41により指定された実行時間要求指定区間内のループを示す。また、符号47aは、該プログラムソース47における行番号“5”に対応する項目を指す。上記ループ47bに係わるループ回数は、定数、又は変数(n)のどちらかであるが、符号47aは、上記ループ47bに係わるループ回数が変数(n)である場合の、該変数(n)の位置、即ち、上記ループ47bのループ回数が決定する直後の処理の位置、換言すれば、上記ループ47bよりも前の位置であって、最後に“n”の値が更新される箇所を示す。なお、図4の左上の箇所に記載されている“src_b.c”は、図4で示したプログラムソース47のファイル名を示す。
In the
図5は、図2で示したコード(即ち、区間及び実行時間要求指定コード)41の一例を示した説明図である。 FIG. 5 is an explanatory diagram showing an example of the code (that is, the section and execution time request designation code) 41 shown in FIG.
図5において、コード41は、ファイル名により識別される各プログラムソース(39)毎の特定の区間を表す始点に係わる情報、及び終点に係わる情報と、制限された時間内に該特定の区間における処理を実行することを要求するに際しての、要求実行時間に係わる情報と、を含む。因みに、図5で示した例では、ファイルが“src_a.c”のプログラムソース(39)における始点が行番号“2”、終点が行番号“16”で画定される区間においては、該区間における処理を“10ミリ秒”で実行することが要求される。また、ファイルが“src_b.c”のプログラムソース(39)における始点が行番号“3”、終点が行番号“13”で画定される区間においては、該区間における処理を“20ミリ秒”で実行することが要求される。
In FIG. 5, the
図6は、図2で示した抽出部31において実行される処理動作の一例を示すフローチャートである。
FIG. 6 is a flowchart showing an example of processing operations executed in the
図6において、抽出部31は、プログラムソース39、及びコード41を入力すると、該プログラムソース39のうちの、該コード41により所定時間内での処理動作の実行の要求を指定された区間に対し、まず、条件分岐抽出処理の動作を実行し(ステップS51)、次いで、ループ抽出処理の動作を実行する(ステップS52)。これにより、図6で示した一連の処理動作が終了する。
In FIG. 6, when the
図7は、図6で示した条件分岐抽出処理の動作(ステップS51)において、抽出部31により生成される条件分岐による分岐先リスト(以下、「分岐先リスト」と表記する。)の一例を示す説明図である。
FIG. 7 shows an example of a branch destination list (hereinafter referred to as “branch destination list”) generated by the conditional branch generated by the
図7において、上記分岐先リスト53は、複数のファイル名記録欄55と、該複数のファイル名記録欄53の各々に対応付けされる複数の行番号記録欄57と、により構成される。
各々のファイル名記録欄53には、プログラム変換装置9の処理対象である、個々のプログラムソース39を識別するためのファイル名(情報)が、また、各々の行番号記録欄55には、対応する個々のプログラムソース(39)において、上記抽出部31により検索された分岐先を示す行番号(情報)が、夫々記録される。図7に示した例は、ファイル名“src_a.c”のプログラムソース39に係わるものであり、行番号“6”が、上記抽出部31により検索された条件分岐(45a)に係わる条件が成立した場合の分岐先として、また、行番号“9”が、上記条件分岐(45a)に係わる条件が成立しない場合の分岐先として、夫々上記抽出部31により記録されたことを示している。
In FIG. 7, the
Each file
図8は、図2で示した抽出部31による、図6で示した条件分岐抽出処理の動作(ステップS51)の詳細を示すフローチャートである。
FIG. 8 is a flowchart showing details of the conditional branch extraction processing operation (step S51) shown in FIG. 6 performed by the
図8において、上記抽出部31は、まず、上記コード41を入力し、次いで、該コード41により指定された上記プログラムソース39の区間を入力する(ステップS61)。次に、抽出部31は、上記区間中に条件分岐が存在するかどうか検索する。例えば、上記プログラムソース39が、図3で示したファイル名“src_a.c”のプログラムソース45であれば、条件分岐が存在していることになる(符号45a)(ステップS62でYES)。この場合、上記抽出部31により検索される条件分岐45aに係わる条件が成立していれば、分岐先は、符号45bで示す行番号“6”の位置になる。一方、該条件分岐45aに係わる条件が成立していなければ、分岐先は、符号45bで示す行番号“9”の位置になる。
In FIG. 8, the
ステップS62でYESであれば、抽出部31は、条件分岐45aに係わる条件が成立する場合には、分岐先として行番号“6”を、また、該条件分岐45aに係わる条件が成立しない場合には、分岐先として行番号“9”を、夫々図7に示した分岐先リスト53に記録し(ステップS63)、ステップS62で示した処理動作に復帰する。一方、上記抽出部31による検索の結果、処理対象であるプログラムソース39における、上記コード41により指定された区間中に、条件分岐を見出すことができなければ(ステップS62でNO)、上記抽出部31は、図8で示した条件分岐抽出処理に係わる一連の処理動作を終了させる。
If “YES” in the step S62, the
図9は、図6で示したループ抽出処理の動作(ステップS52)において、抽出部31により生成されるループリストの一例を示す説明図である。
FIG. 9 is an explanatory diagram showing an example of a loop list generated by the
図9において、上記ループリスト65は、ループ回数変数(ループ回数には、定数と変数の2種類あるが、ここでは、説明の都合上変数の場合のみを例に挙げる。)記録欄67と、ループ回数確定直後の処理の位置記録欄(以下、「処理の位置記録欄」と表記する。)69と、により構成され、処理の位置記録欄69は、ファイル名記録欄71、及び行番号記録欄73を有する。
In FIG. 9, the
ループ回数変数記録欄67には、対応する個々のプログラムソース(39)において、上記抽出部31により検索された変数“n”で示されるループ回数が、処理の位置記録欄69におけるファイル名記録欄71には、プログラム変換装置9の処理対象である、個々のプログラムソース39を識別するためのファイル名(情報)が、夫々記録される。更に、処理の位置記録欄69における行番号記録欄73には、対応する個々のプログラムソース(39)において、上記抽出部31により検索されたループに示される該ループの回数、即ち変数“n”が決定する直後の処理が実行される位置、換言すれば、上記ループよりも前の、最後に変数“n”の値が更新される行の次の行の番号が記録される。図9に示した例は、ファイル名“src_b.c”のプログラムソース39に係わるものであり、行番号“6”は、上記抽出部31により検索されたループ47bのループ回数変数“n”
が決定する直後の処理が実行される位置である。
In the loop count
This is the position where the process immediately after the determination is executed.
図10は、図2で示した抽出部31による、図6で示したループ抽出処理の動作(ステップS52)の詳細を示すフローチャートである。
FIG. 10 is a flowchart showing details of the operation (step S52) of the loop extraction process shown in FIG. 6 by the
図10において、上記抽出部31は、まず、上記コード41を入力し、次いで、該コード41により指定された上記プログラムソース39の区間を入力する(ステップS81)。次に、抽出部31は、上記区間中にループが存在するかどうか検索する。例えば、上記プログラムソース39が、図4で示したファイル名“src_b.c”のプログラムソース47であれば、ループが存在していることになる(符号47b)(ステップS82でYES)。図4を参照すれば明らかなように、ファイル名“src_b.c”のプログラムソース39の場合には、ループ回数は変数“n”である(ステップS83でYES)。よって、抽出部31は、図9で示したループリスト65のループ回数変数記録欄67に、ループ回数として変数“n”を記録すると共に、図9で示した処理の位置記録欄69のファイル名記録欄71に、“src_b.c”を、行番号記録欄73に処理の位置として、行番号“6”を夫々記録する(ステップS84)。そして、ステップS82で示した処理動作に復帰する。処理対象であるプログラムソース39の上述した指定区間におけるループのループ回数が定数である場合にも(ステップS83でYES)、ステップS82で示した処理動作に復帰する。
In FIG. 10, the
抽出部31による上記区間中における検索の結果、ループが検索されなければ、ループが存在しないものとして(ステップS82でNO)、図10に示した一連の処理動作が終了する。
If the loop is not searched as a result of the search in the section by the
図11は、図2で示した導出部33において実行される処理動作の一例を示すフローチャートである。
FIG. 11 is a flowchart illustrating an example of a processing operation executed in the
図11において、導出部33は、上述したプログラムソース39、プログラム抽出部31から出力される分岐先リスト53、及びループリスト65を夫々入力する。そして、該分岐先リスト53、及び該ループリスト65に基づき、上記プログラムソース39に対しプロファイル計測のためのコードを挿入することにより、プロファイル取得用コードを生成するプロファイル取得用コード生成処理を実行する(ステップS91)。次に、生成したプロファイル取得用コードを、種々の条件下で実行し、該実行に係わる計算時間を記録する(ステップS92)。そして、上記記録した計算時間について、関数近似処理を実行する(ステップS93)。これにより、図11で示した一連の処理動作が終了する。
In FIG. 11, the deriving
図12は、図2で示した導出部33による変動要因と計算量との関係導出処理の動作において生成されるプロファイル取得用コードの一例を示す説明図である。図12は、ファイル名が“src_b.c”であるプログラムソース39におけるプロファイル取得用コードの例を示す。以下の説明では、該プロファイル取得用コードが生成される処理動作において、プログラムソース39におけるコードの挿入を実施した位置(上述した指定区間の開始位置、分岐先リスト53に記録された位置、又はループリスト65に記録された位置)を、「計算時間計測位置」と表記する場合もある。
FIG. 12 is an explanatory diagram illustrating an example of a profile acquisition code generated in the operation of the relationship derivation process between the variation factor and the calculation amount by the
図12に示すプロファイル取得用コード95では、上述したループリスト65(図9で示した)に記録されている位置である、行番号“6”で示される位置の直前の位置と、上述したコード41(図2で示した)に基づく所定時間内での処理動作の実行の要求を指定された区間の開始位置である、行番号“3”で示される位置の直前の位置とに、夫々該位置から上記区間の終了までの計算時間取得コードが挿入されている。即ち、上記行番号“6”の位置の直前の位置である符号95cの位置、及び上記行番号“3”の位置の直前の位置である符号95aの位置には、後に詳述するプロファイル取得に際し、シングルタスクで走らせるという前提において取得された現在時刻を記録するコードが、夫々挿入されている。また、行番号“12”の位置の直後の位置である符号95dの位置には、該位置にて求めた現在時刻を記録するコードが挿入されているのみならず、現在時刻95dと現在時刻95aとの間の差分を示す値(符号95eで示す)を記録するコード、及び現在時刻95dと現在時刻95cとの間の差分を示す値(符号95fで示す)を記録するコードが、夫々挿入されている。
In the
更に、上述した行番号“6” の位置の直前の位置には、ループ回数変数である“n”の値(符号95bで示す)を記録するコードが、挿入されている。 Further, a code for recording the value of “n” (indicated by reference numeral 95b), which is a loop number variable, is inserted at a position immediately before the position of the row number “6” described above.
図13は、図2で示した導出部33による、図11で示した変動要因と計算量との関係導出処理の動作の詳細を示すフローチャートである。図13では、図11で示した処理動作に含まれるプロファイル取得用コード生成処理の動作の詳細が示される。
FIG. 13 is a flowchart showing details of the operation of the relationship derivation process between the variation factor and the calculation amount shown in FIG. 11 by the
図13で示すプロファイル取得用コード生成処理の動作では、プログラム変換装置9に入力されたプログラムソース39に対し、抽出部31において記録された各々の計算量変動要因に係わるリスト(即ち、分岐先リスト53、及びループリスト65)に基づき、プロファイル計測のためのコードを(例えば、図12で示した態様で)挿入することにより、プロファイル取得用コードが生成される。
In the operation of the profile acquisition code generation process shown in FIG. 13, a list (that is, a branch destination list) relating to each calculation amount variation factor recorded in the
図13において、導出部33は、上記各々の計算量変動要因に対し、ステップS102以下で夫々示されるようなコード挿入処理を実行する(ステップS101)。即ち、導出部33は、まず、上述した計算量変動要因の種類が、ループによるものかどうかチェックする(ステップS102)。該チェックの結果、ループによるものであると判断すれば(ステップS102でYES)、上述したループリスト65に記録されている「ループ回数確定直後の処理の位置」の直前の位置(即ち、ループ回数が確定する直後の位置)に、該時点でのループ回数変数の値を記録するコードを挿入する(図12の例では、符号95bで示したコードが該当する。)(ステップS103)。該処理動作が終了すると、導出部33は、次に、上記(計算量)変動要因の種類の如何を問わず、上記リスト(分岐先リスト53、又はループリスト65の何れか一方)に記録されているプログラムソース39中の位置(ループ回数の確定位置、若しくは分岐先位置)に対し、該位置から上述した指定区間(即ち、所定時間内での処理動作の実行の要求を指定された区間)が終了するまでのプログラムソース39の区間の計算時間を取得するためのコードを挿入する(図12の例では、符号95e、及び符号95fで夫々示したコードが該当する。)(ステップS104)。なお、ステップS102において、導出部33が、上述した計算量変動要因の種類がループによるものではないと判断した場合には(ステップS102でNO)、直ちにステップS104にて示した処理動作に移行する。
In FIG. 13, the
ステップS104で示した処理動作が終了すると、導出部33は、(図12のプログラムソース39における)上記区間(即ち、所定時間内での処理動作の実行の要求を指定された区間)の開始位置に対しても、上記計算時間を取得するためのコード(図12では、符号95aで示した位置のコード)を挿入する。これにより、上述した要求に該当する(指定)区間全体の計算時間の取得も可能になる(ステップS105)。そして、図13で示した一連の処理動作が終了する。
When the processing operation shown in step S104 is completed, the deriving
なお、プログラムソース39における上述したコード挿入位置から上記区間が終了するまでの計算時間を取得するための手法として、プロファイルを取得するに際してシングルタスクで走らせるという前提においては、コード挿入位置、及び所定時間内での処理動作の実行の要求を指定された区間が終了する位置に、夫々現在時刻を記録するコードを挿入し、記録した時刻同士の間の差分を求める方法がある。また、スケジューラから各々のタスクに配分したCPU時間情報を取得することができる場合には、該情報を用いても差し支えない。
As a method for acquiring the calculation time from the code insertion position described above in the
図14は、図2で示した導出部33による、図11で示した計算時間の関数近似処理において生成される計算時間計測位置と残り区間最大計算時間との対応を示す表(以下では、「対応表」と表記する。)の一例を示す説明図である。
FIG. 14 is a table showing the correspondence between the calculation time measurement position generated by the
図14において、対応表107は、ファイル名により識別される各プログラムソース(39)毎の計算時間計測位置を示す行番号情報と、該計算時間計測位置(計測開始位置)からの残り区間における計算時間の最大値(即ち、最大計算時間)に係わる情報(単位ミリ秒)と、を含む。因みに、図14で示した例では、ファイル名が“src_a.c”のプログラムソース(39)における計算時間計測位置が行番号“2”の残り区間最大計算時間は、“7.5ミリ秒”であり、該プログラムソース39における計算時間計測位置が行番号“6”の残り区間最大計算時間は、“2.3ミリ秒”である。更に、該プログラムソース39における計算時間計測位置が行番号“9”の残り区間最大計算時間は、“4.2ミリ秒”である。また、ファイル名が“src_b.c”のプログラムソース(39)における計算時間計測位置が行番号“3”の残り区間最大計算時間は、“14.2ミリ秒”である。
In FIG. 14, the correspondence table 107 includes line number information indicating the calculation time measurement position for each program source (39) identified by the file name, and the calculation in the remaining section from the calculation time measurement position (measurement start position). And information (unit milliseconds) related to the maximum value of time (that is, maximum calculation time). Incidentally, in the example shown in FIG. 14, the maximum calculation time of the remaining section whose calculation time measurement position is the line number “2” in the program source (39) with the file name “src_a.c” is “7.5 milliseconds”. The maximum calculation time of the remaining section whose calculation time measurement position in the
図15は、図2で示した導出部33による、図11で示した計算時間の関数近似処理において生成されるループ回数値と残り区間最大計算時間との対応を示す表(以下では、「対応表」と表記する。)の一例を示す説明図である。
FIG. 15 is a table showing the correspondence between the loop count value generated in the function approximation process of the calculation time shown in FIG. 11 by the deriving
図15に示す対応表109は、既に説明したファイル名が“src_b.c”のプログラムソース39に係わるものである。該プログラムソース39においては、上述した指定区間内に存在するループ回数が変数“n”であり、ループ回数確定直後の処理位置は、図12で示したように、該プログラムソース39における行番号“6”
の位置である。そして、該行番号“6”の直前の位置には、ループ回数変数である“n”の値(符号95bで示した)を記録するコードが、挿入されている。
The correspondence table 109 shown in FIG. 15 relates to the
Is the position. In the position immediately before the line number “6”, a code for recording the value of “n” which is a loop count variable (indicated by reference numeral 95b) is inserted.
図15に示した例では、ループ回数値が“0”の場合の残り区間最大計算時間は“5.6ミリ秒”であり、ループ回数値が“1”の場合の残り区間最大計算時間は“6.3ミリ秒”であり、ループ回数値が“2”の場合の残り区間最大計算時間は“7.3ミリ秒”であり、ループ回数値が“3”の場合の残り区間最大計算時間は“8.7ミリ秒”である。また、回数値が“4の場合の残り区間最大計算時間は“9.3ミリ秒”であり、ループ回数値が“5”の場合の残り区間最大計算時間は“10.7ミリ秒”であり、ループ回数値が“6”の場合の残り区間最大計算時間は“12.5ミリ秒”であり、ループ回数値が“7”の場合の残り区間最大計算時間は“12.7ミリ秒”である。 In the example shown in FIG. 15, the remaining section maximum calculation time when the loop count value is “0” is “5.6 milliseconds”, and the remaining section maximum calculation time when the loop count value is “1” is The remaining section maximum calculation time when the loop count value is “2” is “7.3 milliseconds”, and the remaining section maximum calculation when the loop count value is “3”. The time is “8.7 milliseconds”. Further, the remaining section maximum calculation time when the count value is “4” is “9.3 milliseconds”, and the remaining section maximum calculation time when the loop count value is “5” is “10.7 milliseconds”. Yes, the remaining section maximum calculation time when the loop count value is “6” is “12.5 milliseconds”, and the remaining section maximum calculation time when the loop count value is “7” is “12.7 milliseconds”. ".
図16は、図15で示したループ回数値と残り区間最大計算時間との関係を示す、一次関数(一次式)により近似したグラフである。 FIG. 16 is a graph approximated by a linear function (linear expression) showing the relationship between the loop count value shown in FIG. 15 and the remaining section maximum calculation time.
図16で示すグラフでは、その縦軸に残り区間最大計算時間(単位ミリ秒)が、その横軸にループ回数変数値“n”が、夫々設定されている。図16において、線分111は、一次関数y=1.1x+5.9を表す。また、折れ線113は、ループ回数変数値“n”が“0”から“7”までの値をとる場合の個々のループ回数値に対応する残り区間最大計算時間を示すグラフ上の点同士を結ぶことにより形成された線である。
In the graph shown in FIG. 16, the remaining section maximum calculation time (unit: millisecond) is set on the vertical axis, and the loop count variable value “n” is set on the horizontal axis. In FIG. 16, a
図16を参照すれば、ループ回数値と残り区間最大計算時間との関係を、図14で示した各値を基に一次関数y=1.1x+5.9で近似することにより、何れのループ回数変数値における残り区間最大計算時間よりも大きい値を取り得ることが明らかになる。 Referring to FIG. 16, the relationship between the loop count value and the remaining section maximum calculation time is approximated by a linear function y = 1.1x + 5.9 based on each value shown in FIG. It becomes clear that a value larger than the remaining section maximum calculation time in the variable value can be taken.
図17は、図2で示した導出部33による、図11で示した計算時間の関数近似処理の動作の詳細を示すフローチャートである。
FIG. 17 is a flowchart showing details of the calculation time function approximation processing shown in FIG. 11 by the deriving
図17において、導出部33は、上述した(図14で示したような)各々の計算時間計測位置(計算時間計測開始位置)に対し、ステップS122以下で夫々示されるような処理動作を実行する(ステップS121)。即ち、導出部33は、まず、任意の計算時間計測位置に係わる計算量変動要因の種類が、ループによるものかどうかチェックする(ステップS122)。該チェックの結果、ループによるものであると判断すれば(ステップS122でYES)、計算時間と共に、(図15で示した対応表109に)記録されているループ回数の値毎に、該計算時間計測位置から上述した指定区間が終了するまでの間に要する計算時間の最大値を求め、図15で示した対応表109に記録する処理を実行する(ステップS123)。
In FIG. 17, the deriving
次に、図15で示した対応表109に基づき、個々のループ回数値と、各々のループ回数値に対応する残り区間最大計算時間との関係を、例えば、図16において示した一次関数:y=1.1x+5.9のような一次関数で近似する処理(所謂関数近似処理)を実行すると共に、該近似した一次関数を記録する処理を実行する。これにより、該計算時間計測位置における処理が終了する(ステップS124)。図16において説明したように、関数近似処理においては、何れのループ回数値に対しても、プロファイル取得によって得られた最大計算時間よりも大きな値を取る関数により近似が行われる。 Next, based on the correspondence table 109 shown in FIG. 15, the relationship between the individual loop count values and the remaining section maximum calculation time corresponding to each loop count value is, for example, the linear function y shown in FIG. A process of approximating with a linear function such as = 1.1x + 5.9 (so-called function approximation process) is executed, and a process of recording the approximated linear function is executed. Thereby, the process at the calculation time measurement position ends (step S124). As described with reference to FIG. 16, in the function approximation process, approximation is performed for any loop count value using a function that takes a value larger than the maximum calculation time obtained by profile acquisition.
一般に、上述したループにおいては、ループ回数に対して一時的に計算時間が増加する傾向があるため、一次式(一次関数)により関数近似が可能であると予測される。しかし、実際に取得されたデータによっては、他の関数の形で近似することも可能である。また、プログラムソース39のコードサイズに余裕がある場合には、図15で示した対応表109を、該プログラムソース39内に上述したループ回数値と残り区間最大計算時間との関係を示すデータテーブルとして持つことも可能である。
In general, in the loop described above, the calculation time tends to increase temporarily with respect to the number of loops, and therefore it is predicted that function approximation can be performed using a linear expression (linear function). However, depending on the actually acquired data, approximation in the form of other functions is also possible. When there is a margin in the code size of the
ステップS122でのチェックの結果、該計算時間計測位置に係わる計算量変動要因の種類が、ループによるものでないと判断すれば(ステップS122でNO)、導出部33は、プロファイル取得により得られた該計算時間計測位置から上記指定区間が終了するまでの全ての計算時間の中から計算時間の最大値を求める。そして、該求めた計算時間の最大値を、残り区間最大時間として図15で示した対応表109に記録する。これにより、該計算時間計測位置における処理が終了する(ステップS125)。
As a result of the check in step S122, if it is determined that the type of the calculation amount variation factor related to the calculation time measurement position is not due to the loop (NO in step S122), the deriving
ステップS123乃至ステップS125で夫々示した処理動作が、全ての計算時間計測位置において実行されることにより、図17で示した一連の処理動作が終了する。 When the processing operations shown in steps S123 to S125 are executed at all the calculation time measurement positions, the series of processing operations shown in FIG. 17 ends.
図18は、図2で示した計算機能付加部35において実行される処理動作の一例を示すフローチャートである。
FIG. 18 is a flowchart showing an example of processing operations executed in the calculation
図18に示したフローチャートでは、計算機能付加部35が、プログラム変換装置9へ入力されたプログラムソース39に対し、以下に説明する手法により必要CPU資源量見積りコードを挿入する。即ち、計算機付加部35は、まず、上記プログラムソース39における上述した指定区間の開始位置において、デッドライン時刻(即ち、現在時刻に性能指標として与えられた実行時間が加えられた時刻であって、プログラムソース39が終了しなければならない時刻のことを指す。)を求めるコードを挿入する処理を実行する(ステップS131)。次に、上述した各々の計算時間計測位置における処理として(ステップS132)、該位置に後に詳述する必要CPU資源再見積りコードを挿入するための処理を実行する。そして、上記コードを挿入した結果として生成されるプログラムソースを記録する処理を実行する(ステップS133)。上記処理が、全ての計算時間計測位置に対して実行されることにより、図18で示した一連の処理動作が終了する。
In the flowchart shown in FIG. 18, the calculation
図19は、図2で示した計算機能付加部35において実行される必要CPU資源量見積りコードに係わる処理内容の一例を示すフローチャートである。
FIG. 19 is a flowchart showing an example of processing contents related to a necessary CPU resource amount estimation code executed by the calculation
図19において、計算機能付加部35は、まず、任意の計算時間計測位置に係わる計算量変動要因の種類が、ループによるものかどうかチェックする(ステップS141)。該チェックの結果、ループによるものであると判断すれば(ステップS141でYES)、計算量変動要因であるループにおけるループ回数変数“n”より、確定したループ回数値を取得する(ステップS142)。次に、ステップS142で取得したループ回数値と、上述した近似関数とを用いて、上記残り区間最大計算時間を計算する。ここで、上述した近似関数を用いるのではなく、上記データテーブルを用いて上記残り区間最大計算時間を求めることとした場合には、該データテーブルから該ループ回数に対応する残り区間最大計算時間を求めることになる(ステップS143)。該処理動作が終了すると、計算機能付加部35は、次に現在時刻を取得すると共に、該取得した現在時刻から図18のステップS131において求めた該処理動作の実行に係わるデッドライン時刻までの余裕時間を求める処理を実行する(ステップS144)。
In FIG. 19, the calculation
上記処理動作が終了すると、計算機能付加部35は、次に、ステップS143で求めた残り区間最大計算時間を、デッドライン時刻までの余裕時間で除算することにより、該残り区間における処理動作の実行をデッドライン時刻までの間に終了させるのに必要なCPU資源割合(即ち、必要CPU資源割合)を求める(ステップS145)。ステップS145で示した処理動作が終了することにより、図19で示した一連の処理動作が終了することになる。なお、ステップS141でのチェックの結果、ループによるものでないと判断すれば(ステップS141でNO)、直ちにステップS144で示した処理動作に移行する。この場合、残り区間最大計算時間は、図14で示した対応表107により、上記挿入コードの挿入時に判明しているので、上記対応表107中に記録されている値を用いることになる。
When the processing operation is completed, the calculation
図20は、図2で示した割当て機能付加部37において実行される処理動作の一例を示すフローチャートである。
FIG. 20 is a flowchart showing an example of the processing operation executed in the assignment
図20において、割当て機能付加部37は、各々の計算時間計測位置に対し、ステップS152で示す処理動作を実行する(ステップS151)。即ち、各々の計算時間計測位置毎に求められる必要CPU資源割合(計算機能付加部35において挿入された必要CPU資源量見積りコードにより計算される)が、計算機能付加部35から出力されると、割当て機能付加部37は、該必要CPU資源割合を確保することができるように、プログラム変換処理を実行する(ステップS152)。そして、全ての計算時間計測位置毎に、ステップS152で示した処理動作が終了すると、図20で示した一連の処理動作が終了することになる。
In FIG. 20, the allocation
なお、図20で示した処理動作において用いられる、CPU資源割合を確保するための手段の一例としては、上掲の非特許文献1に開示されている手法が挙げられる。該手法を用いる場合には、必要CPU資源割合をOS内の資源制御機構に設定するためのシステムコールを呼び出すコードが挿入されることになる。
An example of a means for securing the CPU resource ratio used in the processing operation shown in FIG. 20 is the technique disclosed in
図21は、図2で示したプログラム変換装置9が、図4で示したプログラムソース47を基に出力する性能確保プログラムの一例を示す説明図である。図21は、ファイル名が“src_b.c”であるプログラムソース39から変換された性能確保プログラムの例を示す。
FIG. 21 is an explanatory diagram showing an example of a performance ensuring program output from the
図21に示す性能確保プログラム161では、上述した指定区間の開始位置である行番号“3”の直前の位置に、符号161aで示すように、デッドライン(DL)時刻として現在時刻から指定された実行時間である“20ミリ秒”後の時刻を設定するためのコードが挿入されている。また、図14で示した対応表107に記録された位置である行番号“3”の直前の位置に、符号161bで示すように、必要CPU資源量見積りコードが挿入されている。符号161bで示す位置における必要CPU資源割合(r)は、上記対応表107に記録された残り区間最大計算時間である“14.2ミリ秒”を、現在時刻からデッドライン時刻までの間の時間で除算することにより求められたものである。そして、上記符号161bで示した位置の直後の位置には、符号161cで示すように、上記(求められた)必要CPU資源割合(r)を確保するためのコードが挿入されている。また、図9で示したループリスト65に記録されている位置である行番号“6”
の直前の位置にも、符号161dで示すように、必要CPU資源量見積りコードが挿入されている。符号161dで示す位置における必要CPU資源割合(r)は、図16において求めた関係である一次関数:y=1.1x+5.9のxに、ループ回数変数の値“n”を代入することにより求められる残り区間最大計算時間を、現在時刻からデッドライン時刻までの間の時間で除算することにより求められたものである。そして、上記符号161dで示した位置の直後の位置には、符号161eで示すように、上記(求められた)必要CPU資源割合(r)を確保するためのコードが挿入されている。
In the
A necessary CPU resource amount estimation code is also inserted at a position immediately before, as indicated by
上述した構成のプログラムソース161が、ファイル名“src_b.c”のプログラムソース(39)の性能確保プログラムとして、プログラム変換装置9から受信機本体1へ出力されることになる。
The
以上、本発明の好適な実施形態を説明したが、これは本発明の説明のための例示であって、本発明の範囲をこの実施形態にのみ限定する趣旨ではない。本発明は、他の種々の形態でも実施することが可能である。 The preferred embodiment of the present invention has been described above, but this is an example for explaining the present invention, and the scope of the present invention is not limited to this embodiment. The present invention can be implemented in various other forms.
1 ディジタル放送受信機本体(受信機本体)
3 リモートコントローラ(リモコン)
5 アンテナ
7 表示装置
9 プログラム変換装置
11 記憶装置
13 プロセッサ
15 信号受信部
17 ディジタル放送チューナ
19 ディジタル放送受信機ソフトウェア
21 リモートコントローラタスク(リモコンタスク)
23 チューナタスク
25 映像デコードタスク
27 音声デコードタスク
29 データ放送ブラウザタスク
31 計算量変動要因抽出部(抽出部)
33 変動要因と計算量との関係導出部(導出部)
35 必要CPU資源量計算機能付加部(計算機能付加部)
37 CPU資源割当て機能付加部(割当て機能付加部)
39 プログラムソース
41 区間及び実行時間要求指定コード(コード)
100 ディジタル放送受信システム
1 Digital broadcast receiver body (receiver body)
3 Remote controller (remote control)
23
33 Derivation unit (derivation unit) for relationship between variable factors and computational complexity
35 Required CPU resource amount calculation function addition part (calculation function addition part)
37 CPU resource allocation function addition unit (allocation function addition unit)
39
100 Digital broadcast receiving system
Claims (8)
前記プログラムの性能指標が与えられる、前記プログラムの或る区間に対して、該区間内の1箇所、若しくは複数箇所から該区間の終端までの間の実行に要する時間の最大値を算出する実行時間算出部と、
前記実行時間算出部により算出された実行時間の最大値と、前記性能指標とから、前記プログラムが起動するCPUにおいて前記1箇所、若しくは複数箇所から該区間の終端までの間の実行のために確保すべきCPU資源割合を求める機能を、前記プログラムのソースコードに付与する機能付与部と、
前記機能付与部により前記CPU資源割合を求める機能が付与されたプログラムのソースコードを、前記CPU資源割合を求める機能により求められたCPU資源割合を確保するプログラムに変換するプログラム変換部と、
を備えるプログラム変換装置。 In a program conversion device for converting a source code of a given program,
Execution time for calculating the maximum time required for execution from one place or a plurality of places in the section to the end of the section for a section of the program to which the performance index of the program is given A calculation unit;
Secured for execution from the one or more places to the end of the section in the CPU where the program starts from the maximum value of the execution time calculated by the execution time calculation unit and the performance index A function adding unit that gives a function for obtaining a CPU resource ratio to be given to the source code of the program;
A program conversion unit that converts the source code of a program function of obtaining the CPU resource ratio by the functionalization unit is granted, the program to ensure the CPU resource percentage determined by the function determining the pre-Symbol C PU resources ratio,
A program conversion apparatus comprising:
前記プログラムの性能指標が与えられる前記プログラムの或る区間内において、前記プログラムの計算量に変動を及ぼす原因が生じたかどうかを検知する変動原因検知部、を更に備え、
前記プログラムの或る区間内の1箇所、若しくは複数箇所が、前記変動原因検知部により検知された前記変動を及ぼす原因が存在する位置であるプログラム変換装置。 The program conversion apparatus according to claim 1, wherein
In certain the section of the program performance index of the program is given, further comprising a variation cause detection unit, for detecting whether the occurred caused on the change in the calculated amount of the program,
The program conversion apparatus in which one place or a plurality of places in a certain section of the program is a position where the cause of the change detected by the change cause detection unit exists.
前記変動を及ぼす原因が、前記区間内に存在する条件分岐の分岐先であるプログラム変換装置。 The program conversion device according to claim 2, wherein
A program conversion apparatus in which the cause of the variation is a branch destination of a conditional branch existing in the section.
前記変動を及ぼす原因が、前記区間内に存在するループであり、前記1箇所、若しくは複数箇所が、前記区間内における前記ループのループ回数の確定箇所以降の箇所を含むプログラム変換装置。 The program conversion device according to claim 2, wherein
The program conversion apparatus in which the cause of the variation is a loop existing in the section, and the one place or a plurality of places includes places after the determined number of loops of the loop in the section.
前記実行時間算出部が、前記変動原因検知部により検知された前記区間内に存在する前記確定したループ回数に応じた実行時間の最大値を求めるプログラム変換装置。 The program conversion device according to claim 4, wherein
The program conversion apparatus in which the execution time calculation unit obtains a maximum value of an execution time according to the determined number of loops existing in the section detected by the variation cause detection unit.
前記実行時間算出部が、
前記プログラムの前記区間の実行に要する時間を求めるためのプロファイル取得用コードを生成する生成部と、
前記生成部により生成されたプロファイル取得用コードを実行する実行部と、
前記実行部による前記プロファイル取得用コードの実行により取得したプロファイルデータから、前記実行時間の最大値を算出する算出部と、
を備えるプログラム変換装置。 The program conversion device according to claim 5, wherein
The execution time calculation unit
A generating unit that generates a profile acquisition code for obtaining a time required for execution of the section of the program;
An execution unit for executing the profile acquisition code generated by the generation unit;
A calculation unit that calculates the maximum value of the execution time from profile data acquired by execution of the profile acquisition code by the execution unit;
A program conversion apparatus comprising:
前記性能指標が、前記プログラムの前記区間の実行に要する時間であるプログラム変換装置。 The program conversion apparatus according to claim 6, wherein
The program conversion apparatus, wherein the performance index is a time required for executing the section of the program.
前記プログラムの性能指標が与えられる、前記プログラムの或る区間に対して、該区間内の1箇所、若しくは複数箇所から該区間の終端までの間の実行に要する時間の最大値を算出する第1のステップと、
前記第1のステップにおいて算出された実行時間の最大値と、前記性能指標とから、前記プログラムが起動するCPUにおいて前記1箇所、若しくは複数箇所から該区間の終端までの間の実行のために確保すべきCPU資源割合を求める機能を、前記プログラムのソースコードに付与する第2のステップと、
前記第2のステップにおいて前記CPU資源割合を求める機能が付与されたプログラムのソースコードを、前記CPU資源割合を求める機能により求められたCPU資源割合を確保するプログラムに変換する第3のステップと、
を備えるプログラム変換方法。 In a program conversion method for converting a source code of a given program,
A first value for calculating the maximum time required for execution from one place or a plurality of places in the section to the end of the section for a section of the program to which the performance index of the program is given And the steps
Secured for execution from the one or a plurality of places to the end of the section in the CPU that starts the program from the maximum value of the execution time calculated in the first step and the performance index A second step of providing a function for obtaining a CPU resource ratio to be added to the source code of the program;
A third step of converting the program to ensure the source code of the program function is imparted to determine the CPU resource ratio in the second step, CPU resources rate determined by the function determining the pre-Symbol C PU resources ratio When,
A program conversion method comprising:
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2009029750A JP5406549B2 (en) | 2009-02-12 | 2009-02-12 | Program conversion method and apparatus |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2009029750A JP5406549B2 (en) | 2009-02-12 | 2009-02-12 | Program conversion method and apparatus |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2010186301A JP2010186301A (en) | 2010-08-26 |
JP5406549B2 true JP5406549B2 (en) | 2014-02-05 |
Family
ID=42766926
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2009029750A Expired - Fee Related JP5406549B2 (en) | 2009-02-12 | 2009-02-12 | Program conversion method and apparatus |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP5406549B2 (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP6926921B2 (en) * | 2017-01-27 | 2021-08-25 | 富士通株式会社 | Compile program, compilation method and parallel processing device |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP4405365B2 (en) * | 2004-10-27 | 2010-01-27 | パナソニック株式会社 | Program conversion apparatus and method |
JP4822817B2 (en) * | 2005-11-22 | 2011-11-24 | パナソニック株式会社 | Compilation system |
-
2009
- 2009-02-12 JP JP2009029750A patent/JP5406549B2/en not_active Expired - Fee Related
Also Published As
Publication number | Publication date |
---|---|
JP2010186301A (en) | 2010-08-26 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11006166B2 (en) | Method for television remote keypress response based on android operating system and television thereof | |
US8607246B2 (en) | Multiprocessor circuit using run-time task scheduling | |
US9336001B2 (en) | Dynamic instrumentation | |
KR101051872B1 (en) | Program execution control device | |
EP2587382A1 (en) | Multi-core processor system, control program, and control method | |
WO2017173171A1 (en) | Application programing interface for adaptive audio rendering | |
JP4971203B2 (en) | Information processing apparatus and program | |
JP5462529B2 (en) | Task allocation apparatus and task allocation method | |
US20170052979A1 (en) | Input/Output (IO) Request Processing Method and File Server | |
KR101919257B1 (en) | Application program switch method, apparatus and electronic terminal | |
CN107820605B (en) | System and method for dynamic low-latency optimization | |
JP5406549B2 (en) | Program conversion method and apparatus | |
US20050132038A1 (en) | Resource reservation system and resource reservation method and recording medium storing program for executing the method | |
CN101448111B (en) | Apparatus for processing program information, system for receiving digital broadcasts, and method for processing program information | |
US7952499B1 (en) | Random access in run-length encoded structures | |
JP6287650B2 (en) | Simulation method and simulation program | |
US8806180B2 (en) | Task execution and context switching in a scheduler | |
JP2020173508A (en) | Information processing device and data management method of information processing device | |
JP5175951B2 (en) | Video display device, video display management device, video display method, and video display management method | |
US20140079370A1 (en) | Digital video converter and method for reading and writing video stream | |
JP2010272072A (en) | Memory management device | |
US20180060053A1 (en) | Evolving streaming installation of software applications | |
US20120017070A1 (en) | Compile system, compile method, and storage medium storing compile program | |
US20100138622A1 (en) | Backup apparatus, backup method and backup program | |
CN110825697B (en) | Method and apparatus for formatting a storage device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20110914 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20130313 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20130416 |
|
A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20130613 |
|
A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 Effective date: 20131029 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20131101 |
|
LAPS | Cancellation because of no payment of annual fees |