Example #1
0
        public void Test_Enabled()
        {
            Log.Enabled = true;
            Log.MaxEntryCount = 1000;
            Log.Level = LogLevel.Info;

            var algo = new Dummy();
            algo.Recursive(10);

            var ilalgo = WeaverHelper.CreateInstance<Yalf.TestAssembly.TestAlgo>(assembly);
            ilalgo.Recursive(10);

            var count = 100000;

            var sw = Stopwatch.StartNew();
            for (int i = 0; i < count; i++)
            {
                algo.Recursive(10);
            }

            sw.Stop();
            var duration = 1000.0 * sw.ElapsedTicks / Stopwatch.Frequency;

            sw = Stopwatch.StartNew();
            for (int i = 0; i < count; i++)
            {
                ilalgo.Recursive(10);
            }

            sw.Stop();
            var ilduration = 1000.0 * sw.ElapsedTicks / Stopwatch.Frequency;

            Console.WriteLine("{0} repeats {1:0.00}ms vs weaved {2:0.00}ms", count, duration, ilduration);
        }
Example #2
0
        public void Test_Manual_Enabled()
        {
            Log.Enabled = true;
            Log.MaxEntryCount = 1000;
            Log.Level = LogLevel.Info;

            var algo = new Dummy();
            algo.Recursive(10);

            var ilalgo = new DummyWith();
            ilalgo.Recursive(10);

            var count = 100000;

            var sw = Stopwatch.StartNew();
            for (int i = 0; i < count; i++)
            {
                algo.Recursive(10);
            }

            sw.Stop();
            var duration = 1000.0 * sw.ElapsedTicks / Stopwatch.Frequency;

            sw = Stopwatch.StartNew();
            for (int i = 0; i < count; i++)
            {
                ilalgo.Recursive(10);
            }

            sw.Stop();
            var ilduration = 1000.0 * sw.ElapsedTicks / Stopwatch.Frequency;

            Console.WriteLine("{0} repeats {1:0.00}ms vs manual {2:0.00}ms", count, duration, ilduration);
        }