コード例 #1
0
        public static async Task DataCollecor(IPerfCounterCollectorUC perfCollector)
        {
            Task recorder = Task.Run(FileRecorder);

            WriteContext = msg =>
            {
                NotificationQueue.Enqueue(priority.top, msg);
                System.Console.WriteLine(msg ?? string.Empty);
            };

            Process.GetCurrentProcess().ProcessName.WriteLine();
            "Enjoy! ipavlu 2017".WriteLine();

            await Task.Delay(2000);

            BenchInfo sequential = Tests[0.ToString()];
            await sequential.Test(sequential, perfCollector, BenchInfo.TestingTimeSpan, 1000000);

            string.Empty.WriteLine();
            string.Empty.WriteLine();

            double steps   = 6;
            double logStep = Math.Pow(2.0, 1.0 / steps);

            int[] spins =
                Enumerable
                .Range(0, 101)
                .Select(i => (int)(1000.0 * Math.Pow(logStep, i)))
                .ToArray()
            ;

            foreach (int spin in spins)
            {
                foreach (BenchInfo info in Tests.Where(x => x.Value.CollectorSupport).Select(x => x.Value))
                {
                    await Task.Delay(2000);

                    await info.Test(info, perfCollector, BenchInfo.TestingTimeSpan, spin);

                    string.Empty.WriteLine();
                    string.Empty.WriteLine();
                }
            }

            ((string)null).WriteLine();
            await recorder;

            WriteContext = System.Console.WriteLine;
        }