JP2004030505A - Program trace data recording method and trace memory - Google Patents
Program trace data recording method and trace memory Download PDFInfo
- Publication number
- JP2004030505A JP2004030505A JP2002189241A JP2002189241A JP2004030505A JP 2004030505 A JP2004030505 A JP 2004030505A JP 2002189241 A JP2002189241 A JP 2002189241A JP 2002189241 A JP2002189241 A JP 2002189241A JP 2004030505 A JP2004030505 A JP 2004030505A
- Authority
- JP
- Japan
- Prior art keywords
- data
- trace
- block
- time stamp
- memory
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Landscapes
- Debugging And Monitoring (AREA)
Abstract
【課題】ソフトウェアプログラムの実行中にプログラムの実行履歴であるトレースデータをトレースメモリに記録して解析するデバッグシステムにおいて、大容量のトレースメモリを確保できない場合があり、その場合は少量のトレースデータしか記録できず、長時間にわたるトレースデータの記録が困難である。
【解決手段】最初のトレースデータに対しては、タイムスタンプサイズを0としタイムスタンプ値をタイムスタンプ保存バッファに記録し、2番目以降のトレースデータに対しては、そのタイムスタンプ値からバッファに保存されたタイムスタンプ値を減算した値とその値の格納サイズをトレースメモリに記録し、2番目以降のトレースデータのタイムスタンプ値でバッファの値を更新する。
【選択図】 図1A debug system that records trace data, which is the execution history of a program, in a trace memory during the execution of a software program and analyzes the trace data may not be able to secure a large amount of trace memory. Recording cannot be performed, and it is difficult to record trace data for a long time.
For the first trace data, the time stamp size is set to 0 and the time stamp value is recorded in the time stamp storage buffer, and for the second and subsequent trace data, the time stamp value is stored in the buffer based on the time stamp value. The value obtained by subtracting the obtained time stamp value and the storage size of the value are recorded in the trace memory, and the value of the buffer is updated with the time stamp value of the second and subsequent trace data.
[Selection diagram] Fig. 1
Description
【0001】
【発明の属する技術分野】
本発明は、ソフトウェアプログラムの実行中にプログラムの実行履歴であるトレースデータをトレースメモリに書き込み、プログラム終了後にトレースデータを読み出して解析するデバッグツールにおける、プログラムトレースデータ記録方法およびトレースメモリに関するものである。
【0002】
【従来の技術】
プログラムトレースデータ記録方法では、各トレースデータはトレースログ種別、タイムスタンプ、その他の固有情報から構成され、プログラムの実行中に観測イベントが発生するごとにトレースデータを生成し、トレースメモリの先頭アドレスから順番に記録する。トレースメモリに空き領域がなくなると、トレースメモリの先頭アドレスにもどり、古いトレースデータを上書きしていた。
【0003】
【発明が解決しようとする課題】
デバッグシステムによっては、大容量のトレースメモリを確保できない場合があり、その場合は少量のトレースデータしか記録できず、長時間にわたるトレースデータの記録が困難であるという課題があった。
【0004】
したがって、この発明の目的は、限られたメモリ容量の中でより多くのデータが記録できるプログラムトレースデータ記録方法およびトレースメモリを提供することである。
【0005】
【課題を解決するための手段】
請求項1記載のプログラムトレースデータ記録方法は、プログラム実行のトレースデータをトレースメモリに書き込むプログラムトレースデータ記録方法であって、
最初のトレースデータに対しては、タイムスタンプサイズを0としてトレースメモリに書き込み、そのタイムスタンプ値をタイムスタンプ保存バッファに記録するステップと、
2番目以降のトレースデータに対しては、そのトレースデータのタイムスタンプ値からタイムスタンプ保存バッファに保存されたタイムスタンプ値を減算した値と値の格納サイズをトレースメモリに記録し、2番目以降のトレースデータのタイムスタンプ値でタイムスタンプ保存バッファの値を更新するステップを含むものである。
【0006】
請求項1記載のプログラムトレースデータ記録方法によれば、トレースデータのタイムスタンプ値をそのままトレースメモリに記録せずに、前トレースデータのタイムスタンプ値からの差分値とそのサイズを記録することにより、タイムスタンプ値が占めるメモリ量を低減する。このように、トレースデータの構成およびトレースメモリの構成を適切に行うことにより、限られたメモリ容量の中でより多くのデータが記録できるプログラムトレースデータ記録方法を提供することができる。
【0007】
請求項2記載のプログラムトレースデータ記録方法は、プログラム実行のトレースデータをトレースメモリに書き込むプログラムトレースデータ記録方法であって、トレースメモリがトレースデータ種別の数のブロックに分割され、その各ブロックがトレースデータ種別に1対1に対応したものであり、トレースデータの書き込み時に、トレースデータの種別を調べ、トレースデータの種別に対応したトレースメモリのブロックにトレースデータを書き込むことを特徴とするものである。
【0008】
請求項2記載のプログラムトレースデータ記録方法によれば、トレースメモリをデータ種別ごとのブロックに分割することにより、個々のデータにデータ種別を示す領域を不要にし、その分のメモリ量を削減することができ、したがって請求項1と同様な効果がある。
【0009】
請求項3記載のトレースメモリは、プログラム実行のトレースデータを書き込むトレースメモリであって、
データ種別と同じ個数の管理データからなる管理データ領域と、複数個のブロックからなるブロック領域とを有し、
管理データは、データ種別と、先頭ブロック番号と、最後にデータを書き込んだ書き込みブロック番号と、書き込みセクション番号で構成され、
ブロックは1個のリンクブロック番号と、複数個のセクションで構成され、
セクションは先頭のセクションから順にデータが書き込まれ、
リンクブロック番号は、すべてのセクションにデータが書き込まれていてかつ同じデータ種別の次のデータが存在する場合は、データが格納されているブロック番号が格納され、条件を満たさない場合はブロックが存在しないことを示す識別番号が格納されることを特徴とするものである。
【0010】
請求項3記載のトレースメモリによれば、データ種別を格納するためのメモリ領域を削減することが可能になるので、請求項1と同様な効果がある。
【0011】
請求項4記載のプログラムトレースデータ記録方法は、プログラム実行のトレースデータを請求項3に記載のトレースメモリに書き込むプログラムトレースデータ記録方法であって、対応するデータ種別の書き込みブロックのセクションにすべてデータが書き込まれ、かつ新たにブロックが割り当てることができない場合に、書き込みブロックのリンクブロック番号に先頭ブロック番号を書き込み、管理データの書き込みブロック番号および書き込みセクション番号をそれぞれ先頭ブロック番号および先頭セクション番号に変更した後、先頭ブロック番号を先頭ブロック番号のブロックのリンクブロック番号に変更して、書き込みセクション番号のさすセクションにデータを書き込むことを特徴とするものである。
【0012】
請求項4記載のプログラムトレースデータ記録方法によれば、トレースデータを書き込むためのメモリが不足した場合、使用済みブロックメモリの中で消去可能なブロックにトレースデータを書き込むことで、有限なメモリブロックを繰り返し使うことができる。
【0013】
請求項5記載のプログラムトレースデータ記録方法は、プログラム実行のトレースデータをトレースメモリに書き込むプログラムトレースデータ記録方法であって、
トレースメモリはデータ種別と同じ個数の基本データからなる基本データ領域とデータ格納拡張領域を有し、
基本データはデータ種別と拡張領域先頭オフセットと拡張領域サイズとデータ書き込み位置とデータ格納領域で構成し、
初期状態ですべての基本データの拡張領域サイズは0に設定し、書き込み位置はデータ格納領域の先頭位置を設定し、
トレースデータの書き込み時に、データ種別に対応する基本データのデータ書き込み位置にデータを書き込み、
データ格納領域に空き領域があれば書き込み位置は書き込んだデータの直後に設定し、空き領域がなければ、データ格納領域の先頭データと末尾データのタイムスタンプの差分値を算出し、差分値をもとにデータ拡張領域サイズを求め、拡張領域先頭オフセットと拡張領域サイズとを設定し、以下データ格納拡張領域の先頭から順にデータを書き込んでいくことを特徴とするものである。
【0014】
請求項5記載のプログラムトレースデータ記録方法によれば、請求項1と同様な効果のほか、データ格納拡張領域に不要なサイズのブロックを確保することなく、必要なサイズのブロックを確保できる。
【0015】
【発明の実施の形態】
(実施の形態1)
図1および図2を参照して、本発明の第1の実施形態について説明する。図1は、第1の実施形態にかかるプログラムトレースデータ記録方法を示すフローチャートである。図2(a)は、トレースデータの構成を示し、図2(b)はトレースメモリに保存するトレースデータの構成を示す。図2(a)に示すように、トレースデータは固有データとトレースデータに対応するイベントが発生した時刻を示すタイムスタンプ値とから構成される。ステップ101でまず、最初のトレースデータかどうかを判定し、最初のトレースデータの場合は、ステップ102で、タイムスタンプサイズBに0を設定し、ステップ103でタイムスタンプサイズBと固有データをトレースメモリへ記録し、ステップ107でタイムスタンプ保存バッファにタイムスタンプ値Aを保存する。2番目以降のトレースデータの場合は、ステップ104でそのタイムスタンプ値Aから既にタイムスタンプ保存バッファに保存されたタイムスタンプの値Dを減算してタイムスタンプ差分値Cを計算し、ステップ105でタイムスタンプ差分値Cを記録するのに必要なタイムスタンプサイズBを計算し、ステップ106でタイムスタンプサイズB、タイムスタンプ差分値Cと固有データをトレースメモリへ記録し、ステップ107で新たなタイムスタンプ値Aをタイムスタンプ保存バッファへ保存する。ステップ108で次のトレースデータの発生を待ち、トレースデータが発生すれば、ステップ101から処理を繰り返す。
【0016】
このようにして、トレースメモリに記録するトレースデータは図2(b)に示すように、固有データ、タイムスタンプサイズB、タイムスタンプ差分値Cとから構成される。タイムスタンプ差分値Cはタイムスタンプ値Aと比較すると値が小さいため、タイムスタンプ差分値Cを記録するのに必要なメモリサイズは、タイムスタンプ値Aの場合よりも小さくてすむ。例えばタイムスタンプ値が32ビットデータで出力され、タイムスタンプ差分値が50、タイムスタンプサイズ指定領域が4ビットの場合、タイムスタンプ値をそのままトレースメモリに記録すると32ビット必要だが、この発明の実施形態を適用すると、差分値は6ビットですむので、タイムスタンプサイズ指定領域を加えても10ビットで済み、22ビット削減することが可能になる。
【0017】
このように、トレースデータのタイムスタンプ値をそのままトレースメモリに記録せずに、前トレースデータのタイムスタンプ値からの差分値とそのサイズを記録することにより、タイムスタンプ値が占めるメモリ量を低減することができる。
【0018】
(実施の形態2)
以下、本発明の第2の実施形態について図3と図4を参照して説明する。図3(a)は、従来の方法でトレースデータを記録したトレースメモリの様子を、図3(b)は本実施形態にしたがってトレースデータを記録したトレースメモリの様子を示す。図3(b)に示すように、データ種別の数だけ、トレースメモリをブロックに分割し、それぞれのブロックに1対1にデータ種別に対応付けする。トレースデータは、その種類を示すデータ種別とその他のデータから構成される。その他のデータとは、先の実施形態で説明したような固有データやタイムスタンプである。
【0019】
図4は本実施形態にかかる処理手順のフローチャートである。まずステップ401で、データの種別を調べ、それに対応するメモリブロック内のデータ書き込み位置を求める。ステップ402でメモリブロックの空き領域を調べ、メモリブロックにデータを書き込むのに十分な領域がなければ、ステップ403で書き込み位置をメモリブロックの先頭にする。つまり古いデータの上に上書きしていくことになる。いずれの場合もステップ404で書き込み位置へデータ種別以外のデータを記入し、その直後のメモリアドレスにデータ書き込み位置を設定する。これにより、各データにデータ種別を記録する必要がないため、データ種別を格納するメモリ領域を削減することが可能になる。
【0020】
(実施の形態3)
本発明の第3の実施形態について、図5、図6を参照して説明する。図5は、本実施形態におけるトレースメモリの構成を示す。図5において、トレースメモリは管理データ領域501とブロック領域502で構成する。管理データ領域501は、複数個の管理データからなり、データ種別と1対1に対応する。すなわち、データ種別の数と同数の管理データが存在する。ブロック領域は複数個のブロックで構成し、先頭から1,2,3、‥とブロック番号を割り当てる。503は、各管理データの構成を示す。すなわち、管理データの構成503に示すように、管理データはデータ種別、先頭ブロック番号、最後にデータを書き込んだ書き込みブロック番号、書き込みセクション番号の4つのデータで構成する。データ種別は、データ種別を示す番号を格納する。先頭ブロック番号は、トレースデータを格納するブロックのうち、最初に書き込むブロック番号を格納する。書き込みセクション番号は、次にデータを書き込むとき、書き込むブロック内のセクション番号(あとで説明)を格納する。ブロックの構成504は、次に書き込むブロック番号を格納するリンクブロック番号とトレースデータを格納する複数個のセクションで構成する。セクションには先頭のセクションから順にデータが書き込まれる。リンクブロック番号は、すべてのセクションにデータが書き込まれていてかつ同じデータ種別の次のデータが存在する場合は、そのデータが格納されているブロック番号が格納され、この条件を満たさない場合はブロックが存在しないことを示す識別番号が格納される。
【0021】
図6は本実施形態におけるデータ格納例の説明図で、図6(a)は従来のデータ格納例を、図6(b)は本発明の第3の実施形態におけるデータ格納例を示す。図6において、601は管理データ領域、602はブロックデータ領域を示す。トレースデータはデータ種別#1とデータ種別#2があり、603、604はそれぞれデータ種別#1、データ種別#2の管理データを示す。管理データ603は、データ種別#1のデータの先頭ブロック番号は1,書き込みブロック番号は3、書き込みセクション番号は2であることを示している。管理データ604は、データ種別#2のデータの先頭ブロック番号は2、書き込みブロック番号は2、書き込みセクション番号は991であることを示している。605、606,607はそれぞれブロック1、ブロック2、ブロック3を示す。この例では、各ブロックに1000個のセクションがあり、ブロック1のセクション1、2,1000にそれぞれA,D,Fのいずれもデータ種別#1のデータが格納されている。ブロック1のセクションには空きがなく、ブロック1のリンクブロック番号に3がかかれているので、データ種別#1の次のデータはブロック3に格納されていることがわかる。ブロック3ではセクション1にGが格納されており、セクション2以降は空であり、次にデータが書き込まれるときはセクション2に書き込まれる。この情報は、管理データ603の書き込みブロック番号と書き込みセクション番号に設定されている。また、ブロック3には空きセクションがあり、ブロック3のあとにブロックを割り当てていないので、リンクブロック番号はブロックが存在しないことを示す識別番号0を設定している。
【0022】
同様にブロック2では、リンクブロック番号が0でブロック2のあとにブロックが存在せず、またセクション991以降が空になっていることが示されている。
【0023】
これにより、従来のデータ格納方法では、各データごとにデータ種別を記録しているが、本発明の実施形態によればその必要がないため、データ種別を格納するためのメモリ領域を削減することが可能になる。またデータ種別によりデータ量のちがいが生じるが、書き込み中に必要に応じて動的にメモリブロックを割り当てるので、各データ種別に割り当てるメモリ量をあらかじめ決める必要はなく、メモリを有効に利用することができる。
【0024】
(実施の形態4)
図7を参照して、本発明の第4の実施形態について説明する。図7は第3の実施の形態のトレースメモリを用いて、第4の実施形態にかかるプログラムトレースデータ記録方法の手順を示すフローチャートである。ステップ701ではまず、トレースデータの種別を調べ、対応するメモリブロックを検索する。ステップ702では検索したメモリブロックに空き領域が存在すれば、ステップ709でトレースデータの書き込みを行う。ステップ702でメモリブロックに空き領域が存在しなかった場合、未使用ブロックメモリが存在するかどうかを検索する。ステップ703で未使用ブロックメモリが存在した場合、ステップ704で書き込みブロック番号に未使用ブロック番号を代入する。その後、ステップ705で書き込みセクション番号に先頭セクション番号を代入する。そして、ステップ709でトレースデータの書き込みを行う。ステップ703で未使用ブロックメモリが存在しなかった場合、ステップ703aで書き込みブロックのリンクブロック番号に先頭ブロック番号を代入し、ステップ706で書き込みブロック番号に先頭ブロック番号を代入する。ステップ707で書き込みセクション番号に先頭セクション番号を代入し、ステップ708で先頭ブロック番号に、前の先頭ブロック番号(今の書き込みブロック番号と同等)のブロックのリンクブロック番号を代入する。そして、ステップ709で書き込みセクション番号のさすセクションにトレースデータの書き込みを行う。
【0025】
このようにして、トレースデータを書き込むためのメモリが不足した場合、使用済みブロックメモリの中で消去可能なブロック(通常は、存在するデータの中で最初に書き込まれたデータが書き込まれているブロック)にトレースデータを書き込むことで、有限なメモリブロックを繰り返し使うことができる。
【0026】
(実施の形態5)
図8を参照して、本発明の第5の実施形態について説明する。図8は第5の実施形態にかかるトレースメモリの構成を示す。トレースメモリは基本データ領域801とデータ格納拡張領域802で構成する。基本データ領域801は、複数個の基本データからなり、データ種別と1対1に対応する。すなわち、データ種別の数と同数の基本データが存在する。データ格納拡張領域802は基本データの構成803のデータ格納領域の空き領域がなくなった場合にトレースデータを書き込むために使用する。ブロックのサイズは固定ではなく可変である。803は各基本データの構成を示す。基本データの構成803は、基本データはデータ種別、拡張領域先頭オフセット、拡張領域サイズ、データ書き込み位置、データ格納領域の5つで構成する。データ種別は、データ種別を示す番号を格納する。拡張領域先頭オフセットは、データ格納領域に空き領域がなくなった際に次にトレースデータを書き込むために使用するブロックがどこに存在するかを示すオフセットであり、拡張領域サイズは、そのブロックのサイズである。データ書き込み位置は、次にデータを書き込むとき、書き込むブロック内の位置を格納する。データ格納領域は、最初にトレースデータを書き込む領域である。ブロックの構成805は、トレースデータで構成される。
【0027】
初期状態ですべての基本データの拡張領域サイズは0に設定し、書き込み位置はデータ格納領域の先頭位置を設定する。したがって、トレースデータは最初、対応するデータ識別のデータ格納領域に書き込まれていく。こうして、トレースデータの書き込み時に、データ種別に対応する基本データのデータ書き込み位置にデータを書き込み、データ格納領域に空き領域があれば書き込み位置は書き込んだデータの直後に設定する。
【0028】
データ格納領域に空き領域がなくなった場合、新たにデータ格納拡張領域802にブロック領域を確保し、そのブロックにトレースデータを格納していく。データ格納領域にブロック領域を確保する際、データ格納領域の先頭データと末尾データのタイムスタンプの差分値を算出し、差分値をもとにデータ拡張領域サイズを求め、拡張領域先頭オフセットと拡張領域サイズとを設定し、以下データ格納拡張領域の先頭から順にデータを書き込んでいく。すなわち、基本データのデータ格納領域に書き込まれた最初のデータを書き込んでから最後のデータを書き込むまでの時間を取得し、新たに確保するデータ格納拡張領域の可変長ブロックを、その時間と基本データのデータ格納領域のサイズをもとに、計算式「新たに確保するブロックサイズ=(基本データのデータ格納領域のサイズ)/(最後のデータを書き込んだ時間−最初のデータを書き込んだ時間)×係数」により算出したサイズのメモリを確保する。
【0029】
これにより、データ格納拡張領域に不要なサイズのブロックを確保することなく、必要なサイズのブロックを確保できる。
【0030】
その他の実施の形態として、つぎのものがある。すなわち、プログラムトレースデータ記録方法は、プログラム実行のトレースデータをトレースメモリに書き込む処理において、トレースメモリをデータ管理領域と複数個のブロックに分割し、管理データ領域はトレースデータ種別とトレースデータ種別のデータを格納するブロックとの対応を管理し、トレースデータ書き込み前は、複数個のブロックはすべて未使用ブロックとして管理し、最初のトレースデータ書き込み時に、トレースデータの種別を調べ、未使用ブロックの中から一つのブロックをとりだし、ブロックをトレースデータ種別に対応させてデータ管理領域に登録し、トレースデータをブロックのデータ格納領域に書き込み、2番目以降のトレースデータ書き込み時には、書き込むトレースデータの種別に対応するブロックを管理領域を参照して検索し、ブロックのデータ格納領域に空き領域があればトレースデータを書き込み、空き領域がなければ、未使用ブロックの中から一つのブロックをとりだしてトレースデータ種別に対応させ、トレースデータをブロックに書き込むことを特徴とする。
【0031】
【発明の効果】
請求項1記載のプログラムトレースデータ記録方法によれば、トレースデータのタイムスタンプ値をそのままトレースメモリに記録せずに、前トレースデータのタイムスタンプ値からの差分値とそのサイズを記録することにより、タイムスタンプ値が占めるメモリ量を低減する。このように、トレースデータの構成およびトレースメモリの構成を適切に行うことにより、限られたメモリ容量の中でより多くのデータが記録できるプログラムトレースデータ記録方法を提供することができる。
【0032】
請求項2記載のプログラムトレースデータ記録方法によれば、トレースメモリをデータ種別ごとのブロックに分割することにより、個々のデータにデータ種別を示す領域を不要にし、その分のメモリ量を削減することができ、したがって請求項1と同様な効果がある。
【0033】
請求項3記載のトレースメモリによれば、データ種別を格納するためのメモリ領域を削減することが可能になるので、請求項1と同様な効果がある。
【0034】
請求項4記載のプログラムトレースデータ記録方法によれば、トレースデータを書き込むためのメモリが不足した場合、使用済みブロックメモリの中で消去可能なブロックにトレースデータを書き込むことで、有限なメモリブロックを繰り返し使うことができる。
【0035】
請求項5記載のプログラムトレースデータ記録方法によれば、請求項1と同様な効果のほか、データ格納拡張領域に不要なサイズのブロックを確保することなく、必要なサイズのブロックを確保できる。
【図面の簡単な説明】
【図1】本発明の第1の実施形態におけるプログラムトレースデータ記録方法の手順を示すフローチャートである。
【図2】第1の実施の形態におけるトレースデータの様子を示す説明図である。
【図3】本発明の第2の実施形態にかかるトレースメモリの様子を示す説明図である。
【図4】第2の実施形態において、プログラムトレースデータ記録方法の手順を示すフローチャートである。
【図5】本発明の第3の実施形態におけるトレースメモリの構成を示す説明図である。
【図6】(a)は従来のデータ格納例を示す説明図、(b)は第3の実施形態のデータ格納例を示す説明図である。
【図7】本発明の第4の実施形態におけるプログラムトレースデータ記録方法の手順を示すフローチャートである。
【図8】本発明の第5の実施形態におけるトレースメモリの構成を示す説明図である。
【符号の説明】
501 管理データ領域
502 ブロックデータ領域
503 管理データの構成
504 ブロックの構成
601 管理データ領域
602 ブロックデータ領域
801 基本データ領域
802 データ格納拡張領域
803 基本データの構成
804 データ格納領域の構成
805 ブロックの構成
806 拡張領域サイズ[0001]
TECHNICAL FIELD OF THE INVENTION
The present invention relates to a program trace data recording method and a trace memory in a debug tool for writing trace data, which is a program execution history, to a trace memory during execution of a software program, and reading and analyzing the trace data after the program ends. .
[0002]
[Prior art]
In the program trace data recording method, each trace data is composed of a trace log type, a time stamp, and other unique information. Each time an observation event occurs during the execution of a program, the trace data is generated. Record in order. When the trace memory runs out of free space, it returns to the start address of the trace memory and overwrites old trace data.
[0003]
[Problems to be solved by the invention]
In some debug systems, a large amount of trace memory cannot be secured. In this case, only a small amount of trace data can be recorded, and it is difficult to record trace data for a long time.
[0004]
Therefore, an object of the present invention is to provide a program trace data recording method and a trace memory capable of recording more data in a limited memory capacity.
[0005]
[Means for Solving the Problems]
2. A program trace data recording method according to
Writing the time stamp size to the trace memory with the time stamp size being 0 for the first trace data, and recording the time stamp value in the time stamp storage buffer;
For the second and subsequent trace data, the value obtained by subtracting the time stamp value stored in the time stamp storage buffer from the time stamp value of the trace data and the storage size of the value are recorded in the trace memory, and the second and subsequent trace data are recorded. Updating the value of the time stamp storage buffer with the time stamp value of the trace data.
[0006]
According to the program trace data recording method of the present invention, the difference value from the time stamp value of the previous trace data and its size are recorded without recording the time stamp value of the trace data in the trace memory as it is, Reduce the amount of memory occupied by timestamp values. As described above, by appropriately configuring the trace data and the trace memory, it is possible to provide a program trace data recording method capable of recording more data within a limited memory capacity.
[0007]
3. The program trace data recording method according to
[0008]
According to the program trace data recording method of the present invention, by dividing the trace memory into blocks for each data type, an area indicating the data type is not required for each data, and the amount of memory is reduced accordingly. Therefore, the same effect as the first aspect can be obtained.
[0009]
4. The trace memory according to claim 3, wherein the trace memory writes trace data of a program execution.
It has a management data area consisting of management data of the same number as the data type, and a block area consisting of a plurality of blocks,
The management data includes a data type, a start block number, a write block number in which data was last written, and a write section number.
A block is composed of one link block number and multiple sections.
Sections are written with data in order from the first section,
The link block number stores the block number where the data is stored when data is written to all sections and the next data of the same data type exists.If the condition is not satisfied, the block exists. In this case, an identification number indicating not to be stored is stored.
[0010]
According to the trace memory of the third aspect, it is possible to reduce the memory area for storing the data type, so that the same effect as the first aspect is obtained.
[0011]
According to a fourth aspect of the present invention, there is provided a program trace data recording method for writing trace data of a program execution into a trace memory according to the third aspect, wherein all data is stored in a section of a write block of a corresponding data type. When a new block cannot be allocated when data is written, the first block number is written to the link block number of the write block, and the write block number and write section number of the management data are changed to the first block number and first section number, respectively. Thereafter, the head block number is changed to the link block number of the block of the head block number, and data is written in the section indicated by the write section number.
[0012]
According to the program trace data recording method of the present invention, when the memory for writing the trace data runs short, the trace data is written to the erasable block in the used block memory, so that the finite memory block can be stored. Can be used repeatedly.
[0013]
6. A program trace data recording method according to claim 5, wherein said program trace data recording method writes trace data of program execution into a trace memory.
The trace memory has a basic data area consisting of the same number of basic data as the data type and a data storage extension area,
The basic data is composed of a data type, an extension area start offset, an extension area size, a data write position, and a data storage area,
In the initial state, the extension area size of all basic data is set to 0, the write position is set to the top position of the data storage area,
When writing trace data, write data to the data write position of the basic data corresponding to the data type,
If there is free space in the data storage area, the write position is set immediately after the written data.If there is no free space, the difference between the time stamps of the first data and the last data of the data storage area is calculated. Then, a data extension area size is obtained, an extension area start offset and an extension area size are set, and thereafter, data is written in order from the beginning of the data storage extension area.
[0014]
According to the program trace data recording method of the fifth aspect, in addition to the same effects as those of the first aspect, a block of a required size can be secured without securing a block of an unnecessary size in the data storage extension area.
[0015]
BEST MODE FOR CARRYING OUT THE INVENTION
(Embodiment 1)
A first embodiment of the present invention will be described with reference to FIGS. FIG. 1 is a flowchart illustrating a program trace data recording method according to the first embodiment. FIG. 2A shows the configuration of the trace data, and FIG. 2B shows the configuration of the trace data stored in the trace memory. As shown in FIG. 2A, the trace data includes unique data and a time stamp value indicating a time at which an event corresponding to the trace data has occurred. In
[0016]
In this manner, the trace data recorded in the trace memory is composed of the unique data, the time stamp size B, and the time stamp difference value C, as shown in FIG. Since the time stamp difference value C is smaller than the time stamp value A, the memory size required to record the time stamp difference value C is smaller than that of the time stamp value A. For example, when the time stamp value is output as 32-bit data, the time stamp difference value is 50, and the time stamp size designation area is 4 bits, if the time stamp value is directly recorded in the trace memory, 32 bits are required. Is applied, since the difference value is only 6 bits, even if the time stamp size designation area is added, only 10 bits are required, and it is possible to reduce 22 bits.
[0017]
As described above, the amount of memory occupied by the time stamp value is reduced by recording the difference value from the time stamp value of the previous trace data and its size without recording the time stamp value of the trace data in the trace memory as it is. be able to.
[0018]
(Embodiment 2)
Hereinafter, a second embodiment of the present invention will be described with reference to FIGS. FIG. 3A shows a state of a trace memory in which trace data is recorded by a conventional method, and FIG. 3B shows a state of a trace memory in which trace data is recorded according to the present embodiment. As shown in FIG. 3B, the trace memory is divided into blocks by the number of data types, and each block is associated with the data type on a one-to-one basis. The trace data includes a data type indicating the type and other data. The other data is unique data or a time stamp as described in the above embodiment.
[0019]
FIG. 4 is a flowchart of a processing procedure according to the present embodiment. First, in
[0020]
(Embodiment 3)
A third embodiment of the present invention will be described with reference to FIGS. FIG. 5 shows a configuration of the trace memory according to the present embodiment. In FIG. 5, the trace memory includes a
[0021]
6A and 6B are explanatory diagrams of a data storage example according to the present embodiment. FIG. 6A shows a conventional data storage example, and FIG. 6B shows a data storage example according to the third embodiment of the present invention. In FIG. 6,
[0022]
Similarly, in the
[0023]
Thus, in the conventional data storage method, the data type is recorded for each data. However, according to the embodiment of the present invention, it is not necessary to reduce the memory area for storing the data type. Becomes possible. Although the amount of data differs depending on the data type, memory blocks are dynamically allocated as needed during writing, so there is no need to determine in advance the amount of memory to be allocated to each data type, and the memory can be used effectively. it can.
[0024]
(Embodiment 4)
A fourth embodiment of the present invention will be described with reference to FIG. FIG. 7 is a flowchart illustrating a procedure of a program trace data recording method according to the fourth embodiment using the trace memory according to the third embodiment. In
[0025]
In this way, when there is a shortage of memory for writing trace data, an erasable block in the used block memory (usually, a block in which the first written data among existing data is written) By writing the trace data in (), a finite memory block can be used repeatedly.
[0026]
(Embodiment 5)
The fifth embodiment of the present invention will be described with reference to FIG. FIG. 8 shows a configuration of a trace memory according to the fifth embodiment. The trace memory includes a
[0027]
In the initial state, the extension area size of all basic data is set to 0, and the write position is set to the head position of the data storage area. Therefore, the trace data is first written into the data storage area of the corresponding data identification. Thus, at the time of writing the trace data, the data is written at the data write position of the basic data corresponding to the data type, and if there is a free space in the data storage area, the write position is set immediately after the written data.
[0028]
When there is no more free space in the data storage area, a block area is newly secured in the data
[0029]
As a result, a block of a necessary size can be secured without securing a block of an unnecessary size in the data storage extension area.
[0030]
Other embodiments include the following. That is, the program trace data recording method divides the trace memory into a data management area and a plurality of blocks in a process of writing the trace data of the program execution into the trace memory, and the management data area includes the data of the trace data type and the data of the trace data type. Before writing trace data, manage all blocks as unused blocks, check the type of trace data at the time of the first trace data writing, and check the unused blocks from among the unused blocks. One block is taken out, the block is registered in the data management area in correspondence with the trace data type, the trace data is written in the data storage area of the block, and the second and subsequent trace data are written in accordance with the type of trace data to be written. block Search with reference to the management area, write trace data if there is a free area in the data storage area of the block, and if there is no free area, take out one block from unused blocks and make it correspond to the trace data type, It is characterized in that trace data is written in a block.
[0031]
【The invention's effect】
According to the program trace data recording method of the present invention, the difference value from the time stamp value of the previous trace data and its size are recorded without recording the time stamp value of the trace data in the trace memory as it is, Reduce the amount of memory occupied by timestamp values. As described above, by appropriately configuring the trace data and the trace memory, it is possible to provide a program trace data recording method capable of recording more data within a limited memory capacity.
[0032]
According to the program trace data recording method of the present invention, by dividing the trace memory into blocks for each data type, an area indicating the data type is not required for each data, and the amount of memory is reduced accordingly. Therefore, the same effect as the first aspect can be obtained.
[0033]
According to the trace memory of the third aspect, the memory area for storing the data type can be reduced, so that the same effect as the first aspect is obtained.
[0034]
According to the program trace data recording method of the present invention, when the memory for writing the trace data runs short, the trace data is written to the erasable block in the used block memory, so that the finite memory block can be stored. Can be used repeatedly.
[0035]
According to the program trace data recording method of the fifth aspect, in addition to the same effect as that of the first aspect, a block of a required size can be secured without securing a block of an unnecessary size in the data storage extension area.
[Brief description of the drawings]
FIG. 1 is a flowchart showing a procedure of a program trace data recording method according to a first embodiment of the present invention.
FIG. 2 is an explanatory diagram showing a state of trace data according to the first embodiment.
FIG. 3 is an explanatory diagram showing a state of a trace memory according to a second embodiment of the present invention.
FIG. 4 is a flowchart illustrating a procedure of a program trace data recording method in the second embodiment.
FIG. 5 is an explanatory diagram showing a configuration of a trace memory according to a third embodiment of the present invention.
FIG. 6A is an explanatory diagram showing a conventional data storage example, and FIG. 6B is an explanatory diagram showing a data storage example according to the third embodiment.
FIG. 7 is a flowchart illustrating a procedure of a program trace data recording method according to a fourth embodiment of the present invention.
FIG. 8 is an explanatory diagram showing a configuration of a trace memory according to a fifth embodiment of the present invention.
[Explanation of symbols]
Claims (5)
最初のトレースデータに対しては、タイムスタンプサイズを0として前記トレースメモリに書き込み、そのタイムスタンプ値をタイムスタンプ保存バッファに記録するステップと、
2番目以降のトレースデータに対しては、そのトレースデータのタイムスタンプ値から前記タイムスタンプ保存バッファに保存されたタイムスタンプ値を減算した値と前記値の格納サイズを前記トレースメモリに記録し、前記2番目以降のトレースデータの前記タイムスタンプ値で前記タイムスタンプ保存バッファの値を更新するステップを含むプログラムトレースデータ記録方法。A program trace data recording method for writing trace data of program execution to a trace memory,
For the first trace data, write the time stamp size to the trace memory with a time stamp size of 0, and record the time stamp value in a time stamp storage buffer;
For the second and subsequent trace data, a value obtained by subtracting the time stamp value stored in the time stamp storage buffer from the time stamp value of the trace data and the storage size of the value are recorded in the trace memory, A program trace data recording method, comprising a step of updating a value of the time stamp storage buffer with the time stamp value of second and subsequent trace data.
データ種別と同じ個数の管理データからなる管理データ領域と、複数個のブロックからなるブロック領域とを有し、
前記管理データは、前記データ種別と、先頭ブロック番号と、最後にデータを書き込んだ書き込みブロック番号と、書き込みセクション番号で構成され、
前記ブロックは1個のリンクブロック番号と、複数個のセクションで構成され、
前記セクションは先頭のセクションから順にデータが書き込まれ、
前記リンクブロック番号は、すべての前記セクションにデータが書き込まれていてかつ同じデータ種別の次のデータが存在する場合は、前記データが格納されているブロック番号が格納され、前記条件を満たさない場合はブロックが存在しないことを示す識別番号が格納されることを特徴とするトレースメモリ。A trace memory for writing trace data of program execution,
It has a management data area consisting of management data of the same number as the data type, and a block area consisting of a plurality of blocks,
The management data is composed of the data type, a head block number, a write block number in which data was last written, and a write section number,
The block is composed of one link block number and a plurality of sections,
In the section, data is written in order from the first section,
The link block number stores the block number in which the data is stored when data is written in all the sections and the next data of the same data type exists, and does not satisfy the condition. A trace memory in which an identification number indicating that no block exists is stored.
前記トレースメモリはデータ種別と同じ個数の基本データからなる基本データ領域とデータ格納拡張領域を有し、
前記基本データはデータ種別と拡張領域先頭オフセットと拡張領域サイズとデータ書き込み位置とデータ格納領域で構成し、
初期状態ですべての前記基本データの拡張領域サイズは0に設定し、書き込み位置は前記データ格納領域の先頭位置を設定し、
トレースデータの書き込み時に、前記データ種別に対応する前記基本データの前記データ書き込み位置にデータを書き込み、
前記データ格納領域に空き領域があれば前記書き込み位置は書き込んだデータの直後に設定し、空き領域がなければ、前記データ格納領域の先頭データと末尾データのタイムスタンプの差分値を算出し、前記差分値をもとにデータ拡張領域サイズを求め、前記拡張領域先頭オフセットと前記拡張領域サイズとを設定し、以下データ格納拡張領域の先頭から順にデータを書き込んでいくことを特徴とするプログラムトレースデータ記録方法。A program trace data recording method for writing trace data of program execution to a trace memory,
The trace memory has a basic data area consisting of the same number of basic data as the data type and a data storage extension area,
The basic data includes a data type, an extension area head offset, an extension area size, a data write position, and a data storage area,
In the initial state, the extension area size of all the basic data is set to 0, the write position is set to the top position of the data storage area,
When writing trace data, write data to the data write position of the basic data corresponding to the data type,
If there is a free area in the data storage area, the write position is set immediately after the written data.If there is no free area, the difference between the time stamp of the first data and the last data of the data storage area is calculated. A program trace data, wherein a data extension area size is obtained based on a difference value, the extension area start offset and the extension area size are set, and data is sequentially written from the beginning of the data storage extension area. Recording method.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2002189241A JP2004030505A (en) | 2002-06-28 | 2002-06-28 | Program trace data recording method and trace memory |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2002189241A JP2004030505A (en) | 2002-06-28 | 2002-06-28 | Program trace data recording method and trace memory |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| JP2004030505A true JP2004030505A (en) | 2004-01-29 |
Family
ID=31183719
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP2002189241A Pending JP2004030505A (en) | 2002-06-28 | 2002-06-28 | Program trace data recording method and trace memory |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JP2004030505A (en) |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| WO2010097875A1 (en) * | 2009-02-24 | 2010-09-02 | パナソニック株式会社 | Data processing device and method |
| JP2011181068A (en) * | 2010-03-03 | 2011-09-15 | Arm Ltd | Method, apparatus and trace module for generating timestamps |
-
2002
- 2002-06-28 JP JP2002189241A patent/JP2004030505A/en active Pending
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| WO2010097875A1 (en) * | 2009-02-24 | 2010-09-02 | パナソニック株式会社 | Data processing device and method |
| JP2011181068A (en) * | 2010-03-03 | 2011-09-15 | Arm Ltd | Method, apparatus and trace module for generating timestamps |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US6119209A (en) | Backup directory for a write cache | |
| US20060123200A1 (en) | Storage system, and control method and program thereof | |
| CN101136825B (en) | Method and system for asynchronous configuration information management of client/server structure | |
| JP2006012066A (en) | Trace analysis apparatus and trace analysis method | |
| CN113495889B (en) | Distributed object storage method and device, electronic equipment and storage medium | |
| JP2015204125A (en) | Reducing necessary time for writing file to tape medium | |
| JP2004030505A (en) | Program trace data recording method and trace memory | |
| US7552363B2 (en) | Generation of trace elements within a data processing apparatus | |
| US20230326260A1 (en) | Method and device for recording event data in a vehicle | |
| JP5541194B2 (en) | Control device for reading and writing data to flash memory | |
| CN111143182B (en) | Analysis method, device and storage medium for process behavior | |
| CN116910000B (en) | A log processing method, a log storage method and an embedded device | |
| US20040024954A1 (en) | Time stamp management system for disk arrays | |
| CN1677333A (en) | Write process management method and system | |
| CN112988037A (en) | Static wear leveling method, terminal and computer-readable storage medium | |
| US20060026432A1 (en) | Drive tracking system for removable media | |
| TW202014899A (en) | Memory history management system | |
| JP3491379B2 (en) | Information processing apparatus and trace information storage method | |
| JP5206103B2 (en) | Storage device, storage device control system, storage device control method, and program | |
| US11977759B2 (en) | Method for operating a cache memory, cache memory and processing unit | |
| CN112416811A (en) | Garbage recovery method based on data association degree, flash memory and device | |
| JP2002207613A (en) | History collection device and history collection method | |
| CN112131433B (en) | Interval counting query method and device | |
| JP2006127377A (en) | FAT file system | |
| CN110516479A (en) | Data writing method and related device |