Skip to content

[GR-47881] [GR-59369] Drop total types/fields/methods from build output. #11245

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/reference-manual/native-image/BuildOptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ There are some expert level options that a user may find useful or needed. For e

Native Image provides an informative [build output](BuildOutput.md) including various statistics during the build process.
The build output in a JSON-based, machine-readable format can be requested using the `-H:BuildOutputJSONFile` option, and later processed by a monitoring tool.
The JSON files validate against the JSON schema defined in [build-output-schema-v0.9.3.json](https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/assets/build-output-schema-v0.9.3.json).
The JSON files validate against the JSON schema defined in [build-output-schema-v0.9.4.json](https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/assets/build-output-schema-v0.9.4.json).
A comprehensive report with additional information can be requested using the `--emit build-report` option.

> Note: The `--emit build-report` option is not available in GraalVM Community Edition.
Expand Down
18 changes: 9 additions & 9 deletions docs/reference-manual/native-image/BuildOutput.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,9 @@ GraalVM Native Image: Generating 'helloworld' (executable)...
- 13.24GB of memory (42.7% of system memory, using available memory)
- 16 thread(s) (100.0% of 16 available processor(s), determined at start)
[2/8] Performing analysis... [****] (4.5s @ 0.54GB)
3,163 reachable types (72.5% of 4,364 total)
3,801 reachable fields (50.3% of 7,553 total)
15,183 reachable methods (45.5% of 33,405 total)
957 types, 81 fields, and 480 methods registered for reflection
57 types, 55 fields, and 52 methods registered for JNI access
3,158 types, 3,625 fields, and 14,804 methods found reachable
1,012 types, 36 fields, and 377 methods registered for reflection
57 types, 57 fields, and 52 methods registered for JNI access
4 native libraries: dl, pthread, rt, z
[3/8] Building universe... (0.8s @ 0.99GB)
[4/8] Parsing methods... [*] (0.6s @ 0.75GB)
Expand Down Expand Up @@ -160,9 +158,11 @@ The progress indicator visualizes the number of analysis iterations.
A large number of iterations can indicate problems in the analysis likely caused by misconfiguration or a misbehaving feature.

#### <a name="glossary-reachability"></a>Reachable Types, Fields, and Methods
The number of types (primitives, classes, interfaces, and arrays), fields, and methods that are reachable versus the total number of types, fields, and methods loaded as part of the build process.
A significantly larger number of loaded elements that are not reachable can indicate a configuration problem.
To reduce overhead, please ensure that your class path and module path only contain entries that are needed for building the application.
The number of types (primitives, classes, interfaces, and arrays), fields, and methods that are found reachable by the static analysis.
The reachability metrics give an impression of how small or large the application is.
These metrics can be helpful when compared before and after merging code changes or adding, removing, or upgrading dependencies of an application.
This can help to understand the impact that certain code changes or dependencies have on the overall native binary.
A larger number of reachable types, fields, and methods will also result in a larger native binary.

#### <a name="glossary-reflection-registrations"></a>Reflection Registrations
The number of types, fields, and methods that are registered for reflection.
Expand Down Expand Up @@ -391,7 +391,7 @@ This schema also contains descriptions for each possible artifact type and expla

The build output produced by the `native-image` builder is designed for humans, can evolve with new releases, and should thus not be parsed in any way by tools.
Instead, use the `-H:BuildOutputJSONFile=<file.json>` option to instruct the builder to produce machine-readable build output in JSON format that can be used, for example, for building monitoring tools.
Such a JSON file validates against the JSON schema defined in [`build-output-schema-v0.9.3.json`](https://github.com/oracle/graal/tree/master/docs/reference-manual/native-image/assets/build-output-schema-v0.9.3.json).
Such a JSON file validates against the JSON schema defined in [`build-output-schema-v0.9.4.json`](https://github.com/oracle/graal/tree/master/docs/reference-manual/native-image/assets/build-output-schema-v0.9.4.json).
Note that a JSON file is produced if and only if a build succeeds.

The following example illustrates how this could be used in a CI/CD build pipeline to check that the number of reachable methods does not exceed a certain threshold:
Expand Down
Loading
Loading