use of org.neo4j.io.pagecache.tracing.cursor.PageCursorTracer in project neo4j by neo4j.
the class NeoStoresIT method tracePageCacheAccessOnGetRawRecordData.
@Test
void tracePageCacheAccessOnGetRawRecordData() throws IOException {
var storageEngine = db.getDependencyResolver().resolveDependency(RecordStorageEngine.class);
var neoStores = storageEngine.testAccessNeoStores();
var propertyStore = neoStores.getPropertyStore();
try (Transaction transaction = db.beginTx()) {
var node = transaction.createNode();
node.setProperty("a", "b");
transaction.commit();
}
var cursorContext = new CursorContext(new DefaultPageCacheTracer().createPageCursorTracer("tracePageCacheAccessOnGetRawRecordData"));
propertyStore.getRawRecordData(1L, 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 tracePageCacheAccessOnSampling.
@Test
void tracePageCacheAccessOnSampling() throws IOException {
Value[] values = generateNumberValues();
buildTree(values);
var pageCacheTracer = new DefaultPageCacheTracer();
var cursorContext = new CursorContext(pageCacheTracer.createPageCursorTracer("testTracer"));
assertZeroCursor(cursorContext);
try (GBPTree<GenericKey, NativeIndexValue> gbpTree = getTree()) {
FullScanNonUniqueIndexSampler<GenericKey, NativeIndexValue> sampler = new FullScanNonUniqueIndexSampler<>(gbpTree, layout);
sampler.sample(cursorContext);
}
PageCursorTracer cursorTracer = cursorContext.getCursorTracer();
assertThat(cursorTracer.pins()).isEqualTo(1);
assertThat(cursorTracer.unpins()).isEqualTo(1);
assertThat(cursorTracer.faults()).isEqualTo(1);
}
use of org.neo4j.io.pagecache.tracing.cursor.PageCursorTracer in project neo4j by neo4j.
the class IndexStatisticsStoreTest method tracePageCacheAccessOnCheckpoint.
@Test
void tracePageCacheAccessOnCheckpoint() throws IOException {
var cacheTracer = new DefaultPageCacheTracer();
var store = openStore(cacheTracer, "checkpoint");
try (var cursorContext = new CursorContext(cacheTracer.createPageCursorTracer("tracePageCacheAccessOnCheckpoint"))) {
for (int i = 0; i < 100; i++) {
store.replaceStats(i, new IndexSample());
}
store.checkpoint(cursorContext);
PageCursorTracer cursorTracer = cursorContext.getCursorTracer();
assertThat(cursorTracer.pins()).isEqualTo(43);
assertThat(cursorTracer.unpins()).isEqualTo(43);
assertThat(cursorTracer.hits()).isEqualTo(35);
assertThat(cursorTracer.faults()).isEqualTo(8);
}
}
use of org.neo4j.io.pagecache.tracing.cursor.PageCursorTracer in project neo4j by neo4j.
the class IndexStatisticsStoreTest method tracePageCacheAccessOnConsistencyCheck.
@Test
void tracePageCacheAccessOnConsistencyCheck() throws IOException {
var cacheTracer = new DefaultPageCacheTracer();
var store = openStore(cacheTracer, "consistencyCheck");
try (var cursorContext = new CursorContext(cacheTracer.createPageCursorTracer("tracePageCacheAccessOnConsistencyCheck"))) {
for (int i = 0; i < 100; i++) {
store.replaceStats(i, new IndexSample());
}
store.checkpoint(CursorContext.NULL);
store.consistencyCheck(noopReporterFactory(), cursorContext);
PageCursorTracer cursorTracer = cursorContext.getCursorTracer();
assertThat(cursorTracer.pins()).isEqualTo(16);
assertThat(cursorTracer.unpins()).isEqualTo(16);
assertThat(cursorTracer.hits()).isEqualTo(16);
}
}
use of org.neo4j.io.pagecache.tracing.cursor.PageCursorTracer in project neo4j by neo4j.
the class ReadOnlyLogVersionRepositoryIT method tracePageCacheAccessOnReadOnlyLogRepoConstruction.
@Test
void tracePageCacheAccessOnReadOnlyLogRepoConstruction() throws IOException {
var pageCacheTracer = new DefaultPageCacheTracer();
var cursorContext = new CursorContext(pageCacheTracer.createPageCursorTracer("tracePageCacheAccessOnReadOnlyLogRepoConstruction"));
new ReadOnlyLogVersionRepository(pageCache, databaseLayout, cursorContext);
PageCursorTracer cursorTracer = cursorContext.getCursorTracer();
assertThat(cursorTracer.pins()).isEqualTo(2);
assertThat(cursorTracer.unpins()).isEqualTo(2);
assertThat(cursorTracer.hits()).isEqualTo(2);
}
Aggregations