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>(); }
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>(); }