Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
5.5.2 - 日本語

Change language to:
English - Français - Português - Русский

Please note that the recommended version of Scilab is 2024.0.0. This page might be outdated.
See the recommended documentation of this function

Scilabヘルプ >> Functions > profiling > profile

profile

関数のプロファイル結果を返す

呼び出し手順

c = profile(fun)

引数

fun

Scilab関数

c

以下のプロファイル結果を含む nx3 行列:

  • c(i,1) : 関数のi行目の実行回数

  • c(i,2) : 関数のi行目を実行する際に費やした累積CPI時間[単位:秒]

  • c(i,3) : 関数のi行目を1回実行した際のインタプリタの 処理負荷の観測量 [任意の単位]

説明

ある関数でprofileを使用するには, この関数についてプロファイル機能を有効にしてある必要があります:

  • add_profiling コマンド.

  • または関数がdeffコマンドで定義された場合, deffのオプション引数に "p" を指定, のどちらか

この関数が一度実行された後,profileをコールすると, 行列が返されます. この行列の各行には,(関数のヘッダ行を含む) 対応する関数の行に関するプロファイル結果が含まれます. この結果は,以下のような コール回数, この行に費やした合計CPU時間, この行の実行にかかったインタプリタ負荷 です:

Number of callsTotal CPU time (s)Interpretor effort
100
3000.10
3003.595
.........

ここでは,関数の3行目が300回コールされ, 合計CPU時間が 3.59秒であることがわかります.

注意: CPU時間の精度の制約(通常は1マイクロ秒)により, 実行時間が非常に速い実行された行は,CPUの合計時間が0と 表示される可能性があります.

// プロファイルする関す
function x=foo(n)
  if n > 0 then
    x = 0;
    for k = 1:n
      s = svd(rand(n, n));
      x = x + s(1);
    end
  else
    x = [];
  end
endfunction

// 関数のプロファイルを有効化
add_profiling("foo");

// 関数を実行
foo(200);

// 関数のプロファイル結果を返す
profile(foo)

参照

  • add_profiling — プロファイル命令を関数に追加.
  • deff — 関数のオンライン定義
  • plotprofile — 関数のプロファイルチャートを表示する
  • showprofile — 関数のプロファイル結果をコンソールに出力
Report an issue
<< plotprofile profiling remove_profiling >>

Copyright (c) 2022-2023 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Wed Apr 01 10:25:14 CEST 2015