use of org.neo4j.io.pagecache.tracing.cursor.PageCursorTracer in project neo4j by neo4j.
the class SimpleIndexAccessorCompatibility method tracePageCacheAccessOnConsistencyCheck.
@Test
public void tracePageCacheAccessOnConsistencyCheck() {
var pageCacheTracer = new DefaultPageCacheTracer();
try (var cursorContext = new CursorContext(pageCacheTracer.createPageCursorTracer("tracePageCacheAccessOnConsistencyCheck"))) {
accessor.consistencyCheck(ReporterFactories.noopReporterFactory(), cursorContext);
PageCursorTracer cursorTracer = cursorContext.getCursorTracer();
assertThat(cursorTracer.pins()).isEqualTo(2);
assertThat(cursorTracer.unpins()).isEqualTo(2);
assertThat(cursorTracer.faults()).isEqualTo(2);
}
}
use of org.neo4j.io.pagecache.tracing.cursor.PageCursorTracer in project neo4j by neo4j.
the class TransactionCountingStateVisitorTraceIT method assertTwoCursor.
private void assertTwoCursor(CursorContext cursorContext) {
PageCursorTracer cursorTracer = cursorContext.getCursorTracer();
assertThat(cursorTracer.pins()).isEqualTo(2);
assertThat(cursorTracer.hits()).isEqualTo(2);
assertThat(cursorTracer.unpins()).isEqualTo(2);
}
use of org.neo4j.io.pagecache.tracing.cursor.PageCursorTracer in project neo4j by neo4j.
the class PropertyStoreTraceIT method tracePageCacheAccessOnPropertyBlockIdGeneration.
@Test
void tracePageCacheAccessOnPropertyBlockIdGeneration() {
var propertyStore = storageEngine.testAccessNeoStores().getPropertyStore();
prepareIdGenerator(propertyStore.getStringStore().getIdGenerator());
var pageCacheTracer = new DefaultPageCacheTracer();
try (var cursorContext = new CursorContext(pageCacheTracer.createPageCursorTracer("tracePageCacheAccessOnPropertyBlockIdGeneration"))) {
var propertyBlock = new PropertyBlock();
var dynamicRecord = new DynamicRecord(2);
dynamicRecord.setData(new byte[] { 0, 1, 2, 3, 4, 5, 6, 7 });
propertyBlock.addValueRecord(dynamicRecord);
propertyStore.encodeValue(propertyBlock, 1, stringValue(randomAlphabetic((int) kibiBytes(4))), cursorContext, INSTANCE);
PageCursorTracer cursorTracer = cursorContext.getCursorTracer();
assertThat(cursorTracer.pins()).isOne();
assertThat(cursorTracer.unpins()).isOne();
assertThat(cursorTracer.hits()).isOne();
}
}
use of org.neo4j.io.pagecache.tracing.cursor.PageCursorTracer in project neo4j by neo4j.
the class GBPTreeSingleWriterTest method trackPageCacheAccessOnClose.
@Test
void trackPageCacheAccessOnClose() throws IOException {
var pageCacheTracer = new DefaultPageCacheTracer();
var cursorContext = new CursorContext(pageCacheTracer.createPageCursorTracer("trackPageCacheAccessOnClose"));
assertZeroCursor(cursorContext);
try (var gbpTree = new GBPTreeBuilder<>(pageCache, directory.file("index"), layout).build();
var treeWriter = gbpTree.writer(0, cursorContext)) {
// empty, we check that closing everything register unpins event
}
PageCursorTracer cursorTracer = cursorContext.getCursorTracer();
assertThat(cursorTracer.pins()).isEqualTo(1);
assertThat(cursorTracer.hits()).isEqualTo(1);
assertThat(cursorTracer.unpins()).isEqualTo(1);
assertThat(cursorTracer.faults()).isEqualTo(0);
}
use of org.neo4j.io.pagecache.tracing.cursor.PageCursorTracer in project neo4j by neo4j.
the class RecordStoreVersionCheckTest method tracePageCacheAccessOnStoreVersionAccessConstruction.
@Test
void tracePageCacheAccessOnStoreVersionAccessConstruction() throws IOException {
var pageCacheTracer = new DefaultPageCacheTracer();
var cursorContext = new CursorContext(pageCacheTracer.createPageCursorTracer("tracePageCacheAccessOnStoreVersionAccessConstruction"));
Path neoStore = emptyFile(fileSystem);
String storeVersion = "V1";
long v1 = MetaDataStore.versionStringToLong(storeVersion);
MetaDataStore.setRecord(pageCache, neoStore, MetaDataStore.Position.STORE_VERSION, v1, databaseLayout.getDatabaseName(), NULL);
var versionCheck = newStoreVersionCheck();
assertEquals(storeVersion, versionCheck.storeVersion(cursorContext).get());
PageCursorTracer cursorTracer = cursorContext.getCursorTracer();
assertThat(cursorTracer.pins()).isOne();
assertThat(cursorTracer.unpins()).isOne();
assertThat(cursorTracer.faults()).isOne();
}
Aggregations