Ejemplo n.º 1
0
        private void PerformMessageTestBatchOff(int mc)
        {
            Bilge useThis = new Bilge();

            useThis.DisableMessageBatching();

            for (int i = 0; i < mc; i++)
            {
                useThis.Info.Log($"Tis is the message that is averagely log {i}");
            }
        }
Ejemplo n.º 2
0
        public void ExecuteTest()
        {
            clockers.Clear();

            if (Debugger.IsAttached)
            {
                MESSAGESTOSEND = 100;
            }

            Func <Bilge> defaultBilge = () => {
                return(b);
            };

            Func <Bilge> bigBatch = () => {
                var bx = new Bilge(tl: SourceLevels.Verbose);
                bx.SetMessageBatching(1000, 5000);
                return(bx);
            };

            Func <Bilge> bilgeNoBatching = () => {
                Bilge bx = new Bilge(tl: SourceLevels.Verbose);
                bx.DisableMessageBatching();
                return(bx);
            };

            Action <string, Action <Bilge>, Bilge> runPerformanceTest = (nameOfTheTest, testMethodToExecute, bilgeInstanceToUse) => {
                clockers.Add(nameOfTheTest, new Stopwatch());
                Bilge bToUse = bilgeInstanceToUse;
                clockers[nameOfTheTest].Start();

                testMethodToExecute(bToUse);

                clockers[nameOfTheTest].Stop();
            };

            clockers.Add("main", new Stopwatch());
            clockers.Add("main-noflush", new Stopwatch());

            clockers["main"].Start();
            clockers["main-noflush"].Start();

            runPerformanceTest("singleLog-default", StandardLogOnMainThread, defaultBilge());
            runPerformanceTest("singleLog-nobatch", StandardLogOnMainThread, bilgeNoBatching());
            runPerformanceTest("singleLog-bigbatch", StandardLogOnMainThread, bigBatch());
            //runPerformanceTest("standard-onelog-nobatch", StandardLogOnMainThread, bilgeNoBatching());
            runPerformanceTest("mutilog-default", MultiLogOnMainThread, defaultBilge());

            clockers["main-noflush"].Stop();
            b.Flush();
            clockers["main"].Stop();
        }
Ejemplo n.º 3
0
        public void DirectWrite_IsPossible()
        {
            Bilge sut = TestHelper.GetBilgeAndClearDown();

            sut.DisableMessageBatching();
            sut.ActiveTraceLevel = SourceLevels.Verbose;

            var mmh = new MockMessageHandler();

            sut.AddHandler(mmh);

            sut.Direct.Write("DirectMessage", "DirectFurther");
            sut.Flush();

            Assert.Equal(1, mmh.TotalMessagesRecieved);
        }