267件ヒット
[1-100件を表示]
(0.057秒)
モジュール
- Benchmark (11)
- DRb (22)
- Kernel (99)
- ObjectSpace (88)
- Open3 (22)
-
Profiler
_ _ (6) - Timeout (19)
キーワード
- abort (22)
-
allocation
_ sourcefile (11) -
allocation
_ sourceline (11) - bmbm (11)
- caller (33)
-
caller
_ locations (22) -
define
_ finalizer (22) - exit (11)
- exit! (11)
-
garbage
_ collect (11) -
pipeline
_ start (22) -
primary
_ server (11) -
start
_ profile (6) -
start
_ service (11) - timeout (19)
-
trace
_ object _ allocations _ start (11) -
trace
_ object _ allocations _ stop (11) -
undefine
_ finalizer (11)
検索結果
先頭5件
-
Open3
. # pipeline _ start(*cmds) -> [Thread] (6215.0) -
指定したコマンドのリストをパイプで繋いで順番に実行します。
...のコマンドは
以下のように String か Array で指定します。
commandline にはコマンド全体(例. "nroff -man")を表す
String を指定します。
options には Hash で指定します。
env には環境変数を H......待つためのスレッ
ドの配列を返します。
例:
require "open3"
# xeyesを10秒だけ実行する。
Open3.pipeline_start("xeyes") {|ts|
sleep 10
t = ts[0]
Process.kill("TERM", t.pid)
p t.value #=> #<Process::Status: pid 911 SIGTERM (signal 15)>
}
@... -
Open3
. # pipeline _ start(*cmds) {|wait _ thrs| . . . } -> () (6215.0) -
指定したコマンドのリストをパイプで繋いで順番に実行します。
...のコマンドは
以下のように String か Array で指定します。
commandline にはコマンド全体(例. "nroff -man")を表す
String を指定します。
options には Hash で指定します。
env には環境変数を H......待つためのスレッ
ドの配列を返します。
例:
require "open3"
# xeyesを10秒だけ実行する。
Open3.pipeline_start("xeyes") {|ts|
sleep 10
t = ts[0]
Process.kill("TERM", t.pid)
p t.value #=> #<Process::Status: pid 911 SIGTERM (signal 15)>
}
@... -
DRb
. # start _ service(uri=nil , front=nil , config _ or _ acl=nil) -> () (6202.0) -
dRuby のサービス(サーバ)を起動します。
dRuby のサービス(サーバ)を起動します。
これで起動したサーバはプロセスのプライマリサーバとなります。
すでにプライマリサーバが存在する場合は上書きされます。
uri に URI を文字列で指定すると、それに起動したサービスを bind します。
通常は 'druby://<hostname>:<port>' という形式の URI を指定します。
このときは TCP が通信手段として使われます。
'drbunix:' のような他のプロトコルを指定することもできます。
front でフロントオブジェクト(URI に結び付けられるオブジェクト)を
設定します。
config で H... -
ObjectSpace
. # trace _ object _ allocations _ start -> nil (6202.0) -
オブジェクト割り当てのトレースを開始します。
オブジェクト割り当てのトレースを開始します。
@see ObjectSpace.#trace_object_allocations_stop -
Profiler
_ _ . # start _ profile -> object (6202.0) -
プロファイルの取得を開始します。
プロファイルの取得を開始します。 -
Kernel
. # caller _ locations(start = 1 , length = nil) -> [Thread :: Backtrace :: Location] | nil (244.0) -
現在のフレームを Thread::Backtrace::Location の配列で返します。引 数で指定した値が範囲外の場合は nil を返します。
...。
@param start 開始フレームの位置を数値で指定します。
@param length 取得するフレームの個数を指定します。
@param range 取得したいフレームの範囲を示す Range オブジェクトを指定します。
//emlist[例][ruby]{
def test1(start, length)......locations = caller_locations(start, length)
p locations
p locations.map(&:lineno)
p locations.map(&:path)
end
def test2(start, length)
test1(start, length)
end
def test3(start, length)
test2(start, length)
end
caller_locations # => []
test3(1, nil)
# => ["/Users/user/test.rb:9:in `tes... -
Kernel
. # caller(start = 1) -> [String] | nil (225.0) -
start 段上の呼び出し元の情報を $@ の形式のバックトレース(文字列の配列)として返します。
...
start 段上の呼び出し元の情報を $@
の形式のバックトレース(文字列の配列)として返します。
トップレベルでは空の配列を返します。caller の戻り値を $@ に代入することで
例外の発生位置を設定できます。
引数で指定した......値が範囲外の場合は nil を返します。
@param start long の範囲を超えない正の整数でスタックレベルを指定します。
@param length 取得するスタックの個数を指定します。
@param range 取得したいスタックの範囲を示す Range オブジェ......aller(0)
p caller(1)
p caller(2)
p caller(3)
p caller(4)
end
def bar
foo
end
bar
#=> ["-:2:in `foo'", "-:10:in `bar'", "-:13:in `<main>'"]
# ["-:10:in `bar'", "-:13:in `<main>'"]
# ["-:13:in `<main>'"]
# []
# nil
//}
以下の関数は、caller の要素から [ファイル名,... -
Kernel
. # caller(start , length) -> [String] | nil (225.0) -
start 段上の呼び出し元の情報を $@ の形式のバックトレース(文字列の配列)として返します。
...
start 段上の呼び出し元の情報を $@
の形式のバックトレース(文字列の配列)として返します。
トップレベルでは空の配列を返します。caller の戻り値を $@ に代入することで
例外の発生位置を設定できます。
引数で指定した......値が範囲外の場合は nil を返します。
@param start long の範囲を超えない正の整数でスタックレベルを指定します。
@param length 取得するスタックの個数を指定します。
@param range 取得したいスタックの範囲を示す Range オブジェ......aller(0)
p caller(1)
p caller(2)
p caller(3)
p caller(4)
end
def bar
foo
end
bar
#=> ["-:2:in `foo'", "-:10:in `bar'", "-:13:in `<main>'"]
# ["-:10:in `bar'", "-:13:in `<main>'"]
# ["-:13:in `<main>'"]
# []
# nil
//}
以下の関数は、caller の要素から [ファイル名,... -
Kernel
. # caller _ locations(range) -> [Thread :: Backtrace :: Location] | nil (144.0) -
現在のフレームを Thread::Backtrace::Location の配列で返します。引 数で指定した値が範囲外の場合は nil を返します。
...。
@param start 開始フレームの位置を数値で指定します。
@param length 取得するフレームの個数を指定します。
@param range 取得したいフレームの範囲を示す Range オブジェクトを指定します。
//emlist[例][ruby]{
def test1(start, length)......locations = caller_locations(start, length)
p locations
p locations.map(&:lineno)
p locations.map(&:path)
end
def test2(start, length)
test1(start, length)
end
def test3(start, length)
test2(start, length)
end
caller_locations # => []
test3(1, nil)
# => ["/Users/user/test.rb:9:in `tes... -
Timeout
. # timeout(sec , exception _ class = nil) {|i| . . . } -> object (143.0) -
ブロックを sec 秒の期限付きで実行します。 ブロックの実行時間が制限を過ぎたときは例外 Timeout::Error が発生します。
...ものは実用レベルでは少ないのですが、
Socket などは DNSの名前解決に時間がかかった場合割り込めません
(resolv-replace を使用する必要があります)。
その処理を Ruby で実装しなおすか C 側で Ruby
のスレッドを意識してあげる......い
require 'timeout'
require 'socket'
t = 0.1
start = Time.now
begin
Timeout.timeout(t) {
p TCPSocket.gethostbyname("www.ruby-lang.org")
# (A)
}
ensure
p Time.now - start
end
# 実行例
=> ["helium.ruby-lang.org", [], 2, "210.251.121.214"]
0.689331....../usr/local/lib/ruby/1.6/timeout.rb:37: execution expired (TimeoutError)
from -:6:in `timeout'
from -:6
# gethostbyname が0.1秒かからない場合は例外が発生しないので
# その場合は、t に小さい数値(0.000001のような)に変える。
timeout...