@Test public void mustCountEvictions() { try ( EvictionRunEvent evictionRunEvent = tracer.beginPageEvictions( 2 ) ) { try ( EvictionEvent evictionEvent = evictionRunEvent.beginEviction() ) { FlushEvent flushEvent = evictionEvent.flushEventOpportunity().beginFlush( 0, 0, swapper ); flushEvent.addBytesWritten( 12 ); flushEvent.done(); } try ( EvictionEvent evictionEvent = evictionRunEvent.beginEviction() ) { FlushEvent flushEvent = evictionEvent.flushEventOpportunity().beginFlush( 0, 0, swapper ); flushEvent.addBytesWritten( 12 ); flushEvent.done(); evictionEvent.threwException( new IOException() ); } try ( EvictionEvent evictionEvent = evictionRunEvent.beginEviction() ) { FlushEvent flushEvent = evictionEvent.flushEventOpportunity().beginFlush( 0, 0, swapper ); flushEvent.addBytesWritten( 12 ); flushEvent.done(); evictionEvent.threwException( new IOException() ); } evictionRunEvent.beginEviction().close(); } assertCounts( 0, 0, 0, 0, 4, 2, 3, 0, 36, 0, 0 ); }
@Override public EvictionRunEvent beginPageEvictions( int expectedEvictions ) { long evictionRunId = evictionRunCounter.incrementAndGet(); JfrEvictionRunEvent event = new JfrEvictionRunEvent( evictionEventStarter ); event.begin(); event.setExpectedEvictions( expectedEvictions ); event.setEvictionRun( evictionRunId ); return event; }
JfrPageCacheTracer implements PageCacheTracer { @Override public EvictionRunEvent beginPageEvictions( int expectedEvictions ) { long evictionRunId = evictionRunCounter.incrementAndGet(); JfrEvictionRunEvent event = new JfrEvictionRunEvent( evictionEventStarter ); event.begin(); event.setExpectedEvictions( expectedEvictions ); event.setEvictionRun( evictionRunId ); return event; } }
JfrPageCacheTracer implements PageCacheTracer { @Override public EvictionRunEvent beginPageEvictions( int expectedEvictions ) { long evictionRunId = evictionRunCounter.incrementAndGet(); JfrEvictionRunEvent event = new JfrEvictionRunEvent( evictionEventStarter ); event.begin(); event.setExpectedEvictions( expectedEvictions ); event.setEvictionRun( evictionRunId ); return event; }  }
JfrPageCacheTracer implements PageCacheTracer { @Override public EvictionRunEvent beginPageEvictions( int expectedEvictions ) { long evictionRunId = evictionRunCounter.incrementAndGet(); JfrEvictionRunEvent event = new JfrEvictionRunEvent( evictionEventStarter ); event.begin(); event.setExpectedEvictions( expectedEvictions ); event.setEvictionRun( evictionRunId ); return event; }  @Override void mappedFile( File file ); @Override void unmappedFile( File file ); @Override EvictionRunEvent beginPageEvictions( int expectedEvictions ); @Override MajorFlushEvent beginFileFlush( PageSwapper swapper ); @Override MajorFlushEvent beginCacheFlush(); @Override void pins( long pins ); @Override void unpins( long unpins ); @Override void hits( long hits ); @Override void faults( long faults ); @Override void bytesRead( long bytesRead ); @Override void evictions( long evictions ); @Override void evictionExceptions( long evictionExceptions ); @Override void bytesWritten( long bytesWritten ); @Override void flushes( long flushes ); @Override long faults(); @Override long evictions(); @Override long pins(); @Override long unpins(); @Override long hits(); @Override long flushes(); @Override long bytesRead(); @Override long bytesWritten(); @Override long filesMapped(); @Override long filesUnmapped(); @Override long evictionExceptions(); @Override double hitRatio(); PinEventStarter getPinEventStarter(); }
JfrPageCacheTracer implements PageCacheTracer { @Override public EvictionRunEvent beginPageEvictions( int expectedEvictions ) { long evictionRunId = evictionRunCounter.incrementAndGet(); JfrEvictionRunEvent event = new JfrEvictionRunEvent( evictionEventStarter ); event.begin(); event.setExpectedEvictions( expectedEvictions ); event.setEvictionRun( evictionRunId ); return event; }  @Override void mappedFile( File file ); @Override void unmappedFile( File file ); @Override EvictionRunEvent beginPageEvictions( int expectedEvictions ); @Override MajorFlushEvent beginFileFlush( PageSwapper swapper ); @Override MajorFlushEvent beginCacheFlush(); @Override void pins( long pins ); @Override void unpins( long unpins ); @Override void hits( long hits ); @Override void faults( long faults ); @Override void bytesRead( long bytesRead ); @Override void evictions( long evictions ); @Override void evictionExceptions( long evictionExceptions ); @Override void bytesWritten( long bytesWritten ); @Override void flushes( long flushes ); @Override long faults(); @Override long evictions(); @Override long pins(); @Override long unpins(); @Override long hits(); @Override long flushes(); @Override long bytesRead(); @Override long bytesWritten(); @Override long filesMapped(); @Override long filesUnmapped(); @Override long evictionExceptions(); @Override double hitRatio(); PinEventStarter getPinEventStarter();  }