internal static void runCalibration(int n, long nms)
    {
        long          now     = (System.DateTime.Now.Ticks - 621355968000000000) / 10000;
        long          endTime = now + nms;
        CyclicBarrier b       = new CyclicBarrier(n + 1);

        totalIters.Value = (0);
        NonAtomicInteger a = new NonAtomicInteger();

        for (int j = 0; j < n; ++j)
        {
            new SupportClass.ThreadClass(new System.Threading.ThreadStart(new NACalibrationLoop(endTime, a, b).Run)).Start();
        }
        b.Await();
        b.Await();
        long ipt = totalIters.Value / n;

        if (ipt > loopIters[n])
        {
            loopIters[n] = ipt;
        }
        if (sum.Value == 0)
        {
            System.Console.Out.Write(" ");
        }
    }
 internal NACalibrationLoop(long endTime, NonAtomicInteger obj, CyclicBarrier b)
 {
     this.endTime = endTime;
     this.obj     = obj;
     this.barrier = b;
     obj.set_Renamed(CASLoops.rng.next());
 }
 internal NonAtomicLoop(long iters, NonAtomicInteger obj, CyclicBarrier b)
 {
     this.iters   = iters;
     this.obj     = obj;
     this.barrier = b;
     obj.set_Renamed(CASLoops.rng.next());
 }
    internal static long runNonAtomic(int n, long iters)
    {
        LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer();
        CyclicBarrier            b     = new CyclicBarrier(n + 1, timer);
        NonAtomicInteger         a     = new NonAtomicInteger();

        for (int j = 0; j < n; ++j)
        {
            new SupportClass.ThreadClass(new System.Threading.ThreadStart(new NonAtomicLoop(iters, a, b).Run)).Start();
        }
        b.Await();
        b.Await();
        if (sum.Value == 0)
        {
            System.Console.Out.Write(" ");
        }
        return(timer.Time);
    }
 internal NonAtomicLoop(long iters, NonAtomicInteger obj, CyclicBarrier b)
 {
     this.iters = iters;
     this.obj = obj;
     this.barrier = b;
     obj.set_Renamed(CASLoops.rng.next());
 }
 internal NACalibrationLoop(long endTime, NonAtomicInteger obj, CyclicBarrier b)
 {
     this.endTime = endTime;
     this.obj = obj;
     this.barrier = b;
     obj.set_Renamed(CASLoops.rng.next());
 }
 internal static long runNonAtomic(int n, long iters)
 {
     LoopHelpers.BarrierTimer timer = new LoopHelpers.BarrierTimer();
     CyclicBarrier b = new CyclicBarrier(n + 1, timer);
     NonAtomicInteger a = new NonAtomicInteger();
     for (int j = 0; j < n; ++j)
         new SupportClass.ThreadClass(new System.Threading.ThreadStart(new NonAtomicLoop(iters, a, b).Run)).Start();
     b.Await();
     b.Await();
     if (sum.Value == 0)
         System.Console.Out.Write(" ");
     return timer.Time;
 }
 internal static void runCalibration(int n, long nms)
 {
     long now = (System.DateTime.Now.Ticks - 621355968000000000) / 10000;
     long endTime = now + nms;
     CyclicBarrier b = new CyclicBarrier(n + 1);
     totalIters.Value = (0);
     NonAtomicInteger a = new NonAtomicInteger();
     for (int j = 0; j < n; ++j)
         new SupportClass.ThreadClass(new System.Threading.ThreadStart(new NACalibrationLoop(endTime, a, b).Run)).Start();
     b.Await();
     b.Await();
     long ipt = totalIters.Value / n;
     if (ipt > loopIters[n])
         loopIters[n] = ipt;
     if (sum.Value == 0)
         System.Console.Out.Write(" ");
 }