Ejemplo n.º 1
0
        public static InstrumentedOperation Test(Action action, string text, int normalizer = 1, bool dbgWriteLn = true)
        {
            var temp = new InstrumentedOperation(action, text, normalizer);

            return(temp);
        }
Ejemplo n.º 2
0
        public static InstrumentedOperation <T> Test <T>(Func <T> func, string text, int normalizer = 1, bool dbgWriteLn = true)
        {
            var temp = new InstrumentedOperation <T>(func, text, normalizer);

            return(temp);
        }
Ejemplo n.º 3
0
        static void Test(int iterations, ulong value)
        {
            Console.WriteLine("------------------------");
            Console.WriteLine("iterations = {0}, value = {1}", iterations, value);

            int SIZE = iterations;

            List <ulong> xs;

            Lib.Class1 c = new Lib.Class1();

            xs = new List <ulong>(SIZE);
            var t1 = InstrumentedOperation.Test(() =>
            {
                for (int i = 0; i < SIZE; ++i)
                {
                    xs.AddRange(c.EnumerateSquaresImpl1(value));
                }
            }, "EnumerateSquaresImpl1");

            Console.WriteLine(xs.Count);
            Console.WriteLine(t1);

            xs = new List <ulong>();
            var t2 = InstrumentedOperation.Test(() =>
            {
                for (int i = 0; i < SIZE; ++i)
                {
                    xs.AddRange(c.EnumerateSquaresImpl2(value));
                }
            }, "EnumerateSquaresImpl2");

            Console.WriteLine(xs.Count);
            Console.WriteLine(t2);

            xs = new List <ulong>(SIZE);
            var t3 = InstrumentedOperation.Test(() =>
            {
                for (int i = 0; i < SIZE; ++i)
                {
                    xs.AddRange(c.EnumerateSquaresImpl3(value));
                }
            }, "EnumerateSquaresImpl3");

            Console.WriteLine(xs.Count);
            Console.WriteLine(t3);

            xs = new List <ulong>(SIZE);
            var t4 = InstrumentedOperation.Test(() =>
            {
                for (int i = 0; i < SIZE; ++i)
                {
                    xs.AddRange(c.EnumerateSquaresImpl4(value));
                }
            }, "EnumerateSquaresImpl4");

            Console.WriteLine(xs.Count);
            Console.WriteLine(t4);

            Console.WriteLine("------------------------");
        }