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