Search in sources :

Example 6 with StatsConfig

use of com.sleepycat.je.StatsConfig 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)

Example 7 with StatsConfig

use of com.sleepycat.je.StatsConfig in project voldemort by voldemort.

the class BdbCachePartitioningTest method getStats.

private EnvironmentStats getStats(Environment environment) {
    StatsConfig config = new StatsConfig();
    config.setFast(true);
    return environment.getStats(config);
}
Also used : StatsConfig(com.sleepycat.je.StatsConfig)

Example 8 with StatsConfig

use of com.sleepycat.je.StatsConfig in project voldemort by voldemort.

the class BdbStorageConfiguration method getStats.

public String getStats(String storeName, boolean fast) {
    try {
        if (environments.containsKey(storeName)) {
            StatsConfig config = new StatsConfig();
            config.setFast(fast);
            Environment env = environments.get(storeName);
            return env.getStats(config).toString();
        } else {
            // return empty string if environment not created yet
            return "";
        }
    } catch (DatabaseException e) {
        throw new VoldemortException(e);
    }
}
Also used : StatsConfig(com.sleepycat.je.StatsConfig) Environment(com.sleepycat.je.Environment) DatabaseException(com.sleepycat.je.DatabaseException) VoldemortException(voldemort.VoldemortException)

Aggregations

StatsConfig (com.sleepycat.je.StatsConfig)8 Database (com.sleepycat.je.Database)2 DatabaseException (com.sleepycat.je.DatabaseException)2 Environment (com.sleepycat.je.Environment)2 EnvironmentStats (com.sleepycat.je.EnvironmentStats)2 ConfiguredObject (org.apache.qpid.server.model.ConfiguredObject)2 VoldemortException (voldemort.VoldemortException)2 BtreeStats (com.sleepycat.je.BtreeStats)1 DatabaseConfig (com.sleepycat.je.DatabaseConfig)1 TransactionStats (com.sleepycat.je.TransactionStats)1 StatGroup (com.sleepycat.je.utilint.StatGroup)1 File (java.io.File)1 LinkedHashMap (java.util.LinkedHashMap)1 TreeMap (java.util.TreeMap)1