/** * Return a {@link List} of all direct {@link PoolArenaMetric}s that are provided by this pool. */ public List<PoolArenaMetric> directArenas() { return allocator.directArenas(); }
/** * Return a {@link List} of all direct {@link PoolArenaMetric}s that are provided by this pool. */ public List<PoolArenaMetric> directArenas() { return allocator.directArenas(); }
/** * Return a {@link List} of all direct {@link PoolArenaMetric}s that are provided by this pool. */ public List<PoolArenaMetric> directArenas() { return allocator.directArenas(); }
@SuppressWarnings("restriction") public List<Metrics> generate() { Metrics m = createMetrics(); Runtime r = Runtime.getRuntime(); m.put("jvm_heap_used", r.totalMemory() - r.freeMemory()); m.put("jvm_max_memory", r.maxMemory()); m.put("jvm_total_memory", r.totalMemory()); m.put("jvm_direct_memory_used", getJvmDirectMemoryUsed()); m.put("jvm_max_direct_memory", PlatformDependent.maxDirectMemory()); m.put("jvm_thread_cnt", getThreadCount()); m.put("jvm_gc_young_pause", currentYoungGcTime); m.put("jvm_gc_young_count", currentYoungGcCount); m.put("jvm_gc_old_pause", currentOldGcTime); m.put("jvm_gc_old_count", currentOldGcCount); long totalAllocated = 0; long totalUsed = 0; for (PoolArenaMetric arena : PooledByteBufAllocator.DEFAULT.directArenas()) { for (PoolChunkListMetric list : arena.chunkLists()) { for (PoolChunkMetric chunk : list) { int size = chunk.chunkSize(); int used = size - chunk.freeBytes(); totalAllocated += size; totalUsed += used; } } } m.put(this.componentName + "_default_pool_allocated", totalAllocated); m.put(this.componentName + "_default_pool_used", totalUsed); return Lists.newArrayList(m); }
/** * Return a {@link List} of all direct {@link PoolArenaMetric}s that are provided by this pool. */ public List<PoolArenaMetric> directArenas() { return allocator.directArenas(); }
/** * Return a {@link List} of all direct {@link PoolArenaMetric}s that are provided by this pool. */ public List<PoolArenaMetric> directArenas() { return allocator.directArenas(); }
/** * Return a {@link List} of all direct {@link PoolArenaMetric}s that are provided by this pool. */ public List<PoolArenaMetric> directArenas() { return allocator.directArenas(); }
/** * Return a {@link List} of all direct {@link PoolArenaMetric}s that are provided by this pool. */ public List<PoolArenaMetric> directArenas() { return allocator.directArenas(); }
public Map<String, Object> getMetrics() { final PooledByteBufAllocator allocator = PooledByteBufAllocator.DEFAULT; final Map<String, Object> metrics = new HashMap<>(); { int idx = 0; for (PoolArenaMetric poolArenaMetric : allocator.directArenas()) { metrics.put("1_DirectArena[" + idx++ + "]", metricsOfPoolArena(poolArenaMetric)); } } { int idx = 0; for (PoolArenaMetric poolArenaMetric : allocator.heapArenas()) { metrics.put("2_HeapArena[" + idx++ + "]", metricsOfPoolArena(poolArenaMetric)); } } return metrics; }
public static AllocatorStats generate(String allocatorName) { PooledByteBufAllocator allocator = null; if ("default".equals(allocatorName)) { allocator = PooledByteBufAllocator.DEFAULT; } else if ("ml-cache".equals(allocatorName)) { allocator = EntryCacheImpl.allocator; } else { throw new IllegalArgumentException("Invalid allocator name : " + allocatorName); } AllocatorStats stats = new AllocatorStats(); stats.directArenas = allocator.directArenas().stream().map(x -> newPoolArenaStats(x)) .collect(Collectors.toList()); stats.heapArenas = allocator.heapArenas().stream().map(x -> newPoolArenaStats(x)).collect(Collectors.toList()); stats.numDirectArenas = allocator.numDirectArenas(); stats.numHeapArenas = allocator.numHeapArenas(); stats.numThreadLocalCaches = allocator.numThreadLocalCaches(); stats.normalCacheSize = allocator.normalCacheSize(); stats.smallCacheSize = allocator.smallCacheSize(); stats.tinyCacheSize = allocator.tinyCacheSize(); return stats; }
long totalUsed = 0; for (PoolArenaMetric arena : PooledByteBufAllocator.DEFAULT.directArenas()) { for (PoolChunkListMetric list : arena.chunkLists()) { for (PoolChunkMetric chunk : list) {
@SuppressWarnings("restriction") public List<Metrics> generate() { Metrics m = createMetrics(); Runtime r = Runtime.getRuntime(); m.put("jvm_heap_used", r.totalMemory() - r.freeMemory()); m.put("jvm_max_memory", r.maxMemory()); m.put("jvm_total_memory", r.totalMemory()); m.put("jvm_direct_memory_used", getJvmDirectMemoryUsed()); m.put("jvm_max_direct_memory", sun.misc.VM.maxDirectMemory()); m.put("jvm_thread_cnt", getThreadCount()); m.put("jvm_gc_young_pause", currentYoungGcTime); m.put("jvm_gc_young_count", currentYoungGcCount); m.put("jvm_gc_old_pause", currentOldGcTime); m.put("jvm_gc_old_count", currentOldGcCount); long totalAllocated = 0; long totalUsed = 0; for (PoolArenaMetric arena : PooledByteBufAllocator.DEFAULT.directArenas()) { for (PoolChunkListMetric list : arena.chunkLists()) { for (PoolChunkMetric chunk : list) { int size = chunk.chunkSize(); int used = size - chunk.freeBytes(); totalAllocated += size; totalUsed += used; } } } m.put(this.componentName + "_default_pool_allocated", totalAllocated); m.put(this.componentName + "_default_pool_used", totalUsed); return Lists.newArrayList(m); }
long totalUsed = 0; for (PoolArenaMetric arena : allocator.directArenas()) { activeAllocations += arena.numActiveAllocations(); activeAllocationsTiny += arena.numActiveTinyAllocations();