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