Search in sources :

Example 1 with StatGroup

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

the class EnvironmentUtils method getStatsFromStatGroup.

private static Map<String, Map<String, Object>> getStatsFromStatGroup(final Collection<StatGroup> statGroups) {
    Map<String, Map<String, Object>> results = new LinkedHashMap<>();
    for (StatGroup group : statGroups) {
        Map<String, Object> groupResults = new TreeMap<>();
        for (Map.Entry<StatDefinition, Stat<?>> entry : group.getStats().entrySet()) {
            if (!entry.getValue().isNotSet()) {
                Object value = entry.getValue().get();
                if (value instanceof IntegralLongAvg) {
                    value = ((Number) value).doubleValue();
                }
                groupResults.put(entry.getKey().getName(), value);
            }
        }
        if (!groupResults.isEmpty()) {
            results.put(group.getName(), groupResults);
        }
    }
    return results;
}
Also used : Stat(com.sleepycat.je.utilint.Stat) IntegralLongAvg(com.sleepycat.je.utilint.IntegralLongAvg) StatDefinition(com.sleepycat.je.utilint.StatDefinition) ConfiguredObject(org.apache.qpid.server.model.ConfiguredObject) TreeMap(java.util.TreeMap) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) TreeMap(java.util.TreeMap) LinkedHashMap(java.util.LinkedHashMap) StatGroup(com.sleepycat.je.utilint.StatGroup)

Example 2 with StatGroup

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

the class EnvironmentUtils method getEnvironmentStatistics.

public static Map<String, Map<String, Object>> getEnvironmentStatistics(Environment environment, boolean reset) {
    StatsConfig config = new StatsConfig();
    config.setClear(reset);
    config.setFast(false);
    EnvironmentStats stats = environment.getStats(config);
    Collection<StatGroup> statGroups = stats.getStatGroups();
    return getStatsFromStatGroup(statGroups);
}
Also used : StatsConfig(com.sleepycat.je.StatsConfig) EnvironmentStats(com.sleepycat.je.EnvironmentStats) StatGroup(com.sleepycat.je.utilint.StatGroup)

Aggregations

StatGroup (com.sleepycat.je.utilint.StatGroup)2 EnvironmentStats (com.sleepycat.je.EnvironmentStats)1 StatsConfig (com.sleepycat.je.StatsConfig)1 IntegralLongAvg (com.sleepycat.je.utilint.IntegralLongAvg)1 Stat (com.sleepycat.je.utilint.Stat)1 StatDefinition (com.sleepycat.je.utilint.StatDefinition)1 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 TreeMap (java.util.TreeMap)1 ConfiguredObject (org.apache.qpid.server.model.ConfiguredObject)1