Skip to content

Commit bb42392

Browse files
committed
[GR-19220] Add Truffle::Graal.total_compilation_time (#2628)
PullRequest: truffleruby/3236
2 parents 5b099ff + 66fab14 commit bb42392

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

src/main/java/org/truffleruby/extra/TruffleGraalNodes.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@
4141
import com.oracle.truffle.api.frame.MaterializedFrame;
4242
import com.oracle.truffle.api.nodes.NodeUtil;
4343

44+
import java.lang.management.CompilationMXBean;
45+
import java.lang.management.ManagementFactory;
46+
4447
@CoreModule("Truffle::Graal")
4548
public abstract class TruffleGraalNodes {
4649

@@ -222,4 +225,18 @@ protected Object blackhole(Object value) {
222225

223226
}
224227

228+
@CoreMethod(names = "total_compilation_time", onSingleton = true)
229+
public abstract static class TotalCompilationTimeNode extends CoreMethodArrayArgumentsNode {
230+
private static CompilationMXBean bean;
231+
232+
@TruffleBoundary
233+
@Specialization
234+
protected final long totalCompilationTime() {
235+
if (bean == null) {
236+
bean = ManagementFactory.getCompilationMXBean();
237+
}
238+
239+
return bean.getTotalCompilationTime();
240+
}
241+
}
225242
}

tool/jt.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2854,7 +2854,7 @@ def format_specializations_arguments
28542854
end
28552855

28562856
def format_specializations_check
2857-
abort 'Some Specializations were not protected.' if format_specializations_visibility
2857+
abort 'Some Specializations did not use the protected visibility.' if format_specializations_visibility
28582858
abort 'Some Specializations were not properly formatted.' if format_specializations_arguments
28592859
abort 'There were extra blank lines around imports.' if Formatting.format_imports
28602860
end

0 commit comments

Comments
 (0)