るりまサーチ

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

別のキーワード

  1. process fork
  2. process abort
  3. process setrlimit
  4. tracer display_process_id
  5. tracer display_process_id?

モジュール

検索結果

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

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

... Process.#times で計り、
Benchmark
::Tms オブジェクトを生成して返します。

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)
//}...