Search in sources :

Example 6 with PageCursorTracer

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());
}
Also used : 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 7 with PageCursorTracer

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

Example 8 with PageCursorTracer

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

Example 9 with PageCursorTracer

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

Example 10 with PageCursorTracer

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);
}
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