It depends on the profiler, but in general you do it in the same way as when profiling any other external JVM application. JVM arguments can be set via the ‘JAVA_OPTS’ or ‘GRADLE_OPTS’ environment variable. If you are using the Gradle daemon, you might want to run with ‘–no-daemon’.