Back to index

munin  2.0.1
GCCount.java
Go to the documentation of this file.
00001 package org.munin.plugin.jmx;
00002 
00003 import org.munin.plugin.jmx.AbstractAnnotationGraphsProvider.Graph;
00004 
00005 @Graph(title = "GarbageCollectionCount", vlabel = "count", info = "The Sun JVM defines garbage collection in two modes: Minor copy collections and Major Mark-Sweep-Compact collections. A minor collection runs relatively quickly and involves moving live data around the heap in the presence of running threads. A major collection is a much more intrusive garbage collection that suspends all execution threads while it completes its task. In terms of performance tuning the heap, the primary goal is to reduce the frequency and duration of major garbage collections.")
00006 public class GCCount extends AbstractAnnotationGraphsProvider {
00007 
00008        public GCCount(Config config) {
00009               super(config);
00010        }
00011 
00012        private String[] gcValues;
00013 
00014        @Override
00015        protected void prepareValues() throws Exception {
00016               GCCountGet collector = new GCCountGet(getConnection());
00017               gcValues = collector.GC();
00018        }
00019 
00020        @Field(label = "MinorCount", info = "The total number of collections that have occurred. This method returns -1 if the collection count is undefined for this collector.", type = "DERIVE", min = 0)
00021        public String copyCount() {
00022               return gcValues[0];
00023        }
00024 
00025        @Field(label = "MajorCount", info = "The total number of collections that have occurred. This method returns -1 if the collection count is undefined for this collector.", type = "DERIVE", min = 0)
00026        public String markSweepCompactCount() {
00027               return gcValues[1];
00028        }
00029 
00030        public static void main(String args[]) {
00031               runGraph(args);
00032        }
00033 }