Esempio n. 1
0
        public static double measureMonteCarlo(double min_time, Random R)
        {
            Stopwatch stopwatch   = new Stopwatch();
            int       Num_samples = 40000000;

            stopwatch.start();
            MonteCarlo.integrate(Num_samples);
            stopwatch.stop();
            return(MonteCarlo.num_flops(Num_samples) / stopwatch.read() * 1E-06);
        }
Esempio n. 2
0
        public static double measureMonteCarlo(double min_time, Random R)
        {
            Stopwatch clock = new Stopwatch();

            int cycles = 1;

            while (true)
            {
                clock.Start();
                MonteCarlo.integrate(cycles);
                clock.Stop();
                if (clock.Elapsed.TotalSeconds >= min_time)
                {
                    break;
                }

                cycles *= 2;
            }
            // approx Mflops
            return(MonteCarlo.num_flops(cycles) / clock.Elapsed.TotalMilliseconds * 1.0e-3);
        }
Esempio n. 3
0
        public static double measureMonteCarlo(double min_time, Random R)
        {
            Stopwatch Q = new Stopwatch();

            int cycles = 1;

            while (true)
            {
                Q.start();
                MonteCarlo.integrate(cycles);
                Q.stop();
                if (Q.read() >= min_time)
                {
                    break;
                }

                cycles *= 2;
            }

            // approx Mflops
            return(MonteCarlo.num_flops(cycles) / Q.read() * 1.0e-6);
        }