るりまサーチ

最速Rubyリファレンスマニュアル検索!
24件ヒット [1-24件を表示] (0.007秒)
トップページ > クエリ:caption[x] > 種類:モジュール関数[x]

別のキーワード

  1. benchmark caption
  2. cgi caption
  3. cgi/html caption
  4. htmlextension caption
  5. tms caption

ライブラリ

モジュール

キーワード

検索結果

Benchmark.#benchmark(caption = "", label_width = nil, fmtstr = nil, *labels) {|rep| ...} -> [Benchmark::Tms] (114.0)

Benchmark::Report オブジェクトを生成し、それを引数として与えられたブロックを実行します。

...ロックが Benchmark::Tms オブジェクトの配列を返した場合は、
それらの数値も追加の行に表示されます。

@param caption レポートの一行目に表示する文字列を指定します。
@param label_width ラベルの幅を指定します。
@param fmtstr...
...ire 'benchmark'

n = 50000

# これは
# Benchmark.bm(7, ">total:", ">avg:") do |x| ... end
# と同じ
Benchmark.benchmark(" "*7 + Benchmark::CAPTION,
7,
Benchmark::FORMAT,
">total:",
">avg:") do |x|

tf = x.repor...

Benchmark.#measure(label = "") { ... } -> Benchmark::Tms (7.0)

与えられたブロックを実行して、経過した時間を Process.#times で計り、 Benchmark::Tms オブジェクトを生成して返します。

...は to_s が定義されているので、
基本的には以下のように使います。

//emlist[][ruby]{
require 'benchmark'

puts Benchmark::CAPTION
puts Benchmark.measure { "a"*1_000_000 }

#=>
#
# user system total real
# 1.166667 0.050000 1.216667 ( 0.571355)
//}...