GCViewer icon indicating copy to clipboard operation
GCViewer copied to clipboard

Need documentation for using GCViewer as an API

Open klauern opened this issue 8 years ago • 5 comments

Are there docs or a starting point for utilizing the GCViewer code as an API to extend for other purposes? Things that I could see being able to use the log parsing functionality for:

  • Alerting for
    • High GC activity
    • Full GC events

klauern avatar Feb 29 '16 13:02 klauern

Hi Nick,

I see two options to get the information for your alerting:

  1. use the commandline interface of GCViewer to generate a CSV file containing a lot of information (java -jar gcviewer-1.3x.jar gc.log summary.csv) -> parse the csv file and extract the information
  2. java/com/tagtraum/perf/gcviewer/imp/DataReaderFacade.java and use the resulting GCModel to extract the information you are looking for for the alerts.

Best regards, Jörg

chewiebug avatar Mar 11 '16 15:03 chewiebug

That's excellent information. I think I want to try that DataReaderFacade, as I'd probably be able to make a lot of use out of the GCModel and such in a more fine-tuned manner. Thank you for the info!

klauern avatar Mar 11 '16 16:03 klauern

So I've been using this API, and it works pretty well. Is there a way to just load more recent changes from the file, similar to what you would do with piping tail -f > some-java-command would work? I could probably implement something using the WatchService API, but do I need to re-parse the entire .log file in order to get the changes, or can I just add to a GCModel the newest changes?

klauern avatar Mar 14 '16 19:03 klauern

Hi Nick

Currently, there is no support in GCViewer for partial log file analysis.

I don't know, if this is a feasible workaround for you until there is support: If you can extract the part of the log, you would like to add, you can parse just that part. If you would then like to update an existing GCModel, please be aware, that you have to use GCModels "add(AbstractGCEvent)" method to add parsed events, otherwise statistics of the GCModel won't be updated.

chewiebug avatar Mar 14 '16 20:03 chewiebug

I will look into it. I'm not sure how this will work, but it's worth a shot.

klauern avatar Mar 15 '16 16:03 klauern