@Test public void computeTotalPauseTime() { List<GcEvent> gcEvents = new ArrayList<>(); gcEvents.add(new GcEvent(100, 1000)); gcEvents.add(new GcEvent(1050, 1750)); gcEvents.add(new GcEvent(62500, 65000)); long totalPauseTime = ProtobufGCNotifications.computeTotalPauseTime(gcEvents, new GcEvent(67500, 69000)); Assert.assertEquals(4000, totalPauseTime); }
protected static long computeTotalPauseTime(List<GcEvent> gcEvents, GcEvent gcEvent) { long totalPauseTime = 0; long maxEndTimeMillis = gcEvent.getEndTime() - MILLIS_MINUTE; for (Iterator<GcEvent> it = gcEvents.iterator(); it.hasNext(); ) { GcEvent gEvent = it.next(); if (gEvent.isTooOld(maxEndTimeMillis)) { it.remove(); } else { totalPauseTime += gEvent.getPauseDurationSince(maxEndTimeMillis); } } totalPauseTime += gcEvent.getPauseDurationSince(maxEndTimeMillis); return totalPauseTime; }
ProtobufGCNotifications extends GCNotifications { protected static long computeTotalPauseTime(List<GcEvent> gcEvents, GcEvent gcEvent) { long totalPauseTime = 0; long maxEndTimeMillis = gcEvent.getEndTime() - MILLIS_MINUTE; for (Iterator<GcEvent> it = gcEvents.iterator(); it.hasNext(); ) { GcEvent gEvent = it.next(); if (gEvent.isTooOld(maxEndTimeMillis)) { it.remove(); } else { totalPauseTime += gEvent.getPauseDurationSince(maxEndTimeMillis); } } totalPauseTime += gcEvent.getPauseDurationSince(maxEndTimeMillis); return totalPauseTime; } }
ProtobufGCNotifications extends GCNotifications { protected static long computeTotalPauseTime(List<GcEvent> gcEvents, GcEvent gcEvent) { long totalPauseTime = 0; long maxEndTimeMillis = gcEvent.getEndTime() - MILLIS_MINUTE; for (Iterator<GcEvent> it = gcEvents.iterator(); it.hasNext(); ) { GcEvent gEvent = it.next(); if (gEvent.isTooOld(maxEndTimeMillis)) { it.remove(); } else { totalPauseTime += gEvent.getPauseDurationSince(maxEndTimeMillis); } } totalPauseTime += gcEvent.getPauseDurationSince(maxEndTimeMillis); return totalPauseTime; } ProtobufGCNotifications(); }
ProtobufGCNotifications extends GCNotifications { protected static long computeTotalPauseTime(List<GcEvent> gcEvents, GcEvent gcEvent) { long totalPauseTime = 0; long maxEndTimeMillis = gcEvent.getEndTime() - MILLIS_MINUTE; for (Iterator<GcEvent> it = gcEvents.iterator(); it.hasNext(); ) { GcEvent gEvent = it.next(); if (gEvent.isTooOld(maxEndTimeMillis)) { it.remove(); } else { totalPauseTime += gEvent.getPauseDurationSince(maxEndTimeMillis); } } totalPauseTime += gcEvent.getPauseDurationSince(maxEndTimeMillis); return totalPauseTime; } ProtobufGCNotifications();  }
ProtobufGCNotifications extends GCNotifications { protected static long computeTotalPauseTime(List<GcEvent> gcEvents, GcEvent gcEvent) { long totalPauseTime = 0; long maxEndTimeMillis = gcEvent.getEndTime() - MILLIS_MINUTE; for (Iterator<GcEvent> it = gcEvents.iterator(); it.hasNext(); ) { GcEvent gEvent = it.next(); if (gEvent.isTooOld(maxEndTimeMillis)) { it.remove(); } else { totalPauseTime += gEvent.getPauseDurationSince(maxEndTimeMillis); } } totalPauseTime += gcEvent.getPauseDurationSince(maxEndTimeMillis); return totalPauseTime; } ProtobufGCNotifications();   }