Skip to content

Commit c50b464

Browse files
author
Doug Simon
committedDec 19, 2020
8258715: [JVMCI] separate JVMCI code install timers for CompileBroker and hosted compilations
Reviewed-by: kvn
1 parent 64644a1 commit c50b464

File tree

4 files changed

+33
-22
lines changed

4 files changed

+33
-22
lines changed
 

‎src/hotspot/share/compiler/compileBroker.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -2721,13 +2721,6 @@ void CompileBroker::print_times(bool per_compiler, bool aggregate) {
27212721
}
27222722
}
27232723

2724-
#if INCLUDE_JVMCI
2725-
// In hosted mode, print the JVMCI compiler specific counters manually.
2726-
if (EnableJVMCI && !UseJVMCICompiler) {
2727-
JVMCICompiler::print_compilation_timers();
2728-
}
2729-
#endif
2730-
27312724
if (!aggregate) {
27322725
return;
27332726
}
@@ -2777,6 +2770,13 @@ void CompileBroker::print_times(bool per_compiler, bool aggregate) {
27772770
tty->cr();
27782771
comp->print_timers();
27792772
}
2773+
#if INCLUDE_JVMCI
2774+
if (EnableJVMCI) {
2775+
tty->cr();
2776+
JVMCICompiler::print_hosted_timers();
2777+
}
2778+
#endif
2779+
27802780
tty->cr();
27812781
tty->print_cr(" Total compiled methods : %8d methods", total_compile_count);
27822782
tty->print_cr(" Standard compilation : %8d methods", standard_compile_count);

‎src/hotspot/share/jvmci/jvmciCompiler.cpp

+12-11
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333

3434
JVMCICompiler* JVMCICompiler::_instance = NULL;
3535
elapsedTimer JVMCICompiler::_codeInstallTimer;
36+
elapsedTimer JVMCICompiler::_hostedCodeInstallTimer;
3637

3738
JVMCICompiler::JVMCICompiler() : AbstractCompiler(compiler_jvmci) {
3839
_bootstrapping = false;
@@ -152,19 +153,19 @@ void JVMCICompiler::compile_method(ciEnv* env, ciMethod* target, int entry_bci,
152153
ShouldNotReachHere();
153154
}
154155

155-
// Print compilation timers and statistics
156+
// Print CompileBroker compilation timers
156157
void JVMCICompiler::print_timers() {
157-
tty->print_cr(" JVMCI Compile Time: %7.3f s", stats()->total_time());
158-
print_compilation_timers();
158+
double code_install_time = _codeInstallTimer.seconds();
159+
tty->print_cr(" JVMCI CompileBroker Time:");
160+
tty->print_cr(" Compile: %7.3f s", stats()->total_time());
161+
tty->print_cr(" Install Code: %7.3f s", code_install_time);
159162
}
160163

161-
// Print compilation timers and statistics
162-
void JVMCICompiler::print_compilation_timers() {
163-
double code_install_time = _codeInstallTimer.seconds();
164-
if (code_install_time != 0.0) {
165-
tty->cr();
166-
tty->print_cr(" JVMCI code install time: %6.3f s", code_install_time);
167-
}
164+
// Print non-CompileBroker compilation timers
165+
void JVMCICompiler::print_hosted_timers() {
166+
double code_install_time = _hostedCodeInstallTimer.seconds();
167+
tty->print_cr(" JVMCI Hosted Time:");
168+
tty->print_cr(" Install Code: %7.3f s", code_install_time);
168169
}
169170

170171
void JVMCICompiler::inc_methods_compiled() {
@@ -174,4 +175,4 @@ void JVMCICompiler::inc_methods_compiled() {
174175

175176
void JVMCICompiler::inc_global_compilation_ticks() {
176177
Atomic::inc(&_global_compilation_ticks);
177-
}
178+
}

‎src/hotspot/share/jvmci/jvmciCompiler.hpp

+13-3
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,12 @@ class JVMCICompiler : public AbstractCompiler {
4949

5050
static JVMCICompiler* _instance;
5151

52+
// Code installation timer for CompileBroker compilations
5253
static elapsedTimer _codeInstallTimer;
5354

55+
// Code installation timer for non-CompileBroker compilations
56+
static elapsedTimer _hostedCodeInstallTimer;
57+
5458
/**
5559
* Exits the VM due to an unexpected exception.
5660
*/
@@ -107,10 +111,16 @@ class JVMCICompiler : public AbstractCompiler {
107111
int global_compilation_ticks() const { return _global_compilation_ticks; }
108112
void inc_global_compilation_ticks();
109113

110-
// Print compilation timers and statistics
111-
static void print_compilation_timers();
114+
// Print timers related to non-CompileBroker compilations
115+
static void print_hosted_timers();
112116

113-
static elapsedTimer* codeInstallTimer() { return &_codeInstallTimer; }
117+
static elapsedTimer* codeInstallTimer(bool hosted) {
118+
if (!hosted) {
119+
return &_codeInstallTimer;
120+
} else {
121+
return &_hostedCodeInstallTimer;
122+
}
123+
}
114124
};
115125

116126
#endif // SHARE_JVMCI_JVMCICOMPILER_HPP

‎src/hotspot/share/jvmci/jvmciCompilerToVM.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,7 @@ C2V_VMENTRY_0(jint, installCode, (JNIEnv *env, jobject, jobject target, jobject
838838

839839
JVMCICompiler* compiler = JVMCICompiler::instance(true, CHECK_JNI_ERR);
840840

841-
TraceTime install_time("installCode", JVMCICompiler::codeInstallTimer());
841+
TraceTime install_time("installCode", JVMCICompiler::codeInstallTimer(!thread->is_Compiler_thread()));
842842
bool is_immutable_PIC = JVMCIENV->get_HotSpotCompiledCode_isImmutablePIC(compiled_code_handle) > 0;
843843

844844
CodeInstaller installer(JVMCIENV, is_immutable_PIC);

0 commit comments

Comments
 (0)
Please sign in to comment.