gctoolkit/sample
David Grieve 2f14bd62d6
Changes for publishing to Maven Central (#399)
* Add pipeline to publish gctoolkit
Co-authored-by: Luigi Montoya <14238768+Luigi96@users.noreply.github.com>
Co-authored-by: Joe Braley <106336504+joebraley@users.noreply.github.com>
Co-authored-by: Derek Keeler <11466735+d3r3kk@users.noreply.github.com>

* [maven-release-plugin] prepare branch @{releaseLabel}

* [maven-release-plugin] rollback changes from release preparation of my-branch

* Add pipeline to publish gctoolkit
Co-authored-by: Luigi Montoya <14238768+Luigi96@users.noreply.github.com>
Co-authored-by: Joe Braley <106336504+joebraley@users.noreply.github.com>
Co-authored-by: Derek Keeler <11466735+d3r3kk@users.noreply.github.com>

* do not run javadoc on modules that are not published

* pipeline for pre-merge checks
2024-11-15 11:51:16 -05:00
..
src/main/java
README.md
pom.xml Changes for publishing to Maven Central (#399) 2024-11-15 11:51:16 -05:00

README.md

GCToolKit introductory sample

This sample shows how to use GCToolKit to analyze a GC log file and report on total heap occupancy after a GC cycle has been completed. For more details on how GCToolKit and this sample work, visit Introducing Microsoft GCToolKit.

To run the sample

We use the Maven wrapper (mvnw) so you don't have to change your system wide Maven.

From Maven

Install the sample to your local maven repository with mvnw install, then use mvnw exec:exec to run the sample.

mvnw clean install
mvnw exec:exec

By default, the sample analyzes ../gclogs/preunified/cms/defnew/details/defnew.log. Set the parameter gcLogPath to analyze a different GC log file.

mvnw exec:exec -DgcLogFile=../gclogs/unified/parallel/parallelgc.log

From the command line

The sample can also be run from the command line with Java 11 or higher. Compile the sample with mvnw compile dependency:copy-dependencies, then run java with --module-path and give it the path to a GC log file as an argument.

mvnw clean compile dependency:copy-dependencies
java --module-path target/classes:target/lib --module com.microsoft.gctoolkit.sample/com.microsoft.gctoolkit.sample.Main ../gclogs/preunified/cms/defnew/details/defnew.log

Troubleshooting

mvnw exec:java fails

If you try to run the exec:java goal, you may see the following error:

Unable to parse configuration of mojo org.codehaus.mojo:exec-maven-plugin:3.0.0:java for parameter arguments: Cannot store value into array

This has something to do with the Exec Maven Plugin, which automatically builds the command line from the project dependencies. But it is unclear exactly what the cause of this issue is. The solution is to use the exec:exec goal.

java.nio.file.NoSuchFileException: ../gclogs/preunified/cms/defnew/details/defnew.log

There are two possible issues here.

  1. There is no gclogs directory in the top-level directory. The sample uses unit-test data from building GCToolKit. Either run mvnw test from the top-level directory, or use -DgcLogFile=<path-to-gc-log-file> argument to specify a log file.
  2. The sample is not being run from the sample directory. Please ensure you are in the sample directory before executing mvnw exec:exec.