/mobile Handheld Friendly website
x64 Ubuntu : Intel® Q6600® one core |
Each table row shows performance measurements for this Ruby 2.0 program with a particular command-line input value N.
| N | CPU secs | Elapsed secs | Memory KB | Code B | ≈ CPU Load |
|---|---|---|---|---|---|
| 500,000 | Failed | 331 |
Read the ↓ make, command line, and program output logs to see how this program was run.
Read thread-ring benchmark to see what this program should do.
ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-linux]
# The Computer Language Benchmarks Game # http://benchmarksgame.alioth.debian.org # contributed by Klaus Friedel # #require "thread" THREAD_COUNT = 503 class Receiver @next @mailbox def initialize(name) @name = name @mailbox = Queue.new end def next=(n) @next = n end def put(msg) @mailbox.push(msg) end def messageloop while true hopsRemaining = @mailbox.pop if(hopsRemaining == 0) print @name, "\n" exit(0) end @next.put(hopsRemaining - 1) end end end ########## # Main # ########## receivers = [] for i in 0..THREAD_COUNT-1 receivers[i] = Receiver.new(i+1) if(i > 0) receivers[i-1].next = receivers[i] end end #close the ring receivers[THREAD_COUNT-1].next = receivers[0] # start the threads for i in 0..THREAD_COUNT-1 Thread.start(i){|k| receivers[k].messageloop} end receivers[0].put(ARGV[0].to_i) sleep
Mon, 25 Feb 2013 11:25:40 GMT COMMAND LINE: /usr/local/src/ruby-2.0.0-p0/ruby threadring.yarv 500000 PROGRAM FAILED PROGRAM OUTPUT: threadring.yarv:16:in `initialize': uninitialized constant Receiver::Queue (NameError) from threadring.yarv:44:in `new' from threadring.yarv:44:in `block in <main>' from threadring.yarv:43:in `each' from threadring.yarv:43:in `<main>'