るりまサーチ

最速Rubyリファレンスマニュアル検索!
11件ヒット [1-11件を表示] (0.014秒)
トップページ > クエリ:label[x] > クエリ:measure[x]

別のキーワード

  1. logger sev_label
  2. _builtin label
  3. _builtin base_label
  4. tms label
  5. location label

ライブラリ

モジュール

検索結果

Benchmark.#measure(label = "") { ... } -> Benchmark::Tms (18208.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)
//}...