If you'd like your model to run faster, the profiler extension may be useful to you. It includes primitives that measure how many times the procedures in your model are called during a run and how long each call takes. You can use this information to where to focus your speedup efforts.
もしモデルの実行速度を速くしたいのであればプロファイラー拡張機能が役に立ちます。この機能はモデルを実行する間にプロシージャが呼び出された回数やどのくらい時間がかかったかを計測するプリミティブを含んでいます。この情報によってスピードアップするためにどこに着目すればよいかがわかります。
The profiler extension is experimental. It is not yet well tested or user friendly. Nonetheless, we think some users will find it useful.
プロファイラー拡張機能は実験的なものです。まだ十分にテストされていませんしユーザーフレンドリーでもありません。ですが、有用に感じてもらえるユーザーもいると考えています。
The profiler extension comes preinstalled. To use the extension in your model, add a line to the top of your Code tab:
プロファイラー拡張機能はプリインストールされています。モデルで拡張機能を使うためには、コードタブの冒頭に次の行を記載してください:
extensions [profiler]
If your model already uses other extensions, then it already has an extensions line in it, so just add profiler to the list.
モデルですでに他の拡張機能を使っている場合は、extensionsという行がすでにあるはずです。その場合は単にprofilerをリストに追加してください。
For more information on using NetLogo extensions, see the Extensions Guide.
NetLogoの拡張機能を使用するうえでのより詳細な情報は拡張機能ガイドを参照してください。
setup ;; set up the model profiler:start ;; start profiling repeat 20 [ go ] ;; run something you want to measure profiler:stop ;; stop profiling print profiler:report ;; view the results profiler:reset ;; clear the data
setup ;; モデルをセットアップ profiler:start ;; プロファイリングを開始 repeat 20 [ go ] ;; 計測したいものを実行 profiler:stop ;; プロファイリングを停止 print profiler:report ;; 結果を見る profiler:reset ;; データをクリア
Code Example: Profiler Example
コード例: Profiler Example
profiler:calls profiler:exclusive-time profiler:inclusive-time profiler:start profiler:stop profiler:reset profiler:report
Reports the number of times that procedure-name was called. If procedure-name is not defined, then reports 0.
プロシージャ名が呼ばれた回数を返します。プロシージャ名が定義されていない場合は0を返します。
Reports the exclusive time, in milliseconds, that procedure-name was running for. Exclusive time is the time from when the procedure was entered, until it finishes, but does not include any time spent in other user-defined procedures which it calls.
プロシージャ名の実行に使われた排他経過時間をミリ秒単位で返します。排他経過時間とは、他のユーザー定義プロシージャの実行に使われた時間を含まない、プロシージャの開始から終了までの時間です。
If procedure-name is not defined, then reports 0.
プロシージャ名が定義されていない場合は0を返します。
Reports the inclusive time, in milliseconds, that procedure-name was running for. Inclusive time is the time from when the procedure was entered, until it finishes.
プロシージャ名の実行に使われた包括経過時間をミリ秒単位で返します。包括経過時間とはプロシージャの開始から終了までの時間です。
If procedure-name is not defined, then reports 0.
プロシージャ名が定義されていない場合は0を返します。
Instructs the profiler to begin recording user-defined procedure calls.
プロファイラーに対して、ユーザーが定義したプロシージャの呼び出しの記録を開始するよう指示します。
Instructs the profiler to stop recording user-defined procedure calls.
プロファイラーに対して、ユーザーが定義したプロシージャの呼び出しの記録を停止するよう指示します。
Instructs the profiler to erase all collected data.
プロファイラーに対して、収集したデータを消去するよう指示します。
Reports a string containing a breakdown of all user-defined procedure calls.
The Calls
column contains the number of times a user-defined procedure was called.
The Incl T(ms)
column is the total time, in milliseconds, it took for the call to complete, including the time spent in other user-defined procedures.
The Excl T(ms)
column is the total time, in milliseconds, spent within that user-defined procedure, not counting other user-define procedures it called.
The Excl/calls
column is an estimate of the time, in milliseconds, spent in that user-defined procedure for each call.
すべてのユーザーが定義したプロシージャの呼び出しの詳細を含む文字列を返します。
Calls
列はユーザーが定義したプロシージャが呼び出された回数を記載しています。
Incl T(ms)
列は、他のユーザー定義のプロシージャに要した時間を含む、呼び出しが完了するまでに要した時間をミリ秒単位で記載しています。
Excl T(ms)
列は、他のユーザー定義のプロシージャに要した時間を含まない、ユーザー定義のプロシージャに要した時間をミリ秒単位で記載しています。
The Excl/calls
列は、ユーザー定義のプロシージャの各回の呼び出しに要した時間をミリ秒単位で推計したものです。
Here is example output:
以下は出力の例です。
Sorted by Exclusive Time Name Calls Incl T(ms) Excl T(ms) Excl/calls CALLTHEM 13 26.066 19.476 1.498 CALLME 13 6.413 6.413 0.493 REPORTME 13 0.177 0.177 0.014 Sorted by Inclusive Time Name Calls Incl T(ms) Excl T(ms) Excl/calls CALLTHEM 13 26.066 19.476 1.498 CALLME 13 6.413 6.413 0.493 REPORTME 13 0.177 0.177 0.014 Sorted by Number of Calls Name Calls Incl T(ms) Excl T(ms) Excl/calls CALLTHEM 13 26.066 19.476 1.498