summaryrefslogtreecommitdiff
path: root/jni/ruby/benchmark/bm_io_select3.rb
blob: 7d0ba1f092bbfef4788994b5d427fc12ba61f6e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# IO.select performance. a lot of fd

ios = []
nr = 100
if defined?(Process::RLIMIT_NOFILE)
  max = Process.getrlimit(Process::RLIMIT_NOFILE)[0]
else
  max = 64
end
puts "max fd: #{max} (results not apparent with <= 1024 max fd)"

(max - 10).times do
  r, w = IO.pipe
  r.close
  ios.push w
end

nr.times do
  IO.select nil, ios
end