Пример #1
0
        public void Calculate_PerformanceMetrics()
        {
            var           serialTicks = 192769194.79518071;
            List <double> all         = new List <double>();
            var           gp          = new GnuPlot();

            gp.Set("style data linespoints");
            gp.HoldOn();

            for (int i = 256; i <= 1024; i = i * 2)
            {
                List <long> list = new List <long>();
                for (int j = 0; j < 20; j++)
                {
                    Stopwatch watch = Stopwatch.StartNew();
                    //ArrayExtensions.MaxDegreeOfParallelism = i;

                    FDTDProgram.Calculate();
                    watch.Stop();
                    list.Add(watch.ElapsedTicks);
                }
                all.Add(list.Average());
            }

            gp.Plot(all.Select(x => serialTicks / x));

            gp.Wait();
        }
Пример #2
0
        public void TestMethod1()
        {
            Stopwatch watch = new Stopwatch();

            var gp = new GnuPlot();

            gp.HoldOn();
            for (int j = 0; j < 5; j++)
            {
                List <TimeSpan> list = new List <TimeSpan>();

                for (var i = 1; i <= 16; i++)
                {
                    watch.Start();
                    ParallelIterator.MaxDegreeOfParallelism = i;

                    FDTDProgram.Calculate();
                    watch.Stop();
                    list.Add(watch.Elapsed);
                    watch.Reset();
                }

                gp.Plot(list.Select(x => (double)x.Milliseconds));
            }
            gp.Wait();
        }