Search in sources :

Example 1 with RepositoryStatisticsImpl

use of org.apache.jackrabbit.stats.RepositoryStatisticsImpl in project jackrabbit-oak by apache.

the class DefaultStatisticsProviderTest method getRegisteredTimeSeries.

private Set<String> getRegisteredTimeSeries(DefaultStatisticsProvider statsProvider) {
    RepositoryStatisticsImpl stats = (RepositoryStatisticsImpl) statsProvider.getStats();
    Set<String> names = new HashSet<String>();
    for (Map.Entry<String, TimeSeries> e : stats) {
        names.add(e.getKey());
    }
    return names;
}
Also used : TimeSeries(org.apache.jackrabbit.api.stats.TimeSeries) RepositoryStatisticsImpl(org.apache.jackrabbit.stats.RepositoryStatisticsImpl) Map(java.util.Map) HashSet(java.util.HashSet)

Example 2 with RepositoryStatisticsImpl

use of org.apache.jackrabbit.stats.RepositoryStatisticsImpl in project jackrabbit by apache.

the class AbstractBundlePersistenceManager method init.

// -------------------------------------------------< PersistenceManager >---
/**
 * {@inheritDoc}
 *
 * Initializes the internal structures of this abstract persistence manager.
 */
public void init(PMContext context) throws Exception {
    this.context = context;
    // init bundle cache
    bundles = new ConcurrentCache<NodeId, NodePropBundle>(context.getHomeDir().getName() + "BundleCache");
    bundles.setMaxMemorySize(bundleCacheSize);
    bundles.setAccessListener(this);
    // statistics
    RepositoryStatisticsImpl stats = context.getRepositoryStatistics();
    readCounter = stats.getCounter(RepositoryStatistics.Type.BUNDLE_READ_COUNTER);
    writeCounter = stats.getCounter(RepositoryStatistics.Type.BUNDLE_WRITE_COUNTER);
    writeDuration = stats.getCounter(RepositoryStatistics.Type.BUNDLE_WRITE_DURATION);
    cacheAccessCounter = stats.getCounter(RepositoryStatistics.Type.BUNDLE_CACHE_ACCESS_COUNTER);
    cacheSizeCounter = stats.getCounter(RepositoryStatistics.Type.BUNDLE_CACHE_SIZE_COUNTER);
    cacheMissCounter = stats.getCounter(RepositoryStatistics.Type.BUNDLE_CACHE_MISS_COUNTER);
    cacheMissDuration = stats.getCounter(RepositoryStatistics.Type.BUNDLE_CACHE_MISS_DURATION);
}
Also used : RepositoryStatisticsImpl(org.apache.jackrabbit.stats.RepositoryStatisticsImpl) NodeId(org.apache.jackrabbit.core.id.NodeId) NodePropBundle(org.apache.jackrabbit.core.persistence.util.NodePropBundle)

Example 3 with RepositoryStatisticsImpl

use of org.apache.jackrabbit.stats.RepositoryStatisticsImpl in project jackrabbit by apache.

the class QueryImpl method execute.

/**
 * This method simply forwards the <code>execute</code> call to the
 * {@link ExecutableQuery} object returned by
 * {@link QueryHandler#createExecutableQuery}.
 * {@inheritDoc}
 */
public QueryResult execute() throws RepositoryException {
    checkInitialized();
    long time = System.nanoTime();
    QueryResult result = sessionContext.getSessionState().perform(new SessionOperation<QueryResult>() {

        public QueryResult perform(SessionContext context) throws RepositoryException {
            return query.execute(offset, limit);
        }

        public String toString() {
            return "query.execute(" + statement + ")";
        }
    });
    time = System.nanoTime() - time;
    final long timeMs = time / 1000000;
    log.debug("executed in {} ms. ({})", timeMs, statement);
    RepositoryStatisticsImpl statistics = sessionContext.getRepositoryContext().getRepositoryStatistics();
    statistics.getCounter(Type.QUERY_COUNT).incrementAndGet();
    statistics.getCounter(Type.QUERY_DURATION).addAndGet(timeMs);
    sessionContext.getRepositoryContext().getStatManager().getQueryStat().logQuery(language, statement, timeMs);
    return result;
}
Also used : QueryResult(javax.jcr.query.QueryResult) RepositoryStatisticsImpl(org.apache.jackrabbit.stats.RepositoryStatisticsImpl) SessionContext(org.apache.jackrabbit.core.session.SessionContext) RepositoryException(javax.jcr.RepositoryException)

Example 4 with RepositoryStatisticsImpl

use of org.apache.jackrabbit.stats.RepositoryStatisticsImpl in project jackrabbit by apache.

the class QueryObjectModelImpl method execute.

public QueryResult execute() throws RepositoryException {
    long time = System.nanoTime();
    final QueryResult result = sessionContext.getSessionState().perform(new SessionOperation<QueryResult>() {

        public QueryResult perform(SessionContext context) throws RepositoryException {
            final QueryEngine engine = new QueryEngine(sessionContext.getSessionImpl(), lqf, variables);
            return engine.execute(getColumns(), getSource(), getConstraint(), getOrderings(), offset, limit);
        }

        public String toString() {
            return "query.execute(" + statement + ")";
        }
    });
    time = System.nanoTime() - time;
    final long timeMs = time / 1000000;
    log.debug("executed in {} ms. ({})", timeMs, statement);
    RepositoryStatisticsImpl statistics = sessionContext.getRepositoryContext().getRepositoryStatistics();
    statistics.getCounter(Type.QUERY_COUNT).incrementAndGet();
    statistics.getCounter(Type.QUERY_DURATION).addAndGet(timeMs);
    sessionContext.getRepositoryContext().getStatManager().getQueryStat().logQuery(language, statement, timeMs);
    return result;
}
Also used : QueryResult(javax.jcr.query.QueryResult) RepositoryStatisticsImpl(org.apache.jackrabbit.stats.RepositoryStatisticsImpl) SessionContext(org.apache.jackrabbit.core.session.SessionContext) RepositoryException(javax.jcr.RepositoryException) QueryEngine(org.apache.jackrabbit.core.query.lucene.join.QueryEngine)

Example 5 with RepositoryStatisticsImpl

use of org.apache.jackrabbit.stats.RepositoryStatisticsImpl in project jackrabbit by apache.

the class PersistenceManagerTest method assertPersistenceManager.

private void assertPersistenceManager(PersistenceManager manager) throws Exception {
    manager.init(new PMContext(directory, new MemoryFileSystem(), RepositoryImpl.ROOT_NODE_ID, new NamespaceRegistryImpl(new MemoryFileSystem()), null, null, new RepositoryStatisticsImpl()));
    try {
        assertCreateNewNode(manager);
        assertCreateNewProperty(manager);
        assertMissingItemStates(manager);
        assertCreateUpdateDelete(manager);
    } finally {
        manager.close();
    }
}
Also used : MemoryFileSystem(org.apache.jackrabbit.core.fs.mem.MemoryFileSystem) RepositoryStatisticsImpl(org.apache.jackrabbit.stats.RepositoryStatisticsImpl) NamespaceRegistryImpl(org.apache.jackrabbit.core.NamespaceRegistryImpl)

Aggregations

RepositoryStatisticsImpl (org.apache.jackrabbit.stats.RepositoryStatisticsImpl)5 RepositoryException (javax.jcr.RepositoryException)2 QueryResult (javax.jcr.query.QueryResult)2 SessionContext (org.apache.jackrabbit.core.session.SessionContext)2 HashSet (java.util.HashSet)1 Map (java.util.Map)1 TimeSeries (org.apache.jackrabbit.api.stats.TimeSeries)1 NamespaceRegistryImpl (org.apache.jackrabbit.core.NamespaceRegistryImpl)1 MemoryFileSystem (org.apache.jackrabbit.core.fs.mem.MemoryFileSystem)1 NodeId (org.apache.jackrabbit.core.id.NodeId)1 NodePropBundle (org.apache.jackrabbit.core.persistence.util.NodePropBundle)1 QueryEngine (org.apache.jackrabbit.core.query.lucene.join.QueryEngine)1