Dump the number of OSR compiled code.
Change-Id: I20efc80e8556da8220dab92c3a7947f883d48cf8
diff --git a/runtime/jit/jit.cc b/runtime/jit/jit.cc
index bdc7ee2..cdf09bf 100644
--- a/runtime/jit/jit.cc
+++ b/runtime/jit/jit.cc
@@ -63,7 +63,8 @@
<< "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 total number of compilations=" << code_cache_->NumberOfCompilations() << "\n";
+ << "JIT total number of compilations=" << code_cache_->NumberOfCompilations() << "\n"
+ << "JIT total number of osr compilations=" << code_cache_->NumberOfOsrCompilations() << "\n";
cumulative_timings_.Dump(os);
}
diff --git a/runtime/jit/jit_code_cache.cc b/runtime/jit/jit_code_cache.cc
index 478b164..8858b48 100644
--- a/runtime/jit/jit_code_cache.cc
+++ b/runtime/jit/jit_code_cache.cc
@@ -128,7 +128,8 @@
garbage_collect_code_(garbage_collect_code),
used_memory_for_data_(0),
used_memory_for_code_(0),
- number_of_compilations_(0) {
+ number_of_compilations_(0),
+ number_of_osr_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*/);
@@ -338,6 +339,7 @@
MutexLock mu(self, lock_);
method_code_map_.Put(code_ptr, method);
if (osr) {
+ number_of_osr_compilations_++;
osr_code_map_.Put(method, code_ptr);
} else {
Runtime::Current()->GetInstrumentation()->UpdateMethodsCode(
@@ -366,6 +368,11 @@
return number_of_compilations_;
}
+size_t JitCodeCache::NumberOfOsrCompilations() {
+ MutexLock mu(Thread::Current(), lock_);
+ return number_of_osr_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 e5b8e6c..4574edf 100644
--- a/runtime/jit/jit_code_cache.h
+++ b/runtime/jit/jit_code_cache.h
@@ -73,6 +73,7 @@
// Number of compilations done throughout the lifetime of the JIT.
size_t NumberOfCompilations() REQUIRES(!lock_);
+ size_t NumberOfOsrCompilations() REQUIRES(!lock_);
bool NotifyCompilationOf(ArtMethod* method, Thread* self, bool osr)
SHARED_REQUIRES(Locks::mutator_lock_)
@@ -304,6 +305,7 @@
// Number of compilations done throughout the lifetime of the JIT.
size_t number_of_compilations_ GUARDED_BY(lock_);
+ size_t number_of_osr_compilations_ GUARDED_BY(lock_);
DISALLOW_IMPLICIT_CONSTRUCTORS(JitCodeCache);
};