Ejemplo n.º 1
0
        public static void Run()
        {
            var partitioner   = new StringPartitioner(GetTypes());
            var parallelQuery = from t in partitioner.AsParallel()
                                select EmulateProcessing(t);

            parallelQuery.ForAll(PrintInfo);
        }
        public override void Run()
        {
            var timer         = Stopwatch.StartNew();
            var partitioner   = new StringPartitioner(GetTypes());
            var parallelQuery = from t in partitioner.AsParallel() select EmulateProcess(t);

            parallelQuery.ForAll(PrintInfo);
            int count = parallelQuery.Count();

            timer.Stop();
            Console.WriteLine("------------");
            Console.WriteLine($"Total items : {count}");
            Console.WriteLine($"Time elapsed : {timer.Elapsed}");
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            var timer         = Stopwatch.StartNew();
            var partitioner   = new StringPartitioner(GetTypes());
            var parallelQuery = from t in partitioner.AsParallel()
                                //									.WithDegreeOfParallelism(1)
                                select EmulateProcessing(t);

            parallelQuery.ForAll(PrintInfo);
            int count = parallelQuery.Count();

            timer.Stop();
            WriteLine(" ----------------------- ");
            WriteLine($"Total items processed: {count}");
            WriteLine($"Time elapsesd: {timer.Elapsed}");
        }