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
Nested ClassesModifier and TypeClassDescriptionstatic @interfaceUsed on nodes to always enable specialization statistics.static classClass to collect statistics information per node. -
Method Summary
Modifier and TypeMethodDescriptionstatic SpecializationStatisticscreate()Creates a new specialization statistics instance.enter()Enters this specialization instance object on the current thread.booleanhasData()Returnstrueif the statistics did collect any data, elsefalse.voidLeaves the currentlyenteredentered statistics.voidprintHistogram(PrintStream stream) Prints the specialization histogram to the provided stream.voidprintHistogram(PrintWriter writer) Prints the specialization histogram to the provided writer.
-
Method Details
-
hasData
public boolean hasData()Returnstrueif the statistics did collect any data, elsefalse.- Since:
- 20.3
-
printHistogram
Prints the specialization histogram to the provided writer. Does not print anything if nodatawas collected.- Since:
- 20.3
- See Also:
-
printHistogram
Prints the specialization histogram to the provided stream. Does not print anything if nodatawas collected.- Since:
- 20.3
- See Also:
-
create
Creates a new specialization statistics instance. Note specialization statistics need to beenteredto 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 withspecializationsthat 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 currentlyenteredentered 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
-