diff options
| author | 2020-07-03 15:04:21 +0100 | |
|---|---|---|
| committer | 2020-07-03 19:31:43 +0000 | |
| commit | c473dc7ae830ff6db4c9cead2be679af41da80e3 (patch) | |
| tree | b5b02261fdd2822f6478e0b83698bf35ee7c5e9a | |
| parent | 01e5698d5440c2665b7ab6dd924985843be161a2 (diff) | |
Create individual counters and timers for compilation kinds.
Bug: 112676029
Test: m
Change-Id: I6f500d1253288e89ab83cd5d77f6ce0360bff340
| -rw-r--r-- | compiler/jit/jit_compiler.cc | 7 | ||||
| -rw-r--r-- | runtime/jit/jit_code_cache.cc | 22 | ||||
| -rw-r--r-- | runtime/jit/jit_code_cache.h | 7 |
3 files changed, 28 insertions, 8 deletions
diff --git a/compiler/jit/jit_compiler.cc b/compiler/jit/jit_compiler.cc index 2ad394235f..b254c57fa6 100644 --- a/compiler/jit/jit_compiler.cc +++ b/compiler/jit/jit_compiler.cc @@ -181,7 +181,12 @@ bool JitCompiler::CompileMethod( // Do the compilation. bool success = false; { - TimingLogger::ScopedTiming t2("Compiling", &logger); + TimingLogger::ScopedTiming t2(compilation_kind == CompilationKind::kOsr + ? "Compiling OSR" + : compilation_kind == CompilationKind::kOptimized + ? "Compiling optimized" + : "Compiling baseline", + &logger); JitCodeCache* const code_cache = runtime->GetJit()->GetCodeCache(); uint64_t start_ns = NanoTime(); success = compiler_->JitCompile( diff --git a/runtime/jit/jit_code_cache.cc b/runtime/jit/jit_code_cache.cc index 4ea61c69d8..373d93c326 100644 --- a/runtime/jit/jit_code_cache.cc +++ b/runtime/jit/jit_code_cache.cc @@ -267,7 +267,8 @@ JitCodeCache::JitCodeCache() collection_in_progress_(false), last_collection_increased_code_cache_(false), garbage_collect_code_(true), - number_of_compilations_(0), + number_of_baseline_compilations_(0), + number_of_optimized_compilations_(0), number_of_osr_compilations_(0), number_of_collections_(0), histogram_stack_map_memory_use_("Memory used for stack maps", 16), @@ -694,7 +695,17 @@ bool JitCodeCache::Commit(Thread* self, return false; } - number_of_compilations_++; + switch (compilation_kind) { + case CompilationKind::kOsr: + number_of_osr_compilations_++; + break; + case CompilationKind::kBaseline: + number_of_baseline_compilations_++; + break; + case CompilationKind::kOptimized: + number_of_optimized_compilations_++; + break; + } // We need to update the debug info before the entry point gets set. // At the same time we want to do under JIT lock so that debug info and JIT maps are in sync. @@ -750,7 +761,6 @@ bool JitCodeCache::Commit(Thread* self, method_code_map_.Put(code_ptr, method); } if (compilation_kind == CompilationKind::kOsr) { - number_of_osr_compilations_++; osr_code_map_.Put(method, code_ptr); } else if (NeedsClinitCheckBeforeCall(method) && !method->GetDeclaringClass()->IsVisiblyInitialized()) { @@ -1913,7 +1923,8 @@ void JitCodeCache::Dump(std::ostream& os) { << "Current JIT capacity: " << PrettySize(GetCurrentRegion()->GetCurrentCapacity()) << "\n" << "Current number of JIT JNI stub entries: " << jni_stubs_map_.size() << "\n" << "Current number of JIT code cache entries: " << method_code_map_.size() << "\n" - << "Total number of JIT compilations: " << number_of_compilations_ << "\n" + << "Total number of JIT baseline compilations: " << number_of_baseline_compilations_ << "\n" + << "Total number of JIT optimized compilations: " << number_of_optimized_compilations_ << "\n" << "Total number of JIT compilations for on stack replacement: " << number_of_osr_compilations_ << "\n" << "Total number of JIT code cache collections: " << number_of_collections_ << std::endl; @@ -1947,7 +1958,8 @@ void JitCodeCache::PostForkChildAction(bool is_system_server, bool is_zygote) { } // Reset all statistics to be specific to this process. - number_of_compilations_ = 0; + number_of_baseline_compilations_ = 0; + number_of_optimized_compilations_ = 0; number_of_osr_compilations_ = 0; number_of_collections_ = 0; histogram_stack_map_memory_use_.Reset(); diff --git a/runtime/jit/jit_code_cache.h b/runtime/jit/jit_code_cache.h index 43406033fa..d055ed3398 100644 --- a/runtime/jit/jit_code_cache.h +++ b/runtime/jit/jit_code_cache.h @@ -579,8 +579,11 @@ class JitCodeCache { // ---------------- JIT statistics -------------------------------------- // - // Number of compilations done throughout the lifetime of the JIT. - size_t number_of_compilations_ GUARDED_BY(Locks::jit_lock_); + // Number of baseline compilations done throughout the lifetime of the JIT. + size_t number_of_baseline_compilations_ GUARDED_BY(Locks::jit_lock_); + + // Number of optimized compilations done throughout the lifetime of the JIT. + size_t number_of_optimized_compilations_ GUARDED_BY(Locks::jit_lock_); // Number of compilations for on-stack-replacement done throughout the lifetime of the JIT. size_t number_of_osr_compilations_ GUARDED_BY(Locks::jit_lock_); |