//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void countFlushesAndBytesWritten()
        internal virtual void CountFlushesAndBytesWritten()
        {
            PinEvent pinEvent = _pageCursorTracer.beginPin(true, 0, _swapper);

            {
                PageFaultEvent faultEvent = pinEvent.BeginPageFault();
                {
                    EvictionEvent evictionEvent = faultEvent.BeginEviction();
                    {
                        FlushEventOpportunity flushEventOpportunity = evictionEvent.FlushEventOpportunity();
                        {
                            FlushEvent flushEvent = flushEventOpportunity.BeginFlush(0, 0, _swapper);
                            flushEvent.AddBytesWritten(27);
                            flushEvent.Done();
                            FlushEvent flushEvent1 = flushEventOpportunity.BeginFlush(0, 1, _swapper);
                            flushEvent1.AddBytesWritten(13);
                            flushEvent1.Done();
                        }
                    }
                    evictionEvent.Close();
                }
                faultEvent.Done();
            }
            pinEvent.Done();

            assertEquals(1, _pageCursorTracer.pins());
            assertEquals(1, _pageCursorTracer.unpins());
            assertEquals(1, _pageCursorTracer.faults());
            assertEquals(1, _pageCursorTracer.evictions());
            assertEquals(2, _pageCursorTracer.flushes());
            assertEquals(40, _pageCursorTracer.bytesWritten());
        }
        private void PinFaultAndHit()
        {
            PinEvent       pinEvent       = _pageCursorTracer.beginPin(true, 0, _swapper);
            PageFaultEvent pageFaultEvent = pinEvent.BeginPageFault();

            pinEvent.Hit();
            pageFaultEvent.Done();
            pinEvent.Done();
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void countPageFaultsAndBytesRead()
        internal virtual void CountPageFaultsAndBytesRead()
        {
            PinEvent pinEvent = _pageCursorTracer.beginPin(true, 0, _swapper);

            {
                PageFaultEvent pageFaultEvent = pinEvent.BeginPageFault();
                {
                    pageFaultEvent.AddBytesRead(42);
                }
                pageFaultEvent.Done();
                pageFaultEvent = pinEvent.BeginPageFault();
                {
                    pageFaultEvent.AddBytesRead(42);
                }
                pageFaultEvent.Done();
            }
            pinEvent.Done();

            assertEquals(1, _pageCursorTracer.pins());
            assertEquals(1, _pageCursorTracer.unpins());
            assertEquals(2, _pageCursorTracer.faults());
            assertEquals(84, _pageCursorTracer.bytesRead());
        }
        private void GenerateEventSet()
        {
            PinEvent pinEvent = _pageCursorTracer.beginPin(false, 0, _swapper);

            {
                PageFaultEvent pageFaultEvent = pinEvent.BeginPageFault();
                pageFaultEvent.AddBytesRead(150);
                {
                    EvictionEvent evictionEvent = pageFaultEvent.BeginEviction();
                    {
                        FlushEventOpportunity flushEventOpportunity = evictionEvent.FlushEventOpportunity();
                        FlushEvent            flushEvent            = flushEventOpportunity.BeginFlush(0, 0, _swapper);
                        flushEvent.AddBytesWritten(10);
                        flushEvent.Done();
                    }
                    evictionEvent.ThrewException(new IOException("eviction exception"));
                    evictionEvent.Close();
                }
                pageFaultEvent.Done();
            }
            pinEvent.Done();
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void countPageEvictions()
        internal virtual void CountPageEvictions()
        {
            PinEvent pinEvent = _pageCursorTracer.beginPin(true, 0, _swapper);

            {
                PageFaultEvent faultEvent = pinEvent.BeginPageFault();
                {
                    EvictionEvent evictionEvent = faultEvent.BeginEviction();
                    evictionEvent.FilePageId  = 0;
                    evictionEvent.CachePageId = 0;
                    evictionEvent.ThrewException(new IOException("exception"));
                    evictionEvent.Close();
                }
                faultEvent.Done();
            }
            pinEvent.Done();

            assertEquals(1, _pageCursorTracer.pins());
            assertEquals(1, _pageCursorTracer.unpins());
            assertEquals(1, _pageCursorTracer.faults());
            assertEquals(1, _pageCursorTracer.evictions());
            assertEquals(1, _pageCursorTracer.evictionExceptions());
        }