Search in sources :

Example 1 with BtreeStats

use of com.sleepycat.je.BtreeStats in project qpid-broker-j by apache.

the class EnvironmentUtils method getDatabaseStatistics.

public static Map<String, Object> getDatabaseStatistics(Environment environment, String database, boolean reset) {
    DatabaseConfig dbConfig = new DatabaseConfig();
    dbConfig.setReadOnly(true);
    DbInternal.setUseExistingConfig(dbConfig, true);
    try (Database db = environment.openDatabase(null, database, dbConfig)) {
        StatsConfig config = new StatsConfig();
        config.setClear(reset);
        config.setFast(false);
        BtreeStats stats = (BtreeStats) db.getStats(config);
        Map<String, Object> results = new TreeMap<>();
        results.put(BTREE_BIN_COUNT.getName(), stats.getBottomInternalNodeCount());
        results.put(BTREE_DELETED_LN_COUNT.getName(), stats.getDeletedLeafNodeCount());
        results.put(BTREE_IN_COUNT.getName(), stats.getInternalNodeCount());
        results.put(BTREE_LN_COUNT.getName(), stats.getLeafNodeCount());
        results.put(BTREE_MAINTREE_MAXDEPTH.getName(), stats.getMainTreeMaxDepth());
        results.put(BTREE_INS_BYLEVEL.getName(), Arrays.asList(stats.getINsByLevel()));
        results.put(BTREE_BINS_BYLEVEL.getName(), Arrays.asList(stats.getBINsByLevel()));
        results.put(BTREE_BIN_ENTRIES_HISTOGRAM.getName(), Arrays.asList(stats.getBINEntriesHistogram()));
        results.put(BTREE_RELATCHES_REQUIRED.getName(), stats.getRelatches());
        results.put(BTREE_ROOT_SPLITS.getName(), stats.getRootSplits());
        return results;
    }
}
Also used : BtreeStats(com.sleepycat.je.BtreeStats) StatsConfig(com.sleepycat.je.StatsConfig) Database(com.sleepycat.je.Database) ConfiguredObject(org.apache.qpid.server.model.ConfiguredObject) TreeMap(java.util.TreeMap) DatabaseConfig(com.sleepycat.je.DatabaseConfig)

Aggregations

BtreeStats (com.sleepycat.je.BtreeStats)1 Database (com.sleepycat.je.Database)1 DatabaseConfig (com.sleepycat.je.DatabaseConfig)1 StatsConfig (com.sleepycat.je.StatsConfig)1 TreeMap (java.util.TreeMap)1 ConfiguredObject (org.apache.qpid.server.model.ConfiguredObject)1