Package com.oracle.truffle.api.dsl
Class SpecializationStatistics
java.lang.Object
com.oracle.truffle.api.dsl.SpecializationStatistics
Represents a specialization statistics utiltiy that can be
entered
to collect
additional statistics about Truffle DSL nodes. In order for the statistics to be useful the nodes
need to be regenerated using the -Atruffle.dsl.GenerateSpecializationStatistics=true
flag or using the SpecializationStatistics.AlwaysEnabled
annotation.
The easiest way to use this utility is to enable the
--engine.SpecializationStatistics
polyglot option. This should print the histogram
when the engine is closed.
See also the usage tutorial on the website.
- Since:
- 20.3
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic @interface
Used on nodes to always enable specialization statistics.static class
Class to collect statistics information per node. -
Method Summary
Modifier and TypeMethodDescriptionstatic SpecializationStatistics
create()
Creates a new specialization statistics instance.enter()
Enters this specialization instance object on the current thread.boolean
hasData()
Returnstrue
if the statistics did collect any data, elsefalse
.void
Leaves the currentlyentered
entered statistics.void
printHistogram
(PrintStream stream) Prints the specialization histogram to the provided stream.void
printHistogram
(PrintWriter writer) Prints the specialization histogram to the provided writer.
-
Method Details
-
hasData
public boolean hasData()Returnstrue
if the statistics did collect any data, elsefalse
.- Since:
- 20.3
-
printHistogram
Prints the specialization histogram to the provided writer. Does not print anything if nodata
was collected.- Since:
- 20.3
- See Also:
-
printHistogram
Prints the specialization histogram to the provided stream. Does not print anything if nodata
was collected.- Since:
- 20.3
- See Also:
-
create
Creates a new specialization statistics instance. Note specialization statistics need to beentered
to collect data on a thread.- Since:
- 20.3
-
enter
Enters this specialization instance object on the current thread. After entering a specialization statistics instance will gather statistics for all nodes withspecializations
that were created on this entered thread. Multiple threads may be entered at the same time. The caller must make sure toleave(SpecializationStatistics)
the current statistics after entering in all cases.- Since:
- 20.3
-
leave
Leaves the currentlyentered
entered statistics. It is required to leave a statistics block after it was entered. It is recommended to use a finally block for this purpose.- Since:
- 20.3
-