Back to index

munin  2.0.1
GCTime.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 
00006 @Graph(title="GarbageCollectionTime", vlabel="ms", 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.")
00007 public class GCTime extends AbstractAnnotationGraphsProvider {
00008        
00009        public GCTime(Config config) {
00010               super(config);
00011        }
00012 
00013        private long[] times;
00014 
00015        @Override
00016        protected void prepareValues() throws Exception {
00017               GCTimeGet collector = new GCTimeGet(getConnection());
00018               times = collector.GC();
00019        }
00020        
00021        @Field(label="MinorTime", info="The approximate accumulated collection elapsed time in milliseconds. This method returns -1 if the collection elapsed time is undefined for this collector.", type="DERIVE", min=0)
00022        public long copyTime() {
00023               return times[0];
00024        }
00025        
00026        @Field(label="MajorTime", info="The approximate accumulated collection elapsed time in milliseconds. This method returns -1 if the collection elapsed time is undefined for this collector.", type="DERIVE", min=0)
00027        public long markSweepCompactTime() {
00028               return times[1];
00029        }
00030        
00031        public static void main(String[] args) {
00032               runGraph(args);
00033        }
00034 }