752件ヒット
[1-100件を表示]
(0.151秒)
ライブラリ
クラス
-
ARGF
. class (22) - Array (22)
- Binding (10)
- Coverage (6)
- Enumerator (33)
-
Enumerator
:: Lazy (44) - Float (10)
- IO (11)
- Integer (66)
- Object (44)
-
Rake
:: FileCreationTask (11) -
Rake
:: FileTask (11) -
Rake
:: Task (11) - Socket (44)
-
Socket
:: AncillaryData (11) - String (11)
- Thread (16)
-
Thread
:: ConditionVariable (22) - ThreadsWait (60)
モジュール
- Benchmark (33)
- Etc (11)
- Kernel (22)
- Process (33)
-
Socket
:: Constants (44)
キーワード
- * (33)
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (11) - ERB (11)
-
NEWS for Ruby 2
. 5 . 0 (7) -
NEWS for Ruby 3
. 0 . 0 (4) - Numeric (11)
-
PC
_ TIMESTAMP _ RESOLUTION (11) - Rubyで使われる記号の意味(正規表現の複雑な記号は除く) (11)
- Rubyの起動 (11)
-
SCM
_ TIMESTAMP (22) -
SCM
_ TIMESTAMPNS (22) -
SO
_ TIMESTAMP (22) -
SO
_ TIMESTAMPNS (22) - ThreadGroup (11)
-
all
_ waits (18) -
at
_ exit (11) - benchmark (11)
- bigdecimal (11)
- bm (11)
- broadcast (11)
-
clock
_ gettime (11) - downto (22)
- empty? (6)
-
enum
_ for (44) - eof (11)
- eof? (11)
- finished? (6)
- join (6)
-
join
_ nowait (6) -
line
_ stub (6) -
local
_ variables (10) - measure (11)
- modified? (11)
- new (6)
- next (11)
-
next
_ wait (6) -
prev
_ float (10) -
rb
_ time _ timespec _ new (9) -
report
_ on _ exception (8) -
report
_ on _ exception= (8) - select (11)
- signal (11)
- threads (6)
-
to
_ enum (44) - upto (22)
- waitall (11)
-
with
_ object (22) - xmlrpc (3)
- クラス/メソッドの定義 (11)
- 制御構造 (11)
- 変数と定数 (11)
- 演算子式 (11)
検索結果
先頭5件
-
Integer
# times -> Enumerator (21326.0) -
self 回だけ繰り返します。 self が正の整数でない場合は何もしません。
...self - 1 までの数値が渡されます。
//emlist[][ruby]{
3.times { puts "Hello, World!" } # Hello, World! と3行続いて表示される。
0.times { puts "Hello, World!" } # 何も表示されない。
5.times {|n| print n } # 01234 と表示される。
//}
@see Integer#upt......o, Integer#downto, Numeric#step... -
Process
. # times -> Process :: Tms (21301.0) -
自身のプロセスとその子プロセスが消費したユーザ/システム CPU 時間の積算を Process::Tms オブジェクトで返します。 時間の単位は秒で、浮動小数点数で与えられます。
...ム CPU 時間の積算を
Process::Tms オブジェクトで返します。
時間の単位は秒で、浮動小数点数で与えられます。
@raise NotImplementedError メソッドが現在のプラットフォームで実装されていない場合に発生します。
@see Process::Tms... -
Integer
# times {|n| . . . } -> self (21226.0) -
self 回だけ繰り返します。 self が正の整数でない場合は何もしません。
...self - 1 までの数値が渡されます。
//emlist[][ruby]{
3.times { puts "Hello, World!" } # Hello, World! と3行続いて表示される。
0.times { puts "Hello, World!" } # 何も表示されない。
5.times {|n| print n } # 01234 と表示される。
//}
@see Integer#upt......o, Integer#downto, Numeric#step... -
VALUE rb
_ time _ timespec _ new(const struct timespec *ts , int offset) (12312.0) -
引数 ts、offset を元に Time オブジェクトを作成して返します。
...ram ts timespec 構造体のポインタ
@param offset 協定世界時との時差(秒)。
-86400 < offset < 86400 の場合は指定した時差に、INT_MAX
を指定した場合は地方時、INT_MAX-1 を指定した場合は UTC に
なります。
@r......aise ArgumentError offset に上述の範囲以外の値を指定した場合に発生し
ます。... -
Benchmark
. # benchmark(caption = "" , label _ width = nil , fmtstr = nil , *labels) {|rep| . . . } -> [Benchmark :: Tms] (9324.0) -
Benchmark::Report オブジェクトを生成し、それを引数として与えられたブロックを実行します。
...Benchmark::Report オブジェクトを生成し、それを引数として与えられたブロックを実行します。
基本的には以下のように使います。
ブロックが Benchmark::Tms オブジェクトの配列を返した場合は、
それらの数値も追加の行に表示......す。
@param caption レポートの一行目に表示する文字列を指定します。
@param label_width ラベルの幅を指定します。
@param fmtstr フォーマット文字列を指定します。
この引数を省略すると Benchmark::FORMAT が使用......れます。
@param labels ブロックが Benchmark::Tms オブジェクトの配列を返す場合に指定します。
=== フォーマット文字列
フォーマット文字列として以下が使用できます。
: %u
user CPU time で置き換えられます。Benchmark::Tms#utime
: %... -
Rake
:: FileCreationTask # timestamp -> Rake :: EarlyTime (9300.0) -
どんなタイムスタンプよりも前の時刻をあらわすタイムスタンプを返します。
...どんなタイムスタンプよりも前の時刻をあらわすタイムスタンプを返します。
@see [[FileTask#timestamp]]... -
Rake
:: FileTask # timestamp -> Time | Rake :: LateTime (9300.0) -
ファイルタスクのタイムスタンプを返します。
...ファイルタスクのタイムスタンプを返します。
//emlist[][ruby]{
# Rakefile での記載例とする
task default: "test.txt"
file "test.txt" do |task|
Rake.application.options.build_all = false
task.timestamp # => #<Rake::LateTime:0x2ba58f0>
end
//}... -
Socket
:: AncillaryData # timestamp -> Time (9224.0) -
タイムスタンプ制御メッセージに含まれる時刻を Time オブジェクト で返します。
...* SOL_SOCKET/SCM_TIMESTAMP (micro second) GNU/Linux, FreeBSD, NetBSD, OpenBSD, Solaris, MacOS X
* SOL_SOCKET/SCM_TIMESTAMPNS (nano second) GNU/Linux
* SOL_SOCKET/SCM_BINTIME (2**(-64) second) FreeBSD
require 'socket'
Addrinfo.udp("127.0.0.1", 0).bind {|s1|
Addrinfo.udp("127.0.0.1"......|
s1.setsockopt(:SOCKET, :TIMESTAMP, true)
s2.send "a", 0, s1.local_address
ctl = s1.recvmsg.last
p ctl
#=> #<Socket::AncillaryData: INET SOCKET TIMESTAMP 2009-02-24 17:35:46.775581>
t = ctl.timestamp
p t #=> 2009-02-24 17:35:46 +0900
p t.usec......#=> 775581
p t.nsec #=> 775581000
}
}
@see Socket::Constants::SCM_TIMESTAMP,
Socket::Constants::SCM_TIMESTAMPNS,
Socket::Constants::SCM_BINTIME,
Socket::Constants::SO_TIMESTAMP,
Socket::Constants::SO_TIMESTAMPNS,
Socket::Constants::SO_BINTIME... -
Thread
. report _ on _ exception -> bool (9224.0) -
真の時は、いずれかのスレッドが例外によって終了した時に、その内容を $stderr に報告します。
...を $stderr に報告します。
デフォルトは false です。
Thread.new { 1.times { raise } }
は $stderr に以下のように出力します:
#<Thread:...> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
2: from -e:1:in `block......in <main>'
1: from -e:1:in `times'
これによってスレッドのエラーを早期に捕捉できるようになります。
いくつかのケースでは、この出力を望まないかもしれません。
出力を抑制するには複数の方法があります:
* 例外が......近い場所で rescue して、
その例外でスレッドが終了しないようにするのがより良い方法です。
* Thread#join や Thread#value でそのスレッドの終了を待つことが保証できるなら、
スレッド開始時に Thread.current.report_on_exception =......容を $stderr に報告します。
デフォルトは true です。
Thread.new { 1.times { raise } }
は $stderr に以下のように出力します:
#<Thread:...> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
2: from -e:1:in `blo......ck in <main>'
1: from -e:1:in `times'
これによってスレッドのエラーを早期に捕捉できるようになります。
いくつかのケースでは、この出力を望まないかもしれません。
出力を抑制するには複数の方法があります:
* 例外が... -
ThreadsWait
# threads -> Array (9206.0) -
同期されるスレッドの一覧を配列で返します。
...ドの一覧を配列で返します。
使用例
require 'thwait'
threads = []
3.times {|i|
threads << Thread.new { sleep 1; p Thread.current }
}
thall = ThreadsWait.new(*threads)
p thall.threads
#=> [#<Thread:0x21750 sleep>, #<Thread:0x216c4 sleep>, #<Thread:0x21638 sleep>]...