クラス
-
Benchmark
:: Tms (36) -
Zlib
:: ZStream (24)
モジュール
- Benchmark (60)
- GC (24)
-
GC
:: Profiler (48) - ObjectSpace (84)
キーワード
- FORMAT (24)
-
NEWS for Ruby 3
. 1 . 0 (4) -
Profiler
_ _ (6) - benchmark (12)
- bm (12)
- bmbm (12)
-
count
_ objects (12) -
count
_ objects _ size (12) -
each
_ object (48) - format (12)
- measure (12)
-
memsize
_ of _ all (12) - profile (6)
-
raw
_ data (12) - report (12)
- result (12)
- stat (24)
-
total
_ in (12) -
total
_ out (12) -
total
_ time (12)
検索結果
先頭5件
-
Benchmark
:: FORMAT -> String (12.0) -
Benchmark.#benchmark の第三引数のデフォルト値。
...hmark::Tms#cutime
: %Y
子プロセスの system CPU time で置き換えられます。Benchmark::Tms#cstime
: %t
total CPU time で置き換えられます。Benchmark::Tms#total
: %r
実経過時間で置き換えられます。Benchmark::Tms#real
: %n
ラベルで置き換えられます... -
Benchmark
:: Tms # format(fmtstr = nil , *args) -> String (12.0) -
self を指定されたフォーマットで整形して返します。
...hmark::Tms#cutime
: %Y
子プロセスの system CPU time で置き換えられます。Benchmark::Tms#cstime
: %t
total CPU time で置き換えられます。Benchmark::Tms#total
: %r
実経過時間で置き換えられます。Benchmark::Tms#real
: %n
ラベルで置き換えられます... -
Benchmark
:: Tms :: FORMAT -> String (12.0) -
Benchmark.#benchmark の第三引数のデフォルト値。
...hmark::Tms#cutime
: %Y
子プロセスの system CPU time で置き換えられます。Benchmark::Tms#cstime
: %t
total CPU time で置き換えられます。Benchmark::Tms#total
: %r
実経過時間で置き換えられます。Benchmark::Tms#real
: %n
ラベルで置き換えられます... -
GC
. stat(key) -> Numeric (12.0) -
GC 内部の統計情報を Hash で返します。
...:heap_increment=>2,
:heap_live_slot=>6836,
:heap_free_slot=>519,
:heap_final_slot=>0,
:heap_swept_slot=>818,
:total_allocated_object=>7674,
:total_freed_object=>838,
:malloc_increase=>181034,
:malloc_limit=>16777216,
:minor_gc_count=>2,
:major_gc_count=>0,... -
GC
. stat(result _ hash = {}) -> {Symbol => Integer} (12.0) -
GC 内部の統計情報を Hash で返します。
...:heap_increment=>2,
:heap_live_slot=>6836,
:heap_free_slot=>519,
:heap_final_slot=>0,
:heap_swept_slot=>818,
:total_allocated_object=>7674,
:total_freed_object=>838,
:malloc_increase=>181034,
:malloc_limit=>16777216,
:minor_gc_count=>2,
:major_gc_count=>0,... -
GC
:: Profiler . report(out = $ stdout) -> nil (12.0) -
GC::Profiler.result の結果を out に出力します。
...ist[例][ruby]{
GC::Profiler.enable
GC.start
GC::Profiler.report
# => GC 4 invokes.
# Index Invoke Time(sec) Use Size(byte) Total Size(byte) Total Object GC Time(ms)
# 1 0.019 303720 1269840 31746... -
Benchmark
. # measure(label = "") { . . . } -> Benchmark :: Tms (6.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)
//}... -
ObjectSpace
. # count _ objects(result _ hash = {}) -> Hash (6.0) -
オブジェクトを種類ごとにカウントした結果を Hash として返します。
...これを利用すると測定による影響を避けることができます。
@raise TypeError 引数に Hash 以外を与えた場合、発生します。
//emlist[例][ruby]{
ObjectSpace.count_objects # => {:TOTAL=>10000, :FREE=>3011, :T_OBJECT=>6, :T_CLASS=>404, ...}
//}... -
ObjectSpace
. # count _ objects _ size(result _ hash = nil) -> Hash (6.0) -
型ごとのオブジェクトサイズをバイト単位で格納したハッシュを返します。
...う必要があります。特に T_DATA の合計値は正しくないでしょう。
//emlist[例][ruby]{
ObjectSpace.count_objects_size
# => {:TOTAL=>1461154, :T_CLASS=>158280, :T_MODULE=>20672, :T_STRING=>527249, ...}
//}
@raise TypeError result_hash にハッシュ以外を指定した時に... -
Profiler
_ _ (6.0) -
プロファイラの実装です。 Profiler__.start_profile 実行から、Profiler__.stop_profile までの 区間の実行コードのプロファイルを取得します。
...のコードのプロファイルが測定される
Profiler__.print_profile(STDOUT)
# =>
% cumulative self self total
time seconds seconds calls ms/call ms/call name
51.64 1.10 1.10 3 366.67 776.67 Kernel.require
17.37... -
profile (6.0)
-
Ruby プログラムのためのプロファイラです。 プロファイラとは効率改善のための調査に用いられるツールのことです。 profile ライブラリは各メソッドの実行時間に関する統計を出力します。
...-r profile sample/sieve.rb 1000
2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47 … 略 …
% cumulative self self total
time seconds seconds calls ms/call ms/call name
33.87 1.49 1.49 11 135.65 214.49 Fixnum#step
31.38 2....