9 attach_function :getlogin, [], :string
11 if Posix.getlogin != Etc.getlogin
12 raise ArgumentError, "FFI getlogin returned incorrect value"
15 puts "Benchmark FFI getlogin(2) performance, #{iter}x"
18 puts Benchmark.measure {
19 iter.times { Posix.getlogin }
23 puts "Benchmark Etc.getlogin performance, #{iter}x"
25 puts Benchmark.measure {
26 iter.times { Etc.getlogin }