use of org.neo4j.io.pagecache.tracing.cursor.PageCursorTracer in project neo4j by neo4j.
the class NeoStoresIT method tracePageCacheAccessOnGetRecord.
@Test
void tracePageCacheAccessOnGetRecord() {
var storageEngine = db.getDependencyResolver().resolveDependency(RecordStorageEngine.class);
var neoStores = storageEngine.testAccessNeoStores();
var nodeStore = neoStores.getNodeStore();
long nodeId;
try (Transaction transaction = db.beginTx()) {
var node = transaction.createNode();
node.setProperty("a", "b");
nodeId = node.getId();
transaction.commit();
}
var cursorContext = new CursorContext(new DefaultPageCacheTracer().createPageCursorTracer("tracePageCacheAccessOnGetRecord"));
nodeStore.getRecord(nodeId, new NodeRecord(nodeId), RecordLoad.NORMAL, cursorContext);
PageCursorTracer cursorTracer = cursorContext.getCursorTracer();
assertEquals(1, cursorTracer.hits());
assertEquals(1, cursorTracer.pins());
assertEquals(1, cursorTracer.unpins());
}
use of org.neo4j.io.pagecache.tracing.cursor.PageCursorTracer in project neo4j by neo4j.
the class FullScanNonUniqueIndexSamplerTest method assertZeroCursor.
private static void assertZeroCursor(CursorContext cursorContext) {
PageCursorTracer cursorTracer = cursorContext.getCursorTracer();
assertThat(cursorTracer.pins()).isZero();
assertThat(cursorTracer.unpins()).isZero();
assertThat(cursorTracer.faults()).isZero();
}
use of org.neo4j.io.pagecache.tracing.cursor.PageCursorTracer in project neo4j by neo4j.
the class MetaDataStoreTest method tracePageCacheAccessOnSetRecord.
@Test
void tracePageCacheAccessOnSetRecord() throws IOException {
var cacheTracer = new DefaultPageCacheTracer();
var cursorContext = new CursorContext(cacheTracer.createPageCursorTracer("tracePageCacheAccessOnSetRecord"));
try (var metaDataStore = newMetaDataStore()) {
MetaDataStore.setRecord(pageCache, metaDataStore.getStorageFile(), MetaDataStore.Position.RANDOM_NUMBER, 3, databaseLayout.getDatabaseName(), cursorContext);
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 MetaDataStoreTest method tracePageCacheAssessOnSetStoreId.
@Test
void tracePageCacheAssessOnSetStoreId() throws IOException {
var cacheTracer = new DefaultPageCacheTracer();
var cursorContext = new CursorContext(cacheTracer.createPageCursorTracer("tracePageCacheAssessOnSetStoreId"));
try (var metaDataStore = newMetaDataStore()) {
var storeId = new StoreId(1, 2, 3, 4, 5);
MetaDataStore.setStoreId(pageCache, metaDataStore.getStorageFile(), storeId, 6, 7, databaseLayout.getDatabaseName(), cursorContext);
PageCursorTracer cursorTracer = cursorContext.getCursorTracer();
assertThat(cursorTracer.pins()).isEqualTo(7);
assertThat(cursorTracer.unpins()).isEqualTo(7);
assertThat(cursorTracer.hits()).isEqualTo(7);
}
}
use of org.neo4j.io.pagecache.tracing.cursor.PageCursorTracer in project neo4j by neo4j.
the class MetaDataStoreTest method tracePageCacheAssessOnGetStoreId.
@Test
void tracePageCacheAssessOnGetStoreId() throws IOException {
var cacheTracer = new DefaultPageCacheTracer();
var cursorContext = new CursorContext(cacheTracer.createPageCursorTracer("tracePageCacheAssessOnGetStoreId"));
try (var metaDataStore = newMetaDataStore()) {
MetaDataStore.getStoreId(pageCache, metaDataStore.getStorageFile(), databaseLayout.getDatabaseName(), cursorContext);
PageCursorTracer cursorTracer = cursorContext.getCursorTracer();
assertThat(cursorTracer.pins()).isEqualTo(5);
assertThat(cursorTracer.unpins()).isEqualTo(5);
assertThat(cursorTracer.hits()).isEqualTo(5);
}
}
Aggregations