8204476: Add additional statistics to CodeCache::print_summary
Reviewed-by: kvn, stuefe
Contributed-by: Rene Schuenemann <rene.schuenemann@gmail.com>
--- a/src/hotspot/share/code/codeCache.cpp Tue Jun 12 14:16:41 2018 +0530
+++ b/src/hotspot/share/code/codeCache.cpp Wed May 30 14:46:17 2018 +0200
@@ -1609,6 +1609,7 @@
}
void CodeCache::print_summary(outputStream* st, bool detailed) {
+ int full_count = 0;
FOR_ALL_HEAPS(heap_iterator) {
CodeHeap* heap = (*heap_iterator);
size_t total = (heap->high_boundary() - heap->low_boundary());
@@ -1627,6 +1628,8 @@
p2i(heap->low_boundary()),
p2i(heap->high()),
p2i(heap->high_boundary()));
+
+ full_count += get_codemem_full_count(heap->code_blob_type());
}
}
@@ -1638,6 +1641,10 @@
"enabled" : Arguments::mode() == Arguments::_int ?
"disabled (interpreter mode)" :
"disabled (not enough contiguous free space left)");
+ st->print_cr(" stopped_count=%d, restarted_count=%d",
+ CompileBroker::get_total_compiler_stopped_count(),
+ CompileBroker::get_total_compiler_restarted_count());
+ st->print_cr(" full_count=%d", full_count);
}
}
--- a/src/hotspot/share/compiler/compileBroker.cpp Tue Jun 12 14:16:41 2018 +0530
+++ b/src/hotspot/share/compiler/compileBroker.cpp Wed May 30 14:46:17 2018 +0200
@@ -170,21 +170,23 @@
elapsedTimer CompileBroker::_t_invalidated_compilation;
elapsedTimer CompileBroker::_t_bailedout_compilation;
-int CompileBroker::_total_bailout_count = 0;
-int CompileBroker::_total_invalidated_count = 0;
-int CompileBroker::_total_compile_count = 0;
-int CompileBroker::_total_osr_compile_count = 0;
-int CompileBroker::_total_standard_compile_count = 0;
+int CompileBroker::_total_bailout_count = 0;
+int CompileBroker::_total_invalidated_count = 0;
+int CompileBroker::_total_compile_count = 0;
+int CompileBroker::_total_osr_compile_count = 0;
+int CompileBroker::_total_standard_compile_count = 0;
+int CompileBroker::_total_compiler_stopped_count = 0;
+int CompileBroker::_total_compiler_restarted_count = 0;
-int CompileBroker::_sum_osr_bytes_compiled = 0;
-int CompileBroker::_sum_standard_bytes_compiled = 0;
-int CompileBroker::_sum_nmethod_size = 0;
-int CompileBroker::_sum_nmethod_code_size = 0;
+int CompileBroker::_sum_osr_bytes_compiled = 0;
+int CompileBroker::_sum_standard_bytes_compiled = 0;
+int CompileBroker::_sum_nmethod_size = 0;
+int CompileBroker::_sum_nmethod_code_size = 0;
-long CompileBroker::_peak_compilation_time = 0;
+long CompileBroker::_peak_compilation_time = 0;
-CompileQueue* CompileBroker::_c2_compile_queue = NULL;
-CompileQueue* CompileBroker::_c1_compile_queue = NULL;
+CompileQueue* CompileBroker::_c2_compile_queue = NULL;
+CompileQueue* CompileBroker::_c1_compile_queue = NULL;
--- a/src/hotspot/share/compiler/compileBroker.hpp Tue Jun 12 14:16:41 2018 +0530
+++ b/src/hotspot/share/compiler/compileBroker.hpp Wed May 30 14:46:17 2018 +0200
@@ -219,6 +219,8 @@
static int _total_native_compile_count;
static int _total_osr_compile_count;
static int _total_standard_compile_count;
+ static int _total_compiler_stopped_count;
+ static int _total_compiler_restarted_count;
static int _sum_osr_bytes_compiled;
static int _sum_standard_bytes_compiled;
static int _sum_nmethod_size;
@@ -338,7 +340,15 @@
static bool set_should_compile_new_jobs(jint new_state) {
// Return success if the current caller set it
jint old = Atomic::cmpxchg(new_state, &_should_compile_new_jobs, 1-new_state);
- return (old == (1-new_state));
+ bool success = (old == (1-new_state));
+ if (success) {
+ if (new_state == run_compilation) {
+ _total_compiler_restarted_count++;
+ } else {
+ _total_compiler_stopped_count++;
+ }
+ }
+ return success;
}
static void disable_compilation_forever() {
@@ -393,18 +403,20 @@
static CompileLog* get_log(CompilerThread* ct);
- static int get_total_compile_count() { return _total_compile_count; }
- static int get_total_bailout_count() { return _total_bailout_count; }
- static int get_total_invalidated_count() { return _total_invalidated_count; }
- static int get_total_native_compile_count() { return _total_native_compile_count; }
- static int get_total_osr_compile_count() { return _total_osr_compile_count; }
- static int get_total_standard_compile_count() { return _total_standard_compile_count; }
- static int get_sum_osr_bytes_compiled() { return _sum_osr_bytes_compiled; }
- static int get_sum_standard_bytes_compiled() { return _sum_standard_bytes_compiled; }
- static int get_sum_nmethod_size() { return _sum_nmethod_size;}
- static int get_sum_nmethod_code_size() { return _sum_nmethod_code_size; }
- static long get_peak_compilation_time() { return _peak_compilation_time; }
- static long get_total_compilation_time() { return _t_total_compilation.milliseconds(); }
+ static int get_total_compile_count() { return _total_compile_count; }
+ static int get_total_bailout_count() { return _total_bailout_count; }
+ static int get_total_invalidated_count() { return _total_invalidated_count; }
+ static int get_total_native_compile_count() { return _total_native_compile_count; }
+ static int get_total_osr_compile_count() { return _total_osr_compile_count; }
+ static int get_total_standard_compile_count() { return _total_standard_compile_count; }
+ static int get_total_compiler_stopped_count() { return _total_compiler_stopped_count; }
+ static int get_total_compiler_restarted_count() { return _total_compiler_restarted_count; }
+ static int get_sum_osr_bytes_compiled() { return _sum_osr_bytes_compiled; }
+ static int get_sum_standard_bytes_compiled() { return _sum_standard_bytes_compiled; }
+ static int get_sum_nmethod_size() { return _sum_nmethod_size;}
+ static int get_sum_nmethod_code_size() { return _sum_nmethod_code_size; }
+ static long get_peak_compilation_time() { return _peak_compilation_time; }
+ static long get_total_compilation_time() { return _t_total_compilation.milliseconds(); }
// Log that compilation profiling is skipped because metaspace is full.
static void log_metaspace_failure();