Class CompilationProfiler
java.lang.Object
io.micronaut.python.compiler.CompilationProfiler
Collects the
CompilationProfile of one compilation: phases are timed inclusively from
phase(String) to the close of the span it returns, counters accumulate, and the output
directory is inventoried once the compilation wrote it. Nothing here runs unless profiling was
enabled on the compiler; a null profiler is a no-op at every call site through the static
span(CompilationProfiler, String) and increment(CompilationProfiler, String, long).
The profiler is used from one thread at a time (the compiler runs javac on the calling thread), but the methods synchronise anyway so a callback from another thread cannot corrupt it.
- Since:
- 5.3.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceA running phase, closed when the phase ends. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a profiler recording the JVM, its process and its uptime, which tells a compilation in a fresh worker from one in a reused, warmed-up worker. -
Method Summary
Modifier and TypeMethodDescriptionvoidRecords an attribute of the compilation.voidAdds to a counter.finish()Ends the profile.static voidincrement(@Nullable CompilationProfiler profiler, String name, long delta) Adds to a counter of the given profiler, or nothing when it is null.voidInventories the output directory: the generated Java sources, class files, Python sources and bytecode, and the other resources, with their sizes.Starts a phase.static CompilationProfiler.Spanspan(@Nullable CompilationProfiler profiler, String name) Starts a phase on the given profiler, or nothing when it is null.
-
Constructor Details
-
CompilationProfiler
public CompilationProfiler()Creates a profiler recording the JVM, its process and its uptime, which tells a compilation in a fresh worker from one in a reused, warmed-up worker.
-
-
Method Details
-
span
public static CompilationProfiler.Span span(@Nullable @Nullable CompilationProfiler profiler, String name) Starts a phase on the given profiler, or nothing when it is null.- Parameters:
profiler- The profiler, or null when profiling is offname- The phase name- Returns:
- The span to close when the phase ends
-
increment
public static void increment(@Nullable @Nullable CompilationProfiler profiler, String name, long delta) Adds to a counter of the given profiler, or nothing when it is null.- Parameters:
profiler- The profiler, or null when profiling is offname- The counter namedelta- The amount to add
-
attribute
-
phase
Starts a phase. A phase started again accumulates; a phase started while another runs is nested in it for the report.- Parameters:
name- The phase name- Returns:
- The span to close when the phase ends
-
count
Adds to a counter.- Parameters:
name- The counter namedelta- The amount to add
-
inventory
Inventories the output directory: the generated Java sources, class files, Python sources and bytecode, and the other resources, with their sizes.- Parameters:
outputDirectory- The output directory of the compilation
-
finish
-