diff options
| -rw-r--r-- | runtime/jit/jit.cc | 3 | ||||
| -rw-r--r-- | runtime/jit/jit_code_cache.cc | 9 | ||||
| -rw-r--r-- | runtime/jit/jit_code_cache.h | 6 |
3 files changed, 16 insertions, 2 deletions
diff --git a/runtime/jit/jit.cc b/runtime/jit/jit.cc index 5c9dab2f38..8f4d24f385 100644 --- a/runtime/jit/jit.cc +++ b/runtime/jit/jit.cc @@ -56,7 +56,8 @@ void Jit::DumpInfo(std::ostream& os) { os << "JIT code cache size=" << PrettySize(code_cache_->CodeCacheSize()) << "\n" << "JIT data cache size=" << PrettySize(code_cache_->DataCacheSize()) << "\n" << "JIT current capacity=" << PrettySize(code_cache_->GetCurrentCapacity()) << "\n" - << "JIT number of compiled code=" << code_cache_->NumberOfCompiledCode() << "\n"; + << "JIT number of compiled code=" << code_cache_->NumberOfCompiledCode() << "\n" + << "JIT total number of compilations=" << code_cache_->NumberOfCompilations() << "\n"; cumulative_timings_.Dump(os); } diff --git a/runtime/jit/jit_code_cache.cc b/runtime/jit/jit_code_cache.cc index 2d575bdb31..64b2c899aa 100644 --- a/runtime/jit/jit_code_cache.cc +++ b/runtime/jit/jit_code_cache.cc @@ -125,7 +125,8 @@ JitCodeCache::JitCodeCache(MemMap* code_map, data_end_(initial_data_capacity), has_done_one_collection_(false), last_update_time_ns_(0), - garbage_collect_code_(garbage_collect_code) { + garbage_collect_code_(garbage_collect_code), + number_of_compilations_(0) { DCHECK_GE(max_capacity, initial_code_capacity + initial_data_capacity); code_mspace_ = create_mspace_with_base(code_map_->Begin(), code_end_, false /*locked*/); @@ -322,6 +323,7 @@ uint8_t* JitCodeCache::CommitCodeInternal(Thread* self, __builtin___clear_cache(reinterpret_cast<char*>(code_ptr), reinterpret_cast<char*>(code_ptr + code_size)); + number_of_compilations_++; } // We need to update the entry point in the runnable state for the instrumentation. { @@ -347,6 +349,11 @@ uint8_t* JitCodeCache::CommitCodeInternal(Thread* self, return reinterpret_cast<uint8_t*>(method_header); } +size_t JitCodeCache::NumberOfCompilations() { + MutexLock mu(Thread::Current(), lock_); + return number_of_compilations_; +} + size_t JitCodeCache::CodeCacheSize() { MutexLock mu(Thread::Current(), lock_); return CodeCacheSizeLocked(); diff --git a/runtime/jit/jit_code_cache.h b/runtime/jit/jit_code_cache.h index a152bcd2d4..67fa928f61 100644 --- a/runtime/jit/jit_code_cache.h +++ b/runtime/jit/jit_code_cache.h @@ -68,6 +68,9 @@ class JitCodeCache { // of methods that got JIT compiled, as we might have collected some. size_t NumberOfCompiledCode() REQUIRES(!lock_); + // Number of compilations done throughout the lifetime of the JIT. + size_t NumberOfCompilations() REQUIRES(!lock_); + bool NotifyCompilationOf(ArtMethod* method, Thread* self) SHARED_REQUIRES(Locks::mutator_lock_) REQUIRES(!lock_); @@ -261,6 +264,9 @@ class JitCodeCache { // Whether we can do garbage collection. const bool garbage_collect_code_; + // Number of compilations done throughout the lifetime of the JIT. + size_t number_of_compilations_ GUARDED_BY(lock_); + DISALLOW_IMPLICIT_CONSTRUCTORS(JitCodeCache); }; |