subtree.addFloat("99percentile", snapshot.get99thPercentile());
subtree.addFloat("999percentile", snapshot.get999thPercentile());
}
protected void printVmMetrics(MetricTreeObject tree) {
MetricTreeObject jvmTree = tree.getSubtree("jvm");
MetricTreeObject memoryTree = jvmTree.getSubtree("memory");
memoryTree.addFloat("heap_usage", vm.heapUsage());
memoryTree.addFloat("non_heap_usage", vm.nonHeapUsage());
MetricTreeObject memoryPoolUsages = memoryTree.getSubtree("memory_pool_usages");
for (Entry<String, Double> pool : vm.memoryPoolUsage().entrySet()) {
memoryPoolUsages.addFloat(pool.getKey(), pool.getValue());
}
jvmTree.addInt("daemon_thread_count", vm.daemonThreadCount());
jvmTree.addInt("thread_count", vm.threadCount());
jvmTree.addInt("uptime", vm.uptime());
jvmTree.addFloat("fd_usage", vm.fileDescriptorUsage());
MetricTreeObject threadStates = jvmTree.getSubtree("thread-states");
for (Entry<State, Double> entry : vm.threadStatePercentages().entrySet()) {
threadStates.addFloat(entry.getKey().toString().toLowerCase(), entry.getValue());
}
MetricTreeObject gcTree = jvmTree.getSubtree("gc");
for (Entry<String, VirtualMachineMetrics.GarbageCollectorStats> entry : vm.garbageCollectors().entrySet()) {
MetricTreeObject collectorTree = gcTree.getSubtree(entry.getKey());
collectorTree.addInt("time", entry.getValue().getTime(TimeUnit.MILLISECONDS));
collectorTree.addInt("runs", entry.getValue().getRuns());
}
}