Ejemplo n.º 1
0
        public static void XBench(int iters, int which)
        {
            float XC    = -1.248f;
            float YC    = -.0362f;
            float Range = .001f;
            float xmin  = XC - Range;
            float xmax  = XC + Range;
            float ymin  = YC - Range;
            float ymax  = YC + Range;
            float step  = Range / 100f;

            Algorithms.FractalRenderer.Render renderer = GetRenderer(DoNothing, which);

            for (int count = 0; count < iters; count++)
            {
                renderer(xmin, xmax, ymin, ymax, step);
            }
        }
Ejemplo n.º 2
0
        public static void Bench(int iters, int which)
        {
            float XC    = -1.248f;
            float YC    = -.0362f;
            float Range = .001f;
            float xmin  = XC - Range;
            float xmax  = XC + Range;
            float ymin  = YC - Range;
            float ymax  = YC + Range;
            float step  = Range / 1000f; // This will render one million pixels
            float warm  = Range / 100f;  // To warm up, just render 10000 pixels :-)

            Algorithms.FractalRenderer.Render[] renderers = new Algorithms.FractalRenderer.Render[24];
            // Warm up each renderer
            if (!s_silent)
            {
                Console.WriteLine("Warming up...");
            }
            Stopwatch timer         = new Stopwatch();
            int       firstRenderer = (which == -1) ? 0 : which;
            int       lastRenderer  = (which == -1) ? (renderers.Length - 1) : which;

            for (int i = firstRenderer; i <= lastRenderer; i++)
            {
                renderers[i] = GetRenderer(DoNothing, i);
                timer.Restart();
                renderers[i](xmin, xmax, ymin, ymax, warm);
                timer.Stop();
                if (!s_silent)
                {
                    Console.WriteLine("{0}{1}{2}{3}{4} Complete [{5} ms]",
                                      UseIntTypes(i) ? "IntBV  " : "Strict ",
                                      IsVector(i) ? "Vector " : "Scalar ",
                                      IsDouble(i) ? "Double " : "Single ",
                                      UsesADT(i) ? "ADT " : "Raw ",
                                      IsMulti(i) ? "Multi  " : "Single ",
                                      timer.ElapsedMilliseconds);
                }
            }
            if (!s_silent)
            {
                Console.WriteLine(" Run Type                       :      Min      Max    Average    Std-Dev");
            }
            for (int i = firstRenderer; i <= lastRenderer; i++)
            {
                long totalTime = 0;
                long min       = long.MaxValue;
                long max       = long.MinValue;
                for (int count = 0; count < iters; count++)
                {
                    timer.Restart();
                    renderers[i](xmin, xmax, ymin, ymax, step);
                    timer.Stop();
                    long time = timer.ElapsedMilliseconds;
                    max        = Math.Max(time, max);
                    min        = Math.Min(time, min);
                    totalTime += time;
                }
                double avg    = totalTime / (double)iters;
                double stdDev = Math.Sqrt(totalTime / (iters - 1.0)) / avg;
                if (s_silent)
                {
                    Console.WriteLine("Average: {0,0:0.0}", avg);
                }
                else
                {
                    Console.WriteLine("{0}{1}{2}{3}{4}: {5,8} {6,8} {7,10:0.0} {8,10:P}",
                                      UseIntTypes(i) ? "IntBV  " : "Strict ",
                                      IsVector(i) ? "Vector " : "Scalar ",
                                      IsDouble(i) ? "Double " : "Single ",
                                      UsesADT(i) ? "ADT " : "Raw ",
                                      IsMulti(i) ? "Multi  " : "Single ",
                                      min, max, avg, stdDev);
                }
            }
        }
Ejemplo n.º 3
0
 public static void Bench(int iters, int which)
 {
     float XC = -1.248f;
     float YC = -.0362f;
     float Range = .001f;
     float xmin = XC - Range;
     float xmax = XC + Range;
     float ymin = YC - Range;
     float ymax = YC + Range;
     float step = Range / 1000f; // This will render one million pixels
     float warm = Range / 100f; // To warm up, just render 10000 pixels :-)
     Algorithms.FractalRenderer.Render[] renderers = new Algorithms.FractalRenderer.Render[24];
     // Warm up each renderer
     if (!s_silent)
     {
         Console.WriteLine("Warming up...");
     }
     Stopwatch timer = new Stopwatch();
     int firstRenderer = (which == -1) ? 0 : which;
     int lastRenderer = (which == -1) ? (renderers.Length - 1) : which;
     for (int i = firstRenderer; i <= lastRenderer; i++)
     {
         renderers[i] = GetRenderer(DoNothing, i);
         timer.Restart();
         renderers[i](xmin, xmax, ymin, ymax, warm);
         timer.Stop();
         if (!s_silent)
         {
             Console.WriteLine("{0}{1}{2}{3}{4} Complete [{5} ms]",
                 UseIntTypes(i) ? "IntBV  " : "Strict ",
                 IsVector(i) ? "Vector " : "Scalar ",
                 IsDouble(i) ? "Double " : "Single ",
                 UsesADT(i) ? "ADT " : "Raw ",
                 IsMulti(i) ? "Multi  " : "Single ",
                 timer.ElapsedMilliseconds);
         }
     }
     if (!s_silent)
     {
         Console.WriteLine(" Run Type                       :      Min      Max    Average    Std-Dev");
     }
     for (int i = firstRenderer; i <= lastRenderer; i++)
     {
         long totalTime = 0;
         long min = long.MaxValue;
         long max = long.MinValue;
         for (int count = 0; count < iters; count++)
         {
             timer.Restart();
             renderers[i](xmin, xmax, ymin, ymax, step);
             timer.Stop();
             long time = timer.ElapsedMilliseconds;
             max = Math.Max(time, max);
             min = Math.Min(time, min);
             totalTime += time;
         }
         double avg = totalTime / (double)iters;
         double stdDev = Math.Sqrt(totalTime / (iters - 1.0)) / avg;
         if (s_silent)
         {
             Console.WriteLine("Average: {0,0:0.0}", avg);
         }
         else
         {
             Console.WriteLine("{0}{1}{2}{3}{4}: {5,8} {6,8} {7,10:0.0} {8,10:P}",
                 UseIntTypes(i) ? "IntBV  " : "Strict ",
                 IsVector(i) ? "Vector " : "Scalar ",
                 IsDouble(i) ? "Double " : "Single ",
                 UsesADT(i) ? "ADT " : "Raw ",
                 IsMulti(i) ? "Multi  " : "Single ",
                 min, max, avg, stdDev);
         }
     }
 }