Ejemplo n.º 1
0
//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());
        }
Ejemplo n.º 2
0
        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();
        }
Ejemplo n.º 3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void flushFile(MuninnPagedFile muninnPagedFile, org.neo4j.io.pagecache.IOLimiter limiter) throws java.io.IOException
        private void FlushFile(MuninnPagedFile muninnPagedFile, IOLimiter limiter)
        {
            try
            {
                using (MajorFlushEvent fileFlush = _pageCacheTracer.beginFileFlush(muninnPagedFile.Swapper))
                {
                    FlushEventOpportunity flushOpportunity = fileFlush.FlushEventOpportunity();
                    muninnPagedFile.FlushAndForceInternal(flushOpportunity, false, limiter);
                }
            }
            catch (ClosedChannelException e)
            {
                if (muninnPagedFile.RefCount > 0)
                {
                    // The file is not supposed to be closed, since we have a positive ref-count, yet we got a
                    // ClosedChannelException anyway? It's an odd situation, so let's tell the outside world about
                    // this failure.
                    throw e;
                }
                // Otherwise: The file was closed while we were trying to flush it. Since unmapping implies a flush
                // anyway, we can safely assume that this is not a problem. The file was flushed, and it doesn't
                // really matter how that happened. We'll ignore this exception.
            }
        }