トップ 新規 編集 差分 一覧 ソース 検索 ヘルプ RSS ログイン

ruby-prof

プロファイラ。拡張ライブラリとして書かれているため、標準添付のprofile.rbよりもかなり高速。また、結果の出力形式を「テキスト形式(標準)」「テキスト表形式」「HTML表形式」「KCachegrind対応ツリー形式」のうちから選ぶことができる。

ツールとしてもライブラリとしても使用可能。Windows環境の場合、rubygemsのmswin32パッケージをインストールすると楽。

使い方

1. ツールとして使う

% ruby-prof foo.rb
% ruby -runprof foo.rb

2. ライブラリとして使う

require 'ruby-prof'

# Profile the code
result = RubyProf.profile do
  ...
  [code to profile]
  ...
end

# Print a graph profile to text
printer = RubyProf::GraphPrinter.new(result)
printer.print(STDOUT, 0)

最終更新時間:2008年04月02日 05時54分40秒