示例#1
0
        public static void TestCheckpoint()
        {
            PrimeSearcher primes = new PrimeSearcher();
            Checkpoint <PrimeSearcher> checkpoint = new Checkpoint <PrimeSearcher>();

            try
            {
                primes = checkpoint.Load();
            }
            catch (Exception) { }
            for (long i = 0; i < 100; i++)
            {
                Stopwatch timer = Stopwatch.StartNew();
                primes.Search(10);
                if (timer.ElapsedMilliseconds > 1000)
                {
                    checkpoint.Save(primes);
                    timer.Restart();
                }
            }
            checkpoint.Save(primes);

            primes.PrintResults();
            TestCheckpoint jk = new TestCheckpoint();
            Checkpoint <TestCheckpoint> checkpoint2 = new Checkpoint <TestCheckpoint>();
        }
示例#2
0
        public static void TestCheckpoint()
        {
            PrimeSearcher primes = new PrimeSearcher();
            Checkpoint<PrimeSearcher> checkpoint = new Checkpoint<PrimeSearcher>();
            try
            {
                primes = checkpoint.Load();
            }
            catch (Exception) { }
            for (long i = 0; i < 100; i++)
            {
                Stopwatch timer = Stopwatch.StartNew();
                primes.Search(10);
                if (timer.ElapsedMilliseconds > 1000)
                {
                    checkpoint.Save(primes);
                    timer.Restart();
                }
            }
            checkpoint.Save(primes);

            primes.PrintResults();
            TestCheckpoint jk = new TestCheckpoint();
            Checkpoint<TestCheckpoint> checkpoint2 = new Checkpoint<TestCheckpoint>();
        }