Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

command line only mode #4

Open
chewiebug opened this issue Dec 28, 2011 · 5 comments
Open

command line only mode #4

chewiebug opened this issue Dec 28, 2011 · 5 comments

Comments

@chewiebug
Copy link
Owner

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.

@nsureshn
Copy link

This mode should include the feature of exporting the graph (as image - GIF/PNG) in addition to CSV data.

@thierry-feltin
Copy link

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.

@chewiebug
Copy link
Owner Author

I agree.

@dleborgne
Copy link

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 ()); 
        }
    }
    
}

@chewiebug
Copy link
Owner Author

Hi David,

Thank you for this sample. There is another user working on this issue (pbilstein). His approach extracts more information. When he releases his code I'll have to see how I can combine the two different approaches.

Regards, Jörg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants