private void UruchamianieObliczenPi()
        {
            int czasPoczatkowy = Environment.TickCount;

            OutputProvider.ShowStartLabel();
            double pi = PiCalculator.ObliczPi(IlośćPrób);

            OutputProvider.ShowResultWithThreadNumber(pi);
            int czasKoncowy = Environment.TickCount;
            int roznica     = czasKoncowy - czasPoczatkowy;

            OutputProvider.ShowTime(roznica);
        }
Beispiel #2
0
 private void UruchamianieObliczenPi()
 {
     try
     {
         OutputProvider.ShowStartLabelOneLine();
         double pi = PiCalculator.ObliczPiWithInnerRandomGenerator(IlośćPrób / IleWatkow);
         OutputProvider.ShowResultWithThreadNumber(pi);
     }
     catch (ThreadAbortException ex)
     {
         OutputProvider.ShowThreadAbortException(ex.Message);
     }
     catch (Exception ex)
     {
         OutputProvider.ShowErrorMessage(ex.Message);
     }
 }
 private static void UruchamianieObliczenPi(object parametr)
 {
     try
     {
         int?indeks = parametr as int?;
         OutputProvider.ShowStartLabel(indeks);
         var ilośćTrafień = PiCalculator.ObliczIlośćTrafień(ilośćPróbWWątku, ref całkowitaIlośćPrób);
         Interlocked.Add(ref całkowitaIlośćTrafień, ilośćTrafień);
         ewht[indeks.Value].Set();
     }
     catch (ThreadAbortException ex)
     {
         OutputProvider.ShowThreadAbortException(ex.Message);
     }
     catch (Exception ex)
     {
         OutputProvider.ShowErrorMessage(ex.Message);
     }
 }
Beispiel #4
0
 private void UruchamianieObliczenPi(object parametr)
 {
     try
     {
         int?indeks = parametr as int?;
         OutputProvider.ShowStartLabel(indeks);
         double pi = PiCalculator.ObliczPiWithInnerRandomGeneratorAndLockSection(IlośćPrób / IleWatkow, _pi);
         _pi += pi;
         OutputProvider.ShowResultWithThreadNumber(pi);
     }
     catch (ThreadAbortException ex)
     {
         OutputProvider.ShowThreadAbortException(ex.Message);
     }
     catch (Exception ex)
     {
         OutputProvider.ShowErrorMessage(ex.Message);
     }
 }
 private void UruchamianieObliczenPi()
 {
     try
     {
         int czasPoczatkowy = Environment.TickCount;
         OutputProvider.ShowStartLabel();
         double pi = PiCalculator.ObliczPi(IlośćPrób);
         OutputProvider.ShowResultWithThreadNumber(pi);
         int czasKoncowy = Environment.TickCount;
         int roznica     = czasKoncowy - czasPoczatkowy;
         OutputProvider.ShowTime(roznica);
     }
     catch (ThreadAbortException ex)
     {
         OutputProvider.ShowThreadAbortException(ex.Message);
     }
     catch (Exception ex)
     {
         OutputProvider.ShowErrorMessage(ex.Message);
     }
 }