/mobile Handheld Friendly website
x64 Ubuntu : Intel® Q6600® one core |
Each table row shows performance measurements for this C# Mono program with a particular command-line input value N.
| N | CPU secs | Elapsed secs | Memory KB | Code B | ≈ CPU Load |
|---|---|---|---|---|---|
| 500,000 | 2.70 | 2.75 | 18,908 | 476 | 0% 0% 0% 100% |
| 5,000,000 | 25.29 | 25.31 | 18,912 | 476 | 0% 0% 0% 100% |
| 50,000,000 | 247.26 | 247.40 | 18,908 | 476 | 0% 0% 0% 100% |
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.
Mono JIT compiler version 3.0.3 (tarball Tue Feb 12 21:22:20 PST 2013)
LLVM: yes(3.2svn-mono)
An Introduction to Programming with C# Threads (pdf).
/* The Computer Language Benchmarks Game http://benchmarksgame.alioth.debian.org/ * contributed by Isaac Gouy */ using System; using System.Threading; internal class NamedThread { private int name; private AutoResetEvent signal = new AutoResetEvent(false); private int token = 0; internal NamedThread(int name) { this.name = name; } internal void Run() { while (TokenNotDone()) NextThread().TakeToken(token-1); if (token == 0) Console.WriteLine(name); NextThread().TakeToken(-1); } private bool TokenNotDone() { signal.WaitOne(); return token > 0; } internal NamedThread NextThread() { return ThreadRing.threadRing[ name % ThreadRing.numberOfThreads ]; } internal void TakeToken(int x) { token = x; signal.Set(); } } public class ThreadRing { internal const int numberOfThreads = 503; internal static NamedThread[] threadRing = new NamedThread[503]; public static void Main(string[] args) { for (int i = 0; i < numberOfThreads; i++){ threadRing[i] = new NamedThread(i+1); } foreach (NamedThread t in threadRing) new Thread(new ThreadStart(t.Run)).Start(); threadRing[0].TakeToken( int.Parse(args[0]) ); } }
Wed, 13 Feb 2013 12:35:29 GMT MAKE: mv threadring.csharp threadring.cs /usr/local/bin/mcs -optimize+ -platform:x64 -out:threadring.csharp_run threadring.cs rm threadring.cs 0.23s to complete and log all make actions COMMAND LINE: /usr/local/bin/mono --llvm -O=unsafe threadring.csharp_run 50000000 PROGRAM OUTPUT: 292 <premain>: CommandLine Error: Argument 'misched' defined more than once! <premain>: CommandLine Error: Argument 'print-machineinstrs' defined more than once! -simplifycfg: CommandLine Error: Argument 'misched' defined more than once! -simplifycfg: CommandLine Error: Argument 'print-machineinstrs' defined more than once!