Open chewiebug opened 12 years ago
This mode should include the feature of exporting the graph (as image - GIF/PNG) in addition to CSV data.
Command line mode should not not depend on any GUI component to run : That is should be able to run in a non interative session/shell. This would allow to use it in automated builds/test suites.
I agree.
I have a java class that takes a gc.log filename and prints some information (throughput, max used mem after gc, total gc'ed mem) on System.out using GCViewer classes. Here is my source code :
import com.tagtraum.perf.gcviewer.*; import java.io.FileInputStream; import java.io.File; import java.util.logging.Logger; import java.util.logging.Level; import java.util.Locale; public class GCLogStatistics { private final GCLogStatistics i = null; private static final DataReaderFactory factory = new DataReaderFactory(); public static void main (String args[]) { if (args == null || args.length != 1) { System.out.println("Usage: GCLogStatistics gc.log"); return; } GCLogStatistics i = new GCLogStatistics(args[0]); } GCLogStatistics(String filename) { try { final File f = new File(filename); final FileInputStream in = new FileInputStream(f); final DataReader reader = factory.getDataReader(in); final GCModel model = reader.read(); System.out.printf(Locale.US,"THROUGHPUT:%2.2f\n",model.getThroughput()); System.out.println("MAXUSEDMEM:"+model.getPostFullGCUsedMemory().getMax()); System.out.println("TOTALGCEDMEM:"+model.getFreedMemory()); } catch (Exception e ) { System.err.println (e.toString ()); } } }
GCViewer should be have a command line only mode so that no interaction is required to process a gc log file. This mode would allow the use of gcviewer in automated scripts. Add option to support export of graph as image.