Search in sources :

Example 41 with PageCursorTracer

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());
}
Also used : NodeRecord(org.neo4j.kernel.impl.store.record.NodeRecord) PageCursorTracer(org.neo4j.io.pagecache.tracing.cursor.PageCursorTracer) Transaction(org.neo4j.graphdb.Transaction) CursorContext(org.neo4j.io.pagecache.context.CursorContext) DefaultPageCacheTracer(org.neo4j.io.pagecache.tracing.DefaultPageCacheTracer) Test(org.junit.jupiter.api.Test)

Example 42 with PageCursorTracer

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();
}
Also used : PageCursorTracer(org.neo4j.io.pagecache.tracing.cursor.PageCursorTracer)

Example 43 with PageCursorTracer

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();
    }
}
Also used : PageCursorTracer(org.neo4j.io.pagecache.tracing.cursor.PageCursorTracer) CursorContext(org.neo4j.io.pagecache.context.CursorContext) DefaultPageCacheTracer(org.neo4j.io.pagecache.tracing.DefaultPageCacheTracer) Test(org.junit.jupiter.api.Test)

Example 44 with PageCursorTracer

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);
    }
}
Also used : PageCursorTracer(org.neo4j.io.pagecache.tracing.cursor.PageCursorTracer) ExternalStoreId(org.neo4j.storageengine.api.ExternalStoreId) StoreId(org.neo4j.storageengine.api.StoreId) CursorContext(org.neo4j.io.pagecache.context.CursorContext) DefaultPageCacheTracer(org.neo4j.io.pagecache.tracing.DefaultPageCacheTracer) Test(org.junit.jupiter.api.Test)

Example 45 with PageCursorTracer

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);
    }
}
Also used : PageCursorTracer(org.neo4j.io.pagecache.tracing.cursor.PageCursorTracer) CursorContext(org.neo4j.io.pagecache.context.CursorContext) DefaultPageCacheTracer(org.neo4j.io.pagecache.tracing.DefaultPageCacheTracer) Test(org.junit.jupiter.api.Test)

Aggregations

PageCursorTracer (org.neo4j.io.pagecache.tracing.cursor.PageCursorTracer)47 Test (org.junit.jupiter.api.Test)30 CursorContext (org.neo4j.io.pagecache.context.CursorContext)27 DefaultPageCacheTracer (org.neo4j.io.pagecache.tracing.DefaultPageCacheTracer)26 Transaction (org.neo4j.graphdb.Transaction)11 InternalTransaction (org.neo4j.kernel.impl.coreapi.InternalTransaction)5 Path (java.nio.file.Path)2 MutableLong (org.apache.commons.lang3.mutable.MutableLong)2 IndexSample (org.neo4j.kernel.api.index.IndexSample)2 NodeRecord (org.neo4j.kernel.impl.store.record.NodeRecord)2 GraphDatabaseAPI (org.neo4j.kernel.internal.GraphDatabaseAPI)2 Test (org.junit.Test)1 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)1 MethodSource (org.junit.jupiter.params.provider.MethodSource)1 DatabaseManagementService (org.neo4j.dbms.api.DatabaseManagementService)1 KernelTransaction (org.neo4j.kernel.api.KernelTransaction)1 DynamicRecord (org.neo4j.kernel.impl.store.record.DynamicRecord)1 PropertyBlock (org.neo4j.kernel.impl.store.record.PropertyBlock)1 ExternalStoreId (org.neo4j.storageengine.api.ExternalStoreId)1 IndexEntryUpdate (org.neo4j.storageengine.api.IndexEntryUpdate)1