Ejemplo n.º 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.");
        }
Ejemplo n.º 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.");
        }