Java Code Examples for com.sun.management.GcInfo#getId()
The following examples show how to use
com.sun.management.GcInfo#getId() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GcEvent.java From kanela with Apache License 2.0 | 5 votes |
@Override public String toString() { final GcInfo gcInfo = info.getGcInfo(); final long totalBefore = getTotalUsage(gcInfo.getMemoryUsageBeforeGc()); final long totalAfter = getTotalUsage(gcInfo.getMemoryUsageAfterGc()); final long max = getTotalMaxUsage(gcInfo.getMemoryUsageAfterGc()); final String name = info.getGcName(); String unit = "KiB"; double cnv = ONE_KIBIBYTE; if (max > ONE_GIBIBYTE) { unit = "GiB"; cnv = ONE_GIBIBYTE; } else if (max > ONE_MEBIBYTE) { unit = "MiB"; cnv = ONE_MEBIBYTE; } final Date d = new Date(startTime); final String change = format("%.1f%s => %.1f%s / %.1f%s", totalBefore / cnv, unit, totalAfter / cnv, unit, max / cnv, unit); final String percentChange = format("%.1f%% => %.1f%%", 100.0 * totalBefore / max, 100.0 * totalAfter / max); return "OLD" + ": " + name + ", id=" + gcInfo.getId() + ", at=" + d.toString() + ", duration=" + gcInfo.getDuration() + "ms" + ", cause=[" + info.getGcCause() + "]" + ", " + change + " (" + percentChange + ")"; }
Example 2
Source File: GcEvent.java From spectator with Apache License 2.0 | 5 votes |
@Override public String toString() { final GcInfo gcInfo = info.getGcInfo(); final long totalBefore = HelperFunctions.getTotalUsage(gcInfo.getMemoryUsageBeforeGc()); final long totalAfter = HelperFunctions.getTotalUsage(gcInfo.getMemoryUsageAfterGc()); final long max = HelperFunctions.getTotalMaxUsage(gcInfo.getMemoryUsageAfterGc()); String unit = "KiB"; double cnv = ONE_KIBIBYTE; if (max > ONE_GIBIBYTE) { unit = "GiB"; cnv = ONE_GIBIBYTE; } else if (max > ONE_MEBIBYTE) { unit = "MiB"; cnv = ONE_MEBIBYTE; } String change = String.format( "%.1f%s => %.1f%s / %.1f%s", totalBefore / cnv, unit, totalAfter / cnv, unit, max / cnv, unit); String percentChange = String.format( "%.1f%% => %.1f%%", 100.0 * totalBefore / max, 100.0 * totalAfter / max); final Date d = new Date(startTime); return type.toString() + ": " + name + ", id=" + gcInfo.getId() + ", at=" + d.toString() + ", duration=" + gcInfo.getDuration() + "ms" + ", cause=[" + info.getGcCause() + "]" + ", " + change + " (" + percentChange + ")"; }
Example 3
Source File: GCCollectionEvent.java From buck with Apache License 2.0 | 5 votes |
GCCollectionEvent(EventKey eventKey, GcInfo info) { super(eventKey); this.id = info.getId(); this.durationInMillis = info.getDuration(); this.memoryUsageBeforeGC = memoryUsageMap(info.getMemoryUsageBeforeGc()); this.memoryUsageAfterGC = memoryUsageMap(info.getMemoryUsageAfterGc()); }