Example #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void evictionDoesNotInfluenceFlushNumbers()
        public virtual void EvictionDoesNotInfluenceFlushNumbers()
        {
            VerbosePageCacheTracer tracer = CreateTracer();

            using (MajorFlushEvent majorFlushEvent = tracer.BeginCacheFlush())
            {
                FlushEventOpportunity flushEventOpportunity = majorFlushEvent.FlushEventOpportunity();
                FlushEvent            flushEvent            = flushEventOpportunity.BeginFlush(1, 2, new DummyPageSwapper("testFile", 1));
                _clock.forward(2, TimeUnit.MILLISECONDS);

                using (EvictionRunEvent evictionRunEvent = tracer.BeginPageEvictions(5))
                {
                    using (EvictionEvent evictionEvent = evictionRunEvent.BeginEviction())
                    {
                        FlushEventOpportunity evictionEventOpportunity = evictionEvent.FlushEventOpportunity();
                        FlushEvent            evictionFlush            = evictionEventOpportunity.BeginFlush(2, 3, new DummyPageSwapper("evictionFile", 1));
                        evictionFlush.AddPagesFlushed(10);
                        evictionFlush.AddPagesFlushed(100);
                    }
                }
                flushEvent.AddBytesWritten(2);
                flushEvent.AddPagesFlushed(7);
                flushEvent.Done();
            }
            _logProvider.formattedMessageMatcher().assertContains("Start whole page cache flush.");
            _logProvider.formattedMessageMatcher().assertContains("Page cache flush completed. Flushed 2B in 7 pages. Flush took: 2ms. " + "Average speed: 0bytes/ns.");
        }
Example #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void traceSinglePageCacheFlush()
        public virtual void TraceSinglePageCacheFlush()
        {
            VerbosePageCacheTracer tracer = CreateTracer();

            using (MajorFlushEvent majorFlushEvent = tracer.BeginCacheFlush())
            {
                FlushEventOpportunity flushEventOpportunity = majorFlushEvent.FlushEventOpportunity();
                FlushEvent            flushEvent            = flushEventOpportunity.BeginFlush(1, 2, new DummyPageSwapper("testFile", 1));
                flushEvent.AddBytesWritten(2);
                flushEvent.AddPagesFlushed(7);
                flushEvent.Done();
            }
            _logProvider.formattedMessageMatcher().assertContains("Start whole page cache flush.");
            _logProvider.formattedMessageMatcher().assertContains("Page cache flush completed. Flushed 2B in 7 pages. Flush took: 0ns. " + "Average speed: 2bytes/ns.");
        }
Example #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void traceFileFlush()
        public virtual void TraceFileFlush()
        {
            VerbosePageCacheTracer tracer  = CreateTracer();
            DummyPageSwapper       swapper = new DummyPageSwapper("fileToFlush", 1);

            using (MajorFlushEvent fileToFlush = tracer.BeginFileFlush(swapper))
            {
                FlushEventOpportunity flushEventOpportunity = fileToFlush.FlushEventOpportunity();
                FlushEvent            flushEvent            = flushEventOpportunity.BeginFlush(1, 2, swapper);
                flushEvent.AddPagesFlushed(100);
                flushEvent.AddBytesWritten(ByteUnit.ONE_MEBI_BYTE);
                flushEvent.Done();
                _clock.forward(1, TimeUnit.SECONDS);
                FlushEvent flushEvent2 = flushEventOpportunity.BeginFlush(1, 2, swapper);
                flushEvent2.AddPagesFlushed(10);
                flushEvent2.AddBytesWritten(ByteUnit.ONE_MEBI_BYTE);
                flushEvent2.Done();
            }
            _logProvider.formattedMessageMatcher().assertContains("Flushing file: 'fileToFlush'.");
            _logProvider.formattedMessageMatcher().assertContains("'fileToFlush' flush completed. Flushed 2.000MiB in 110 pages. Flush took: 1s. Average speed: 2.000MiB/s.");
        }