Ejemplo n.º 1
0
        static void RunLoopParallelism(FileProcesser fp, string encodedMessage)
        {
            ParallelSolver plSolver  = new ParallelSolver(fp);
            Stopwatch      stopwatch = new Stopwatch();

            Console.WriteLine("\r\nloop parallelism:");
            stopwatch.Start();
            var lm = plSolver.DecodeNumberMessageWithLoopParallelism(encodedMessage);

            Console.WriteLine("elapsed time: {0} ms\r\nsolution count: {1}", stopwatch.ElapsedMilliseconds, lm.Count);
            FileProcesser.WriteToFile(lm, "loopParallelism.txt");
        }
Ejemplo n.º 2
0
        static void RunParallelLoadBalancer(FileProcesser fp, string encodedMessage, int taskCount)
        {
            ParallelSolver plSolver  = new ParallelSolver(fp);
            Stopwatch      stopwatch = new Stopwatch();

            Console.WriteLine("\r\nload balancer with {0} task:", taskCount);

            stopwatch.Start();
            var th = plSolver.DecodeNumberMessageWithLoadBalancing(encodedMessage, taskCount).Result;

            Console.WriteLine("elapsed time: {0} ms\r\nsolution count:{1}", stopwatch.ElapsedMilliseconds, th.Count);
            FileProcesser.WriteToFile(th, "loadBalancer.txt");
        }