Class InstrumentingProfiler
- Direct Known Subclasses:
AsyncProfiler,JfrProfiler,JProfilerProfiler,YourKitProfiler
- Instrument a JVM using JVM args
- Start recording on JVM start, using JVM args
- Capture snapshot on JVM exit, using JVM args
- Use some communication mechanism to start recording in an instrumented JVM that is currently running.
- Use some communication mechanism to pause recording in an instrumented JVM that is currently running.
- Use some communication mechanism to capture a snapshot from an instrumented JVM that is currently running.
The profiler may support starting recording multiple times for a given JVM. The implementation should indicate this by overriding canRestartRecording(ScenarioSettings).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface -
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleancanRestartRecording(ScenarioSettings settings) Can this profiler implementation restart recording, for the same JVM?protected abstract InstrumentingProfiler.SnapshotCapturingProfilerControllerdoNewController(ScenarioSettings settings) protected abstract JvmArgsCalculatorjvmArgsWithInstrumentation(ScenarioSettings settings, boolean startRecordingOnProcessStart, boolean captureSnapshotOnProcessExit) Creates JVM args to instrument that JVM with the given capabilities enabled.newController(String pid, ScenarioSettings settings) Creates a controller for this profiler.Calculates the JVM args for measured builds.newJvmArgsCalculator(ScenarioSettings settings) Calculates the JVM args for all builds, including warm-ups.voidvalidate(ScenarioSettings settings, Consumer<String> reporter) protected voidvalidateMultipleDaemons(ScenarioSettings settings, Consumer<String> reporter) protected voidvalidateMultipleIterationsWithCleanupAction(ScenarioSettings settings, Consumer<String> reporter) Methods inherited from class org.gradle.profiler.Profiler
isCreatesStacksFiles, newGradleArgsCalculator, newInstrumentedBuildsGradleArgsCalculator, summarizeResultFile
-
Constructor Details
-
InstrumentingProfiler
public InstrumentingProfiler()
-
-
Method Details
-
newJvmArgsCalculator
Calculates the JVM args for all builds, including warm-ups.When the daemon will not be reused, this does nothing as there is no need to instrument the warm-up builds in this case.
When the daemon will be reused for all builds, then instrument the daemon but do not start recording or capture snapshots yet. Recording and capture will be enabled later when the measured builds run.
- Overrides:
newJvmArgsCalculatorin classProfiler
-
newInstrumentedBuildsJvmArgsCalculator
Calculates the JVM args for measured builds.When the daemon will be reused for all builds, this does nothing as the daemon is already instrumented (above).
When using a cold daemon, start the JVM with recording enabled but do not capture snapshots yet.
When using no daemon, start the JVM with recording enabled and capture a snapshot when the JVM exits.
- Overrides:
newInstrumentedBuildsJvmArgsCalculatorin classProfiler
-
newController
Creates a controller for this profiler.When the daemon will be reused for all builds, create a controller that starts and stops recording when requested, and that captures a snapshot at the end of the session.
When using a cold daemon, create a controller that stops recording and captures a snapshot when requested, but does not start recording as this is already enabled when the JVM starts.
When using no daemon, return a controller that finishes the session only, as recording and snapshot capture are already enabled when the JVM starts.
- Overrides:
newControllerin classProfiler
-
validate
-
validateMultipleIterationsWithCleanupAction
protected void validateMultipleIterationsWithCleanupAction(ScenarioSettings settings, Consumer<String> reporter) -
validateMultipleDaemons
-
canRestartRecording
Can this profiler implementation restart recording, for the same JVM? -
jvmArgsWithInstrumentation
protected abstract JvmArgsCalculator jvmArgsWithInstrumentation(ScenarioSettings settings, boolean startRecordingOnProcessStart, boolean captureSnapshotOnProcessExit) Creates JVM args to instrument that JVM with the given capabilities enabled. -
doNewController
protected abstract InstrumentingProfiler.SnapshotCapturingProfilerController doNewController(ScenarioSettings settings)
-