/** Return the current set of GC events in the in-memory log. */ public List<GcEvent> getLogs() { final List<GcEvent> logs = new ArrayList<>(); for (CircularBuffer<GcEvent> buffer : gcLogs.values()) { logs.addAll(buffer.toList()); } Collections.sort(logs, GcEvent.REVERSE_TIME_ORDER); return logs; }
/** Create a new instance. */ public GcLogger() { jvmStartTime = ManagementFactory.getRuntimeMXBean().getStartTime(); for (GarbageCollectorMXBean mbean : ManagementFactory.getGarbageCollectorMXBeans()) { CircularBuffer<GcEvent> buffer = new CircularBuffer<>(BUFFER_SIZE); gcLogs.put(mbean.getName(), buffer); } for (MemoryPoolMXBean mbean : ManagementFactory.getMemoryPoolMXBeans()) { if (HelperFunctions.isYoungGenPool(mbean.getName())) { youngGenPoolName = mbean.getName(); } if (HelperFunctions.isOldGenPool(mbean.getName())) { oldGenPoolName = mbean.getName(); } } }
private void processGcEvent(GarbageCollectionNotificationInfo info) { GcEvent event = new GcEvent(info, jvmStartTime + info.getGcInfo().getStartTime()); gcLogs.get(info.getGcName()).add(event); if (LOGGER.isDebugEnabled()) { LOGGER.debug(event.toString()); } // Update pause timer for the action and cause... Id eventId = (isConcurrentPhase(info) ? CONCURRENT_PHASE_TIME : PAUSE_TIME) .withTag("action", info.getGcAction()) .withTag("cause", info.getGcCause()); Timer timer = Spectator.globalRegistry().timer(eventId); timer.record(info.getGcInfo().getDuration(), TimeUnit.MILLISECONDS); // Update promotion and allocation counters updateMetrics(info.getGcName(), info.getGcInfo()); // Notify an event listener if registered if (eventListener != null) { try { eventListener.onComplete(event); } catch (Exception e) { LOGGER.warn("exception thrown by event listener", e); } } }
/** Create a new instance. */ public GcLogger() { jvmStartTime = ManagementFactory.getRuntimeMXBean().getStartTime(); for (GarbageCollectorMXBean mbean : ManagementFactory.getGarbageCollectorMXBeans()) { CircularBuffer<GcEvent> buffer = new CircularBuffer<>(BUFFER_SIZE); gcLogs.put(mbean.getName(), buffer); } for (MemoryPoolMXBean mbean : ManagementFactory.getMemoryPoolMXBeans()) { if (HelperFunctions.isYoungGenPool(mbean.getName())) { youngGenPoolName = mbean.getName(); } if (HelperFunctions.isOldGenPool(mbean.getName())) { oldGenPoolName = mbean.getName(); } } }
private void processGcEvent(GarbageCollectionNotificationInfo info) { GcEvent event = new GcEvent(info, jvmStartTime + info.getGcInfo().getStartTime()); gcLogs.get(info.getGcName()).add(event); if (LOGGER.isDebugEnabled()) { LOGGER.debug(event.toString()); } // Update pause timer for the action and cause... Id eventId = (isConcurrentPhase(info) ? CONCURRENT_PHASE_TIME : PAUSE_TIME) .withTag("action", info.getGcAction()) .withTag("cause", info.getGcCause()); Timer timer = Spectator.globalRegistry().timer(eventId); timer.record(info.getGcInfo().getDuration(), TimeUnit.MILLISECONDS); // Update promotion and allocation counters updateMetrics(info.getGcName(), info.getGcInfo()); // Notify an event listener if registered if (eventListener != null) { try { eventListener.onComplete(event); } catch (Exception e) { LOGGER.warn("exception thrown by event listener", e); } } }
/** Return the current set of GC events in the in-memory log. */ public List<GcEvent> getLogs() { final List<GcEvent> logs = new ArrayList<>(); for (CircularBuffer<GcEvent> buffer : gcLogs.values()) { logs.addAll(buffer.toList()); } Collections.sort(logs, GcEvent.REVERSE_TIME_ORDER); return logs; }