Package de.cuioss.benchmarking.common.jfr
package de.cuioss.benchmarking.common.jfr
Java Flight Recorder (JFR) utilities for benchmark analysis.
This package provides common JFR functionality that can be reused across different benchmark implementations:
JfrInstrumentation- Central management for JFR event recordingJfrVarianceAnalyzer- Analysis of JFR recordings for variance metricsJfrSupport- Detection and validation of JFR availability- Custom JFR Events:
OperationEvent- Individual operation trackingOperationStatisticsEvent- Periodic statisticsBenchmarkPhaseEvent- Benchmark lifecycle phases
Usage Example:
// Check JFR support
if (!JfrSupport.isAvailable()) {
System.out.println("JFR not available, skipping instrumentation");
return;
}
// Start recording directly
Recording recording = new Recording();
recording.setDestination(Path.of("benchmark.jfr"));
recording.setName("My Benchmark");
recording.start();
// Use instrumentation
JfrInstrumentation instrumentation = new JfrInstrumentation();
try {
// Record operations
try (var recorder = instrumentation.recordOperation("MyBenchmark", "validation")) {
// Perform operation
recorder.withPayloadSize(1024)
.withSuccess(true);
}
} finally {
instrumentation.shutdown();
recording.stop();
recording.close();
}
// Analyze results
JfrVarianceAnalyzer analyzer = new JfrVarianceAnalyzer();
var report = analyzer.analyze(Path.of("benchmark.jfr"));
report.printSummary();
-
ClassesClassDescriptionJFR event to mark benchmark phases (warmup, measurement, etc).Central management for JFR instrumentation in benchmarks.Utility class for detecting and verifying JFR (Java Flight Recorder) support.Analyzes JFR recordings to extract operation variance metrics.Metrics for a specific operation type within a benchmark.Variance analysis report containing metrics for all operations.JFR event for tracking individual benchmark operation performance.Periodic JFR event that captures operation statistics over time windows.