You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Add support for PGO instrumentation
This commit adds support for PGO instrumentation. This should be
enabled by adding the `--pgo-instrument` option to the Gradle
command line. When this is done, then the generated binary will
be compiled with PGO instrumentation enabled, and the binary
name will be suffixed with `-instrumented`.
It is possible to run the instrumented binary directly too,
in which case the profile files will be written in the same
directory as the binary.
* Add support for a PGO profiles directory
By convention, the directory is set to `src/pgo-profiles/<binary>`.
For example, for the `main` binary, the directory where to put
PGO profiles would be `src/pgo-profiles/main`. If that directory
is present _and that we're not instrumenting_, then the profile
will be used when compiling with native image.
It is possible to provide multiple profiles in a single directory.
* Remove GraalVM version from workflows
* Add documentation about PGO support
See #457
* Fix JUnit native test
* Make checkstyle happy
* Fix tests
* Temporarily(?) disable testing with config cache
As we're not compatible. Test `org.graalvm.buildtools.gradle.OfficialMetadataRepoFunctionalTest`
throws an incomprehensible error message, in all versions of Gradle I've tested:
```
Configuration cache state could not be cached: field `spec` of `org.gradle.api.internal.tasks.execution.SelfDescribingSpec` bean found in task `:compileJava` of type `org.gradle.api.tasks.compile.JavaCompile`: error writing value of type 'org.gradle.api.internal.tasks.compile.CompilerForkUtils$$Lambda$1235/0x00000008015b1c38'
> Unable to make field private final java.lang.Object[] java.lang.invoke.SerializedLambda.capturedArgs accessible: module java.base does not "opens java.lang.invoke" to unnamed module @3cc98b0c
```
This PR also rewrote some code which fixed other configuration
cache issues which arose _before_ reaching this one.
* Upgrade to JUnit 5.10.0
* Make checkstyle happy
* Fix test
* Restore configuration cache tests
* Update baseline versions for config cache
Copy file name to clipboardExpand all lines: common/junit-platform-native/src/main/java/org/graalvm/junit/platform/config/jupiter/JupiterConfigProvider.java
+14-5
Original file line number
Diff line number
Diff line change
@@ -81,16 +81,25 @@ public void onLoad(NativeImageConfiguration config) {
For more advanced configurations you can declare a `org.graalvm.buildtools.gradle.tasks.CollectReachabilityMetadata` task and set the appropriate properties.
451
451
452
+
[[pgo-support]]
453
+
== Profile-guided optimizations
454
+
455
+
The plugin supports building images with https://www.graalvm.org/latest/reference-manual/native-image/guides/optimize-native-executable-with-pgo/[Profile-Guided Optimizations].
456
+
457
+
It works in 3 phases:
458
+
459
+
- the first one consists in generating a binary with instrumentation enabled
460
+
- the second phase consists in running the binary in order to gather profiling information
461
+
- the third phase consists in compiling the binary with the generated profile
462
+
463
+
In order to generate a binary with instrumentation enabled, you should run the `nativeCompile` command with the `--pgo-instrument` command line option:
464
+
465
+
`./gradlew nativeCompile --pgo-instrument`
466
+
467
+
This will generate a binary under `build/native/nativeCompile` with the `-instrumented` suffix.
468
+
You can run the binary to gather profiling data:
469
+
470
+
[source,bash]
471
+
----
472
+
$ cd build/native/nativeCompile/
473
+
$ ./my-application-instrumented`
474
+
----
475
+
476
+
A `default.iprof` file will be generated once the application is stopped.
477
+
Alternatively, you can have Gradle both generate and run the instrumented binary in a single command by running:
0 commit comments