internal static void report(System.String tag, long runtime, long basetime, int nthreads, long iters) { System.Console.Out.Write(tag); long t = (runtime - basetime) / iters; if (nthreads > NCPUS) { t = t * NCPUS / nthreads; } System.Console.Out.Write(LoopHelpers.rightJustify(t)); //UPGRADE_WARNING: Data types in Visual C# might be different. Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'" double secs = (double)(runtime) / 1000000000.0; System.Console.Out.WriteLine("\t " + secs + "s run time"); }
internal static void oneRun(int i, long iters, bool print) { if (print) { System.Console.Out.WriteLine("threads : " + i + " base iters per thread per run : " + LoopHelpers.rightJustify(loopIters[i])); } long ntime = runNonAtomic(i, iters); if (print) { report("Base : ", ntime, ntime, i, iters); } //UPGRADE_TODO: Method 'java.lang.Thread.sleep' was converted to 'System.Threading.Thread.Sleep' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javalangThreadsleep_long'" System.Threading.Thread.Sleep(new System.TimeSpan((System.Int64) 10000 * 100L)); long atime = runAtomic(i, iters); if (print) { report("Atomic CAS : ", atime, ntime, i, iters); } //UPGRADE_TODO: Method 'java.lang.Thread.sleep' was converted to 'System.Threading.Thread.Sleep' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javalangThreadsleep_long'" System.Threading.Thread.Sleep(new System.TimeSpan((System.Int64) 10000 * 100L)); // long gtime = runUpdaterAtomic(i, iters); // if (print) // report("Updater CAS : ", gtime, ntime, i, iters); // Thread.sleep(100L); long vtime = runVolatile(i, iters); if (print) { report("Volatile : ", vtime, ntime, i, iters); } //UPGRADE_TODO: Method 'java.lang.Thread.sleep' was converted to 'System.Threading.Thread.Sleep' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javalangThreadsleep_long'" System.Threading.Thread.Sleep(new System.TimeSpan((System.Int64) 10000 * 100L)); long stime = runSynched(i, iters); if (print) { report("Synchronized: ", stime, ntime, i, iters); } //UPGRADE_TODO: Method 'java.lang.Thread.sleep' was converted to 'System.Threading.Thread.Sleep' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javalangThreadsleep_long'" System.Threading.Thread.Sleep(new System.TimeSpan((System.Int64) 10000 * 100L)); if (!includeLocks) { return; } long mtime = runLocked(i, iters); if (print) { report("Mutex : ", mtime, ntime, i, iters); } //UPGRADE_TODO: Method 'java.lang.Thread.sleep' was converted to 'System.Threading.Thread.Sleep' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javalangThreadsleep_long'" System.Threading.Thread.Sleep(new System.TimeSpan((System.Int64) 10000 * 100L)); }