garbage collection - use JMX(jconsole) to monitor JVM GC.how to get young GC info and full GC info? -
i can " ps scavenge ,ps marksweep" attributes: collectioncount,collectiontime through jmx .but questiong :" 1 young gc info ?which 1 full gc info ? " how can more details on gc.
jstat jstat gc info .the twos different.
the following bean:
import java.io.serializable; public class performancebean implements serializable { /** * */ private static final long serialversionuid = -6021047939070147624l; /* * survivor space 0 utilization percentage of space's current * capacity. */ public final long jstats0; /* * survivor space 1 utilization percentage of space's current * capacity. */ public final long jstats1; /* * eden space utilization percentage of space's current capacity. */ public final long jstate; /* * old space utilization percentage of space's current capacity. */ public final long jstato; /* * permanent space utilization percentage of space's current * capacity. */ public final long jstatp; /* number of young generation gc events. */ public final long jstatygc; /* young generation garbage collection time. */ public final long jstatygct; /* number of full gc events. */ public final long jstatfgc; /* full garbage collection time. */ public final long jstatfgct; /* total garbage collection time. */ public final long jstatgct; /* operation system info */ public final int availableprocessors; public final double systemloadaverage; public final string osname; public final string arch; /* * * below picture showing example of memory pool: *<p> *<pre> * +----------------------------------------------+ * +//////////////// | + * +//////////////// | + * +----------------------------------------------+ * * |--------| * init * |---------------| * used * |---------------------------| * committed * |----------------------------------------------| * max *<pre> */ /* * memory usage--heapmemoryusage */ public final long initheap; public final long usedheap; public final long committedheap; public final long maxheap; /* memory usage--nonheapmemoryusage */ public final long initnonheap; public final long usednonheap; public final long committednonheap; public final long maxnonheap; public static class builder { // optional parameters - initialized default values private long jstats0 = 0; private long jstats1 = 0; private long jstate = 0; private long jstato = 0; private long jstatp = 0; private long jstatygc = 0; private long jstatygct = 0; private long jstatfgc = 0; private long jstatfgct = 0; private long jstatgct = 0; public int availableprocessors = 0; public double systemloadaverage = 0; public string osname = ""; public string arch = ""; private long initheap = 0; private long usedheap = 0; private long committedheap = 0; private long maxheap = 0; private long initnonheap = 0; private long usednonheap = 0; private long committednonheap = 0; private long maxnonheap = 0; public builder jstats0(long val) { jstats0 = val; return this; } public builder jstats1(long val) { jstats1 = val; return this; } public builder jstate(long val) { jstate = val; return this; } public builder jstato(long val) { jstato = val; return this; } public builder jstatp(long val) { jstatp = val; return this; } public builder jstatygc(long val) { jstatygc = val; return this; } public builder jstatygct(long val) { jstatygct = val; return this; } public builder jstatfgc(long val) { jstatfgc = val; return this; } public builder jstatfgct(long val) { jstatfgct = val; return this; } public builder jstatgct(long val) { jstatgct = val; return this; } public builder availableprocessors(int val) { availableprocessors = val; return this; } public builder systemloadaverage(double val) { systemloadaverage = val; return this; } public builder arch(string val) { arch = val; return this; } public builder osname(string val) { osname = val; return this; } public builder initheap(long val) { initheap = val; return this; } public builder usedheap(long val) { usedheap = val; return this; } public builder committedheap(long val) { committedheap = val; return this; } public builder maxheap(long val) { maxheap = val; return this; } public builder initnonheap(long val) { initnonheap = val; return this; } public builder usednonheap(long val) { usednonheap = val; return this; } public builder committednonheap(long val) { committednonheap = val; return this; } public builder maxnonheap(long val) { maxnonheap = val; return this; } public performancebean build(){ return new performancebean(this); } } private performancebean(builder builder) { jstats0 = builder.jstats0; jstats1 = builder.jstats1; jstate = builder.jstate; jstato = builder.jstato; jstatp = builder.jstatp; jstatygc = builder.jstatygc; jstatygct = builder.jstatygct; jstatfgc = builder.jstatfgc; jstatfgct = builder.jstatfgct; jstatgct = builder.jstatgct; availableprocessors = builder.availableprocessors; systemloadaverage = builder.systemloadaverage; osname = builder.osname; arch = builder.arch; initheap = builder.initheap; usedheap = builder.usedheap; committedheap = builder.committedheap; maxheap = builder.maxheap; initnonheap = builder.initnonheap; usednonheap = builder.usednonheap; committednonheap = builder.committednonheap; maxnonheap = builder.maxnonheap; } // public static long getserialversionuid() { // return serialversionuid; // } // public long getjstats0() { // return jstats0; // } // public long getjstats1() { // return jstats1; // } // public long getjstate() { // return jstate; // } // public long getjstato() { // return jstato; // } // public long getjstatp() { // return jstatp; // } // public long getjstatygc() { // return jstatygc; // } // public long getjstatygct() { // return jstatygct; // } // public long getjstatfgc() { // return jstatfgc; // } // public long getjstatfgct() { // return jstatfgct; // } // public long getjstatgct() { // return jstatgct; // } // public double getsystemloadaverage() { // return systemloadaverage; // } // public string getosname() { // return osname; // } // public string getarch() { // return arch; // } // public long getinitheap() { // return initheap; // } // public long getusedheap() { // return usedheap; // } // public long getcommittedheap() { // return committedheap; // } // public long getmaxheap() { // return maxheap; // } // public long getinitnonheap() { // return initnonheap; // } // public long getusednonheap() { // return usednonheap; // } // public long getcommittednonheap() { // return committednonheap; // } // public long getmaxnonheap() { // return maxnonheap; // } }